diff options
author | Wim <wim@42.be> | 2020-03-01 20:59:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-01 20:59:19 +0100 |
commit | 250b3bb5795240d5ebdab5416ab99dbc41be734b (patch) | |
tree | 11e44ec2e7e37cd7eb0deaf0a7843fe6bf3c0e40 /vendor | |
parent | e9edbfc051afc643d91fc04bc7fb3fe70039c213 (diff) | |
download | matterbridge-msglm-250b3bb5795240d5ebdab5416ab99dbc41be734b.tar.gz matterbridge-msglm-250b3bb5795240d5ebdab5416ab99dbc41be734b.tar.bz2 matterbridge-msglm-250b3bb5795240d5ebdab5416ab99dbc41be734b.zip |
Use upstream slack-go/slack again (#1018)
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/github.com/nlopes/slack/block_unknown.go | 14 | ||||
-rw-r--r-- | vendor/github.com/nlopes/slack/go.sum | 22 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/.gitignore (renamed from vendor/github.com/nlopes/slack/.gitignore) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/.gometalinter.json (renamed from vendor/github.com/nlopes/slack/.gometalinter.json) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/.travis.yml (renamed from vendor/github.com/nlopes/slack/.travis.yml) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/CHANGELOG.md (renamed from vendor/github.com/nlopes/slack/CHANGELOG.md) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/LICENSE (renamed from vendor/github.com/nlopes/slack/LICENSE) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/Makefile | 36 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/README.md (renamed from vendor/github.com/nlopes/slack/README.md) | 23 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/TODO.txt (renamed from vendor/github.com/nlopes/slack/TODO.txt) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/admin.go (renamed from vendor/github.com/nlopes/slack/admin.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/attachments.go (renamed from vendor/github.com/nlopes/slack/attachments.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/auth.go (renamed from vendor/github.com/nlopes/slack/auth.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/backoff.go (renamed from vendor/github.com/nlopes/slack/backoff.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/block.go (renamed from vendor/github.com/nlopes/slack/block.go) | 1 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/block_action.go (renamed from vendor/github.com/nlopes/slack/block_action.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/block_context.go (renamed from vendor/github.com/nlopes/slack/block_context.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/block_conv.go (renamed from vendor/github.com/nlopes/slack/block_conv.go) | 51 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/block_divider.go (renamed from vendor/github.com/nlopes/slack/block_divider.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/block_element.go (renamed from vendor/github.com/nlopes/slack/block_element.go) | 51 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/block_image.go (renamed from vendor/github.com/nlopes/slack/block_image.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/block_input.go | 30 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/block_object.go (renamed from vendor/github.com/nlopes/slack/block_object.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/block_section.go (renamed from vendor/github.com/nlopes/slack/block_section.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/bots.go (renamed from vendor/github.com/nlopes/slack/bots.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/channels.go (renamed from vendor/github.com/nlopes/slack/channels.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/chat.go (renamed from vendor/github.com/nlopes/slack/chat.go) | 6 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/comment.go (renamed from vendor/github.com/nlopes/slack/comment.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/conversation.go (renamed from vendor/github.com/nlopes/slack/conversation.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/dialog.go (renamed from vendor/github.com/nlopes/slack/dialog.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/dialog_select.go (renamed from vendor/github.com/nlopes/slack/dialog_select.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/dialog_text.go (renamed from vendor/github.com/nlopes/slack/dialog_text.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/dnd.go (renamed from vendor/github.com/nlopes/slack/dnd.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/emoji.go (renamed from vendor/github.com/nlopes/slack/emoji.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/errors.go (renamed from vendor/github.com/nlopes/slack/errors.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/files.go (renamed from vendor/github.com/nlopes/slack/files.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/go.mod (renamed from vendor/github.com/nlopes/slack/go.mod) | 5 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/go.sum | 12 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/groups.go (renamed from vendor/github.com/nlopes/slack/groups.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/history.go (renamed from vendor/github.com/nlopes/slack/history.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/im.go (renamed from vendor/github.com/nlopes/slack/im.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/info.go (renamed from vendor/github.com/nlopes/slack/info.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/interactions.go (renamed from vendor/github.com/nlopes/slack/interactions.go) | 1 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/internal/errorsx/errorsx.go (renamed from vendor/github.com/nlopes/slack/internal/errorsx/errorsx.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/internal/timex/timex.go (renamed from vendor/github.com/nlopes/slack/internal/timex/timex.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/item.go (renamed from vendor/github.com/nlopes/slack/item.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/logger.go (renamed from vendor/github.com/nlopes/slack/logger.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/messageID.go (renamed from vendor/github.com/nlopes/slack/messageID.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/messages.go (renamed from vendor/github.com/nlopes/slack/messages.go) | 3 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/misc.go (renamed from vendor/github.com/nlopes/slack/misc.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/oauth.go (renamed from vendor/github.com/nlopes/slack/oauth.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/pagination.go (renamed from vendor/github.com/nlopes/slack/pagination.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/pins.go (renamed from vendor/github.com/nlopes/slack/pins.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/reactions.go (renamed from vendor/github.com/nlopes/slack/reactions.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/reminders.go (renamed from vendor/github.com/nlopes/slack/reminders.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/rtm.go (renamed from vendor/github.com/nlopes/slack/rtm.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/search.go (renamed from vendor/github.com/nlopes/slack/search.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/security.go (renamed from vendor/github.com/nlopes/slack/security.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/slack.go (renamed from vendor/github.com/nlopes/slack/slack.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/slackutilsx/slackutilsx.go (renamed from vendor/github.com/nlopes/slack/slackutilsx/slackutilsx.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/slash.go (renamed from vendor/github.com/nlopes/slack/slash.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/stars.go (renamed from vendor/github.com/nlopes/slack/stars.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/team.go (renamed from vendor/github.com/nlopes/slack/team.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/usergroups.go (renamed from vendor/github.com/nlopes/slack/usergroups.go) | 2 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/users.go (renamed from vendor/github.com/nlopes/slack/users.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/views.go | 221 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/webhooks.go (renamed from vendor/github.com/nlopes/slack/webhooks.go) | 25 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/webhooks_go112.go | 34 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/webhooks_go113.go | 33 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/websocket.go (renamed from vendor/github.com/nlopes/slack/websocket.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/websocket_channels.go (renamed from vendor/github.com/nlopes/slack/websocket_channels.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/websocket_desktop_notification.go (renamed from vendor/github.com/nlopes/slack/websocket_desktop_notification.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/websocket_dm.go (renamed from vendor/github.com/nlopes/slack/websocket_dm.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/websocket_dnd.go (renamed from vendor/github.com/nlopes/slack/websocket_dnd.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/websocket_files.go (renamed from vendor/github.com/nlopes/slack/websocket_files.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/websocket_groups.go (renamed from vendor/github.com/nlopes/slack/websocket_groups.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/websocket_internals.go (renamed from vendor/github.com/nlopes/slack/websocket_internals.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/websocket_managed_conn.go (renamed from vendor/github.com/nlopes/slack/websocket_managed_conn.go) | 4 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/websocket_misc.go (renamed from vendor/github.com/nlopes/slack/websocket_misc.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/websocket_pins.go (renamed from vendor/github.com/nlopes/slack/websocket_pins.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/websocket_reactions.go (renamed from vendor/github.com/nlopes/slack/websocket_reactions.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/websocket_stars.go (renamed from vendor/github.com/nlopes/slack/websocket_stars.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/websocket_subteam.go (renamed from vendor/github.com/nlopes/slack/websocket_subteam.go) | 0 | ||||
-rw-r--r-- | vendor/github.com/slack-go/slack/websocket_teams.go (renamed from vendor/github.com/nlopes/slack/websocket_teams.go) | 0 | ||||
-rw-r--r-- | vendor/modules.txt | 10 |
85 files changed, 496 insertions, 100 deletions
diff --git a/vendor/github.com/nlopes/slack/block_unknown.go b/vendor/github.com/nlopes/slack/block_unknown.go deleted file mode 100644 index b5ce1e47..00000000 --- a/vendor/github.com/nlopes/slack/block_unknown.go +++ /dev/null @@ -1,14 +0,0 @@ -package slack - -// UnknownBlock represents a block type that is not yet known. This block type exists to prevent Slack from introducing -// new and unknown block types that break this library. -type UnknownBlock struct { - Type MessageBlockType `json:"type"` - BlockID string `json:"block_id,omitempty"` - Elements BlockElements `json:"elements"` -} - -// BlockType returns the type of the block -func (b UnknownBlock) BlockType() MessageBlockType { - return b.Type -} diff --git a/vendor/github.com/nlopes/slack/go.sum b/vendor/github.com/nlopes/slack/go.sum deleted file mode 100644 index 3bb45c1f..00000000 --- a/vendor/github.com/nlopes/slack/go.sum +++ /dev/null @@ -1,22 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -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/gorilla/websocket v1.2.0 h1:VJtLvh6VQym50czpZzx07z/kw9EgAxI3x1ZB8taTMQQ= -github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/nlopes/slack v0.1.0/go.mod h1:jVI4BBK3lSktibKahxBF74txcK2vyvkza1z/+rRnVAM= -github.com/nlopes/slack v0.5.0 h1:NbIae8Kd0NpqaEI3iUrsuS0KbcEDhzhc939jLW5fNm0= -github.com/nlopes/slack v0.5.0/go.mod h1:jVI4BBK3lSktibKahxBF74txcK2vyvkza1z/+rRnVAM= -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= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/victorcoder/slack-test v0.0.0-20190131110821-6f9a569c10af h1:JFxr+No3ZWgCtxnnTWCybnB/z0Iy3qLmdj3u2NV5o48= -github.com/victorcoder/slack-test v0.0.0-20190131110821-6f9a569c10af/go.mod h1:dStM4ShMus8J3hiq66ExbbzGLkwyZ+RQJePwFhWCCvQ= -github.com/victorcoder/slack-test v0.0.0-20190131113129-a43b3bb77f43 h1:wtFekkaAAQibpy3iE4Hhx2Gi9pZAbITOSfVP7GXk5eM= -github.com/victorcoder/slack-test v0.0.0-20190131113129-a43b3bb77f43/go.mod h1:dStM4ShMus8J3hiq66ExbbzGLkwyZ+RQJePwFhWCCvQ= -golang.org/x/net v0.0.0-20180108090419-434ec0c7fe37 h1:BkNcmLtAVeWe9h5k0jt24CQgaG5vb4x/doFbAiEC/Ho= -golang.org/x/net v0.0.0-20180108090419-434ec0c7fe37/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= diff --git a/vendor/github.com/nlopes/slack/.gitignore b/vendor/github.com/slack-go/slack/.gitignore index ac6f3eeb..ac6f3eeb 100644 --- a/vendor/github.com/nlopes/slack/.gitignore +++ b/vendor/github.com/slack-go/slack/.gitignore diff --git a/vendor/github.com/nlopes/slack/.gometalinter.json b/vendor/github.com/slack-go/slack/.gometalinter.json index 5fa629d4..5fa629d4 100644 --- a/vendor/github.com/nlopes/slack/.gometalinter.json +++ b/vendor/github.com/slack-go/slack/.gometalinter.json diff --git a/vendor/github.com/nlopes/slack/.travis.yml b/vendor/github.com/slack-go/slack/.travis.yml index 6a968232..6a968232 100644 --- a/vendor/github.com/nlopes/slack/.travis.yml +++ b/vendor/github.com/slack-go/slack/.travis.yml diff --git a/vendor/github.com/nlopes/slack/CHANGELOG.md b/vendor/github.com/slack-go/slack/CHANGELOG.md index 48bcce55..48bcce55 100644 --- a/vendor/github.com/nlopes/slack/CHANGELOG.md +++ b/vendor/github.com/slack-go/slack/CHANGELOG.md diff --git a/vendor/github.com/nlopes/slack/LICENSE b/vendor/github.com/slack-go/slack/LICENSE index 5145171f..5145171f 100644 --- a/vendor/github.com/nlopes/slack/LICENSE +++ b/vendor/github.com/slack-go/slack/LICENSE diff --git a/vendor/github.com/slack-go/slack/Makefile b/vendor/github.com/slack-go/slack/Makefile new file mode 100644 index 00000000..1c64747d --- /dev/null +++ b/vendor/github.com/slack-go/slack/Makefile @@ -0,0 +1,36 @@ +.PHONY: help deps fmt lint test test-race test-integration + +help: + @echo "" + @echo "Welcome to slack-go/slack make." + @echo "The following commands are available:" + @echo "" + @echo " make deps : Fetch all dependencies" + @echo " make fmt : Run go fmt to fix any formatting issues" + @echo " make lint : Use go vet to check for linting issues" + @echo " make test : Run all short tests" + @echo " make test-race : Run all tests with race condition checking" + @echo " make test-integration : Run all tests without limiting to short" + @echo "" + @echo " make pr-prep : Run this before making a PR to run fmt, lint and tests" + @echo "" + +deps: + @go mod tidy + +fmt: + @go fmt . + +lint: + @go vet . + +test: + @go test -count=1 -timeout 300s -short . + +test-race: + @go test -count=1 -timeout 300s -short -race . + +test-integration: + @go test -count=1 -timeout 600s . + +pr-prep: fmt lint test-race test-integration diff --git a/vendor/github.com/nlopes/slack/README.md b/vendor/github.com/slack-go/slack/README.md index a5e8e5ef..eaf07782 100644 --- a/vendor/github.com/nlopes/slack/README.md +++ b/vendor/github.com/slack-go/slack/README.md @@ -1,5 +1,6 @@ -Slack API in Go [![GoDoc](https://godoc.org/github.com/nlopes/slack?status.svg)](https://godoc.org/github.com/nlopes/slack) [![Build Status](https://travis-ci.org/nlopes/slack.svg)](https://travis-ci.org/nlopes/slack) +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. [![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) @@ -12,13 +13,13 @@ a fully managed way. ## Changelog -[CHANGELOG.md](https://github.com/nlopes/slack/blob/master/CHANGELOG.md) is available. Please visit it for updates. +[CHANGELOG.md](https://github.com/slack-go/slack/blob/master/CHANGELOG.md) is available. Please visit it for updates. ## Installing ### *go get* - $ go get -u github.com/nlopes/slack + $ go get -u github.com/slack-go/slack ## Example @@ -28,7 +29,7 @@ a fully managed way. import ( "fmt" - "github.com/nlopes/slack" + "github.com/slack-go/slack" ) func main() { @@ -53,7 +54,7 @@ func main() { import ( "fmt" - "github.com/nlopes/slack" + "github.com/slack-go/slack" ) func main() { @@ -69,12 +70,12 @@ func main() { ## Minimal RTM usage: -See https://github.com/nlopes/slack/blob/master/examples/websocket/websocket.go +See https://github.com/slack-go/slack/blob/master/examples/websocket/websocket.go ## Minimal EventsAPI usage: -See https://github.com/nlopes/slack/blob/master/examples/eventsapi/events.go +See https://github.com/slack-go/slack/blob/master/examples/eventsapi/events.go ## Contributing @@ -82,6 +83,14 @@ See https://github.com/nlopes/slack/blob/master/examples/eventsapi/events.go You are more than welcome to contribute to this project. Fork and make a Pull Request, or create an Issue if you see any problem. +Before making any Pull Request please run the following: + +``` +make pr-prep +``` + +This will check/update code formatting, linting and then run all tests + ## License BSD 2 Clause license diff --git a/vendor/github.com/nlopes/slack/TODO.txt b/vendor/github.com/slack-go/slack/TODO.txt index 8607960b..8607960b 100644 --- a/vendor/github.com/nlopes/slack/TODO.txt +++ b/vendor/github.com/slack-go/slack/TODO.txt diff --git a/vendor/github.com/nlopes/slack/admin.go b/vendor/github.com/slack-go/slack/admin.go index d51426b5..d51426b5 100644 --- a/vendor/github.com/nlopes/slack/admin.go +++ b/vendor/github.com/slack-go/slack/admin.go diff --git a/vendor/github.com/nlopes/slack/attachments.go b/vendor/github.com/slack-go/slack/attachments.go index af62fb67..b5b79f9f 100644 --- a/vendor/github.com/nlopes/slack/attachments.go +++ b/vendor/github.com/slack-go/slack/attachments.go @@ -61,7 +61,7 @@ type ConfirmationField struct { // Attachment contains all the information for an attachment type Attachment struct { Color string `json:"color,omitempty"` - Fallback string `json:"fallback"` + Fallback string `json:"fallback,omitempty"` CallbackID string `json:"callback_id,omitempty"` ID int `json:"id,omitempty"` @@ -84,7 +84,7 @@ type Attachment struct { Actions []AttachmentAction `json:"actions,omitempty"` MarkdownIn []string `json:"mrkdwn_in,omitempty"` - Blocks []Block `json:"blocks,omitempty"` + Blocks Blocks `json:"blocks,omitempty"` Footer string `json:"footer,omitempty"` FooterIcon string `json:"footer_icon,omitempty"` diff --git a/vendor/github.com/nlopes/slack/auth.go b/vendor/github.com/slack-go/slack/auth.go index dc1dbcdf..dc1dbcdf 100644 --- a/vendor/github.com/nlopes/slack/auth.go +++ b/vendor/github.com/slack-go/slack/auth.go diff --git a/vendor/github.com/nlopes/slack/backoff.go b/vendor/github.com/slack-go/slack/backoff.go index 2ba697e7..2ba697e7 100644 --- a/vendor/github.com/nlopes/slack/backoff.go +++ b/vendor/github.com/slack-go/slack/backoff.go diff --git a/vendor/github.com/nlopes/slack/block.go b/vendor/github.com/slack-go/slack/block.go index 502b1135..32ff260c 100644 --- a/vendor/github.com/nlopes/slack/block.go +++ b/vendor/github.com/slack-go/slack/block.go @@ -14,6 +14,7 @@ const ( MBTImage MessageBlockType = "image" MBTAction MessageBlockType = "actions" MBTContext MessageBlockType = "context" + MBTInput MessageBlockType = "input" ) // Block defines an interface all block types should implement diff --git a/vendor/github.com/nlopes/slack/block_action.go b/vendor/github.com/slack-go/slack/block_action.go index fe46a95c..fe46a95c 100644 --- a/vendor/github.com/nlopes/slack/block_action.go +++ b/vendor/github.com/slack-go/slack/block_action.go diff --git a/vendor/github.com/nlopes/slack/block_context.go b/vendor/github.com/slack-go/slack/block_context.go index c37bf27e..c37bf27e 100644 --- a/vendor/github.com/nlopes/slack/block_context.go +++ b/vendor/github.com/slack-go/slack/block_context.go diff --git a/vendor/github.com/nlopes/slack/block_conv.go b/vendor/github.com/slack-go/slack/block_conv.go index 9f5d52c7..ce48ce19 100644 --- a/vendor/github.com/nlopes/slack/block_conv.go +++ b/vendor/github.com/slack-go/slack/block_conv.go @@ -58,13 +58,18 @@ func (b *Blocks) UnmarshalJSON(data []byte) error { block = &DividerBlock{} case "image": block = &ImageBlock{} + case "input": + block = &InputBlock{} case "section": block = &SectionBlock{} case "rich_text": // for now ignore the (complex) content of rich_text blocks until we can fully support it continue + case "file": + // for now ignore the file blocks until we can fully support it + continue default: - block = &UnknownBlock{} + return errors.New("unsupported block type") } err = json.Unmarshal(r, block) @@ -79,6 +84,46 @@ func (b *Blocks) UnmarshalJSON(data []byte) error { return nil } +// UnmarshalJSON implements the Unmarshaller interface for InputBlock, so that any JSON +// unmarshalling is delegated and proper type determination can be made before unmarshal +func (b *InputBlock) UnmarshalJSON(data []byte) error { + type alias InputBlock + a := struct { + Element json.RawMessage `json:"element"` + *alias + }{ + alias: (*alias)(b), + } + + if err := json.Unmarshal(data, &a); err != nil { + return err + } + + s := sumtype{} + if err := json.Unmarshal(a.Element, &s); err != nil { + return nil + } + + var e BlockElement + switch s.TypeVal { + case "datepicker": + e = &DatePickerBlockElement{} + case "plain_text_input": + e = &PlainTextInputBlockElement{} + case "static_select", "external_select", "users_select", "conversations_select", "channels_select": + e = &SelectBlockElement{} + default: + return errors.New("unsupported block element type") + } + + if err := json.Unmarshal(a.Element, e); err != nil { + return err + } + b.Element = e + + return nil +} + // MarshalJSON implements the Marshaller interface for BlockElements so that any JSON // marshalling is delegated and proper type determination can be made before marshal func (b *BlockElements) MarshalJSON() ([]byte, error) { @@ -127,10 +172,12 @@ func (b *BlockElements) UnmarshalJSON(data []byte) error { blockElement = &OverflowBlockElement{} case "datepicker": blockElement = &DatePickerBlockElement{} + case "plain_text_input": + blockElement = &PlainTextInputBlockElement{} case "static_select", "external_select", "users_select", "conversations_select", "channels_select": blockElement = &SelectBlockElement{} default: - blockElement = &UnknownBlockElement{} + return errors.New("unsupported block element type") } err = json.Unmarshal(r, blockElement) diff --git a/vendor/github.com/nlopes/slack/block_divider.go b/vendor/github.com/slack-go/slack/block_divider.go index 2d442ba1..2d442ba1 100644 --- a/vendor/github.com/nlopes/slack/block_divider.go +++ b/vendor/github.com/slack-go/slack/block_divider.go diff --git a/vendor/github.com/nlopes/slack/block_element.go b/vendor/github.com/slack-go/slack/block_element.go index 5b1b4b01..e0a7bf96 100644 --- a/vendor/github.com/nlopes/slack/block_element.go +++ b/vendor/github.com/slack-go/slack/block_element.go @@ -3,10 +3,11 @@ package slack // https://api.slack.com/reference/messaging/block-elements const ( - METImage MessageElementType = "image" - METButton MessageElementType = "button" - METOverflow MessageElementType = "overflow" - METDatepicker MessageElementType = "datepicker" + METImage MessageElementType = "image" + METButton MessageElementType = "button" + METOverflow MessageElementType = "overflow" + METDatepicker MessageElementType = "datepicker" + METPlainTextInput MessageElementType = "plain_text_input" MixedElementImage MixedElementType = "mixed_image" MixedElementText MixedElementType = "mixed_text" @@ -62,20 +63,6 @@ type BlockElements struct { ElementSet []BlockElement `json:"elements,omitempty"` } -// UnknownBlockElement any block element that this library does not directly support. -// See the "Rich Elements" section at the following URL: -// https://api.slack.com/changelog/2019-09-what-they-see-is-what-you-get-and-more-and-less -// New block element types may be introduced by Slack at any time; this is a catch-all for any such block elements. -type UnknownBlockElement struct { - Type MessageElementType `json:"type"` - Elements BlockElements -} - -// ElementType returns the type of the Element -func (s UnknownBlockElement) ElementType() MessageElementType { - return s.Type -} - // ImageBlockElement An element to insert an image - this element can be used // in section and context blocks only. If you want a block with only an image // in it, you're looking for the image block. @@ -250,3 +237,31 @@ func NewDatePickerBlockElement(actionID string) *DatePickerBlockElement { ActionID: actionID, } } + +// PlainTextInputBlockElement creates a field where a user can enter freeform data. +// Plain-text input elements are currently only available in modals. +// +// More Information: https://api.slack.com/reference/messaging/block-elements#input +type PlainTextInputBlockElement struct { + Type MessageElementType `json:"type"` + ActionID string `json:"action_id"` + Placeholder *TextBlockObject `json:"placeholder,omitempty"` + InitialValue string `json:"initial_value,omitempty"` + Multiline bool `json:"multiline,omitempty"` + MinLength int `json:"min_length,omitempty"` + MaxLength int `json:"max_length,omitempty"` +} + +// ElementType returns the type of the Element +func (s PlainTextInputBlockElement) ElementType() MessageElementType { + return s.Type +} + +// NewPlainTextInputBlockElement returns an instance of a plain-text input element +func NewPlainTextInputBlockElement(placeholder *TextBlockObject, actionID string) *PlainTextInputBlockElement { + return &PlainTextInputBlockElement{ + Type: METPlainTextInput, + ActionID: actionID, + Placeholder: placeholder, + } +} diff --git a/vendor/github.com/nlopes/slack/block_image.go b/vendor/github.com/slack-go/slack/block_image.go index 6de3f63a..6de3f63a 100644 --- a/vendor/github.com/nlopes/slack/block_image.go +++ b/vendor/github.com/slack-go/slack/block_image.go diff --git a/vendor/github.com/slack-go/slack/block_input.go b/vendor/github.com/slack-go/slack/block_input.go new file mode 100644 index 00000000..9d082038 --- /dev/null +++ b/vendor/github.com/slack-go/slack/block_input.go @@ -0,0 +1,30 @@ +package slack + +// InputBlock defines data that is used to collect information from users - +// it can hold a plain-text input element, a select menu element, +// a multi-select menu element, or a datepicker. +// +// More Information: https://api.slack.com/reference/messaging/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"` +} + +// BlockType returns the type of the block +func (s InputBlock) BlockType() MessageBlockType { + return s.Type +} + +// NewInputBlock returns a new instance of an Input Block +func NewInputBlock(blockID string, label *TextBlockObject, element BlockElement) *InputBlock { + return &InputBlock{ + Type: MBTInput, + BlockID: blockID, + Label: label, + Element: element, + } +} diff --git a/vendor/github.com/nlopes/slack/block_object.go b/vendor/github.com/slack-go/slack/block_object.go index 824ec93c..824ec93c 100644 --- a/vendor/github.com/nlopes/slack/block_object.go +++ b/vendor/github.com/slack-go/slack/block_object.go diff --git a/vendor/github.com/nlopes/slack/block_section.go b/vendor/github.com/slack-go/slack/block_section.go index 01ffd5a1..01ffd5a1 100644 --- a/vendor/github.com/nlopes/slack/block_section.go +++ b/vendor/github.com/slack-go/slack/block_section.go diff --git a/vendor/github.com/nlopes/slack/bots.go b/vendor/github.com/slack-go/slack/bots.go index da21ba0c..da21ba0c 100644 --- a/vendor/github.com/nlopes/slack/bots.go +++ b/vendor/github.com/slack-go/slack/bots.go diff --git a/vendor/github.com/nlopes/slack/channels.go b/vendor/github.com/slack-go/slack/channels.go index c99e6655..c99e6655 100644 --- a/vendor/github.com/nlopes/slack/channels.go +++ b/vendor/github.com/slack-go/slack/channels.go diff --git a/vendor/github.com/nlopes/slack/chat.go b/vendor/github.com/slack-go/slack/chat.go index c0744842..b54f8d6d 100644 --- a/vendor/github.com/nlopes/slack/chat.go +++ b/vendor/github.com/slack-go/slack/chat.go @@ -6,7 +6,7 @@ import ( "net/http" "net/url" - "github.com/nlopes/slack/slackutilsx" + "github.com/slack-go/slack/slackutilsx" ) const ( @@ -347,11 +347,11 @@ func MsgOptionUnfurl(timestamp string, unfurls map[string]Attachment) MsgOption } // MsgOptionResponseURL supplies a url to use as the endpoint. -func MsgOptionResponseURL(url string, rt string) MsgOption { +func MsgOptionResponseURL(url string, responseType string) MsgOption { return func(config *sendConfig) error { config.mode = chatResponse config.endpoint = url - config.responseType = rt + config.responseType = responseType config.values.Del("ts") return nil } diff --git a/vendor/github.com/nlopes/slack/comment.go b/vendor/github.com/slack-go/slack/comment.go index 7d1c0d4e..7d1c0d4e 100644 --- a/vendor/github.com/nlopes/slack/comment.go +++ b/vendor/github.com/slack-go/slack/comment.go diff --git a/vendor/github.com/nlopes/slack/conversation.go b/vendor/github.com/slack-go/slack/conversation.go index 1e4a61f1..1e4a61f1 100644 --- a/vendor/github.com/nlopes/slack/conversation.go +++ b/vendor/github.com/slack-go/slack/conversation.go diff --git a/vendor/github.com/nlopes/slack/dialog.go b/vendor/github.com/slack-go/slack/dialog.go index 376cd9e6..376cd9e6 100644 --- a/vendor/github.com/nlopes/slack/dialog.go +++ b/vendor/github.com/slack-go/slack/dialog.go diff --git a/vendor/github.com/nlopes/slack/dialog_select.go b/vendor/github.com/slack-go/slack/dialog_select.go index 385cef68..385cef68 100644 --- a/vendor/github.com/nlopes/slack/dialog_select.go +++ b/vendor/github.com/slack-go/slack/dialog_select.go diff --git a/vendor/github.com/nlopes/slack/dialog_text.go b/vendor/github.com/slack-go/slack/dialog_text.go index da06bd6d..da06bd6d 100644 --- a/vendor/github.com/nlopes/slack/dialog_text.go +++ b/vendor/github.com/slack-go/slack/dialog_text.go diff --git a/vendor/github.com/nlopes/slack/dnd.go b/vendor/github.com/slack-go/slack/dnd.go index a3aa680c..a3aa680c 100644 --- a/vendor/github.com/nlopes/slack/dnd.go +++ b/vendor/github.com/slack-go/slack/dnd.go diff --git a/vendor/github.com/nlopes/slack/emoji.go b/vendor/github.com/slack-go/slack/emoji.go index b2b0c6c9..b2b0c6c9 100644 --- a/vendor/github.com/nlopes/slack/emoji.go +++ b/vendor/github.com/slack-go/slack/emoji.go diff --git a/vendor/github.com/nlopes/slack/errors.go b/vendor/github.com/slack-go/slack/errors.go index b31e2caf..a1dfec25 100644 --- a/vendor/github.com/nlopes/slack/errors.go +++ b/vendor/github.com/slack-go/slack/errors.go @@ -1,6 +1,6 @@ package slack -import "github.com/nlopes/slack/internal/errorsx" +import "github.com/slack-go/slack/internal/errorsx" // Errors returned by various methods. const ( diff --git a/vendor/github.com/nlopes/slack/files.go b/vendor/github.com/slack-go/slack/files.go index 3a7363de..3a7363de 100644 --- a/vendor/github.com/nlopes/slack/files.go +++ b/vendor/github.com/slack-go/slack/files.go diff --git a/vendor/github.com/nlopes/slack/go.mod b/vendor/github.com/slack-go/slack/go.mod index a97bf381..cbe11808 100644 --- a/vendor/github.com/nlopes/slack/go.mod +++ b/vendor/github.com/slack-go/slack/go.mod @@ -1,7 +1,10 @@ -module github.com/matterbridge/slack +module github.com/slack-go/slack + +go 1.13 require ( github.com/davecgh/go-spew v1.1.1 // indirect + github.com/go-test/deep v1.0.4 github.com/gorilla/websocket v1.2.0 github.com/pkg/errors v0.8.0 github.com/pmezard/go-difflib v1.0.0 // indirect diff --git a/vendor/github.com/slack-go/slack/go.sum b/vendor/github.com/slack-go/slack/go.sum new file mode 100644 index 00000000..7a0ae46e --- /dev/null +++ b/vendor/github.com/slack-go/slack/go.sum @@ -0,0 +1,12 @@ +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/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= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= diff --git a/vendor/github.com/nlopes/slack/groups.go b/vendor/github.com/slack-go/slack/groups.go index 23374869..23374869 100644 --- a/vendor/github.com/nlopes/slack/groups.go +++ b/vendor/github.com/slack-go/slack/groups.go diff --git a/vendor/github.com/nlopes/slack/history.go b/vendor/github.com/slack-go/slack/history.go index 87b2e1ed..87b2e1ed 100644 --- a/vendor/github.com/nlopes/slack/history.go +++ b/vendor/github.com/slack-go/slack/history.go diff --git a/vendor/github.com/nlopes/slack/im.go b/vendor/github.com/slack-go/slack/im.go index ee784fef..ee784fef 100644 --- a/vendor/github.com/nlopes/slack/im.go +++ b/vendor/github.com/slack-go/slack/im.go diff --git a/vendor/github.com/nlopes/slack/info.go b/vendor/github.com/slack-go/slack/info.go index 31f459f1..31f459f1 100644 --- a/vendor/github.com/nlopes/slack/info.go +++ b/vendor/github.com/slack-go/slack/info.go diff --git a/vendor/github.com/nlopes/slack/interactions.go b/vendor/github.com/slack-go/slack/interactions.go index de1ed370..26a8b6db 100644 --- a/vendor/github.com/nlopes/slack/interactions.go +++ b/vendor/github.com/slack-go/slack/interactions.go @@ -44,6 +44,7 @@ type InteractionCallback struct { MessageTs string `json:"message_ts"` AttachmentID string `json:"attachment_id"` ActionCallback ActionCallbacks `json:"actions"` + APIAppID string `json:"api_app_id"` DialogSubmissionCallback } diff --git a/vendor/github.com/nlopes/slack/internal/errorsx/errorsx.go b/vendor/github.com/slack-go/slack/internal/errorsx/errorsx.go index cb850577..cb850577 100644 --- a/vendor/github.com/nlopes/slack/internal/errorsx/errorsx.go +++ b/vendor/github.com/slack-go/slack/internal/errorsx/errorsx.go diff --git a/vendor/github.com/nlopes/slack/internal/timex/timex.go b/vendor/github.com/slack-go/slack/internal/timex/timex.go index 40063f73..40063f73 100644 --- a/vendor/github.com/nlopes/slack/internal/timex/timex.go +++ b/vendor/github.com/slack-go/slack/internal/timex/timex.go diff --git a/vendor/github.com/nlopes/slack/item.go b/vendor/github.com/slack-go/slack/item.go index 89af4eb1..89af4eb1 100644 --- a/vendor/github.com/nlopes/slack/item.go +++ b/vendor/github.com/slack-go/slack/item.go diff --git a/vendor/github.com/nlopes/slack/logger.go b/vendor/github.com/slack-go/slack/logger.go index 6a3533a9..6a3533a9 100644 --- a/vendor/github.com/nlopes/slack/logger.go +++ b/vendor/github.com/slack-go/slack/logger.go diff --git a/vendor/github.com/nlopes/slack/messageID.go b/vendor/github.com/slack-go/slack/messageID.go index a17472b4..a17472b4 100644 --- a/vendor/github.com/nlopes/slack/messageID.go +++ b/vendor/github.com/slack-go/slack/messageID.go diff --git a/vendor/github.com/nlopes/slack/messages.go b/vendor/github.com/slack-go/slack/messages.go index f67d99a7..f2f5b145 100644 --- a/vendor/github.com/nlopes/slack/messages.go +++ b/vendor/github.com/slack-go/slack/messages.go @@ -15,13 +15,14 @@ type OutgoingMessage struct { // Message is an auxiliary type to allow us to have a message containing sub messages type Message struct { Msg - SubMessage *Msg `json:"message,omitempty"` + SubMessage *Msg `json:"message,omitempty"` PreviousMessage *Msg `json:"previous_message,omitempty"` } // Msg contains information about a slack message type Msg struct { // Basic Message + ClientMsgID string `json:"client_msg_id"` Type string `json:"type,omitempty"` Channel string `json:"channel,omitempty"` User string `json:"user,omitempty"` diff --git a/vendor/github.com/nlopes/slack/misc.go b/vendor/github.com/slack-go/slack/misc.go index 0dcee950..0dcee950 100644 --- a/vendor/github.com/nlopes/slack/misc.go +++ b/vendor/github.com/slack-go/slack/misc.go diff --git a/vendor/github.com/nlopes/slack/oauth.go b/vendor/github.com/slack-go/slack/oauth.go index 29d6dce9..29d6dce9 100644 --- a/vendor/github.com/nlopes/slack/oauth.go +++ b/vendor/github.com/slack-go/slack/oauth.go diff --git a/vendor/github.com/nlopes/slack/pagination.go b/vendor/github.com/slack-go/slack/pagination.go index 87dd136a..87dd136a 100644 --- a/vendor/github.com/nlopes/slack/pagination.go +++ b/vendor/github.com/slack-go/slack/pagination.go diff --git a/vendor/github.com/nlopes/slack/pins.go b/vendor/github.com/slack-go/slack/pins.go index ef97c8df..ef97c8df 100644 --- a/vendor/github.com/nlopes/slack/pins.go +++ b/vendor/github.com/slack-go/slack/pins.go diff --git a/vendor/github.com/nlopes/slack/reactions.go b/vendor/github.com/slack-go/slack/reactions.go index 2a9bd42e..2a9bd42e 100644 --- a/vendor/github.com/nlopes/slack/reactions.go +++ b/vendor/github.com/slack-go/slack/reactions.go diff --git a/vendor/github.com/nlopes/slack/reminders.go b/vendor/github.com/slack-go/slack/reminders.go index 9b905387..9b905387 100644 --- a/vendor/github.com/nlopes/slack/reminders.go +++ b/vendor/github.com/slack-go/slack/reminders.go diff --git a/vendor/github.com/nlopes/slack/rtm.go b/vendor/github.com/slack-go/slack/rtm.go index ef6ba343..ef6ba343 100644 --- a/vendor/github.com/nlopes/slack/rtm.go +++ b/vendor/github.com/slack-go/slack/rtm.go diff --git a/vendor/github.com/nlopes/slack/search.go b/vendor/github.com/slack-go/slack/search.go index de6b40ac..de6b40ac 100644 --- a/vendor/github.com/nlopes/slack/search.go +++ b/vendor/github.com/slack-go/slack/search.go diff --git a/vendor/github.com/nlopes/slack/security.go b/vendor/github.com/slack-go/slack/security.go index dbe8fb2d..dbe8fb2d 100644 --- a/vendor/github.com/nlopes/slack/security.go +++ b/vendor/github.com/slack-go/slack/security.go diff --git a/vendor/github.com/nlopes/slack/slack.go b/vendor/github.com/slack-go/slack/slack.go index 94230526..d342a3e8 100644 --- a/vendor/github.com/nlopes/slack/slack.go +++ b/vendor/github.com/slack-go/slack/slack.go @@ -96,7 +96,7 @@ func New(token string, options ...Option) *Client { token: token, endpoint: APIURL, httpclient: &http.Client{}, - log: log.New(os.Stderr, "nlopes/slack", log.LstdFlags|log.Lshortfile), + log: log.New(os.Stderr, "slack-go/slack", log.LstdFlags|log.Lshortfile), } for _, opt := range options { diff --git a/vendor/github.com/nlopes/slack/slackutilsx/slackutilsx.go b/vendor/github.com/slack-go/slack/slackutilsx/slackutilsx.go index 1f7b2b8c..1f7b2b8c 100644 --- a/vendor/github.com/nlopes/slack/slackutilsx/slackutilsx.go +++ b/vendor/github.com/slack-go/slack/slackutilsx/slackutilsx.go diff --git a/vendor/github.com/nlopes/slack/slash.go b/vendor/github.com/slack-go/slack/slash.go index f62065a2..f62065a2 100644 --- a/vendor/github.com/nlopes/slack/slash.go +++ b/vendor/github.com/slack-go/slack/slash.go diff --git a/vendor/github.com/nlopes/slack/stars.go b/vendor/github.com/slack-go/slack/stars.go index 52967604..52967604 100644 --- a/vendor/github.com/nlopes/slack/stars.go +++ b/vendor/github.com/slack-go/slack/stars.go diff --git a/vendor/github.com/nlopes/slack/team.go b/vendor/github.com/slack-go/slack/team.go index 029e2b5b..029e2b5b 100644 --- a/vendor/github.com/nlopes/slack/team.go +++ b/vendor/github.com/slack-go/slack/team.go diff --git a/vendor/github.com/nlopes/slack/usergroups.go b/vendor/github.com/slack-go/slack/usergroups.go index f3206591..9417f817 100644 --- a/vendor/github.com/nlopes/slack/usergroups.go +++ b/vendor/github.com/slack-go/slack/usergroups.go @@ -206,7 +206,7 @@ func (api *Client) UpdateUserGroupContext(ctx context.Context, userGroup UserGro if userGroup.Description != "" { values["description"] = []string{userGroup.Description} } - + if len(userGroup.Prefs.Channels) > 0 { values["channels"] = []string{strings.Join(userGroup.Prefs.Channels, ",")} } diff --git a/vendor/github.com/nlopes/slack/users.go b/vendor/github.com/slack-go/slack/users.go index 4da8e4ce..6001e0fa 100644 --- a/vendor/github.com/nlopes/slack/users.go +++ b/vendor/github.com/slack-go/slack/users.go @@ -44,14 +44,14 @@ type UserProfile struct { // UserProfileCustomFields represents user profile's custom fields. // Slack API's response data type is inconsistent so we use the struct. // For detail, please see below. -// https://github.com/nlopes/slack/pull/298#discussion_r185159233 +// https://github.com/slack-go/slack/pull/298#discussion_r185159233 type UserProfileCustomFields struct { fields map[string]UserProfileCustomField } // UnmarshalJSON is the implementation of the json.Unmarshaler interface. func (fields *UserProfileCustomFields) UnmarshalJSON(b []byte) error { - // https://github.com/nlopes/slack/pull/298#discussion_r185159233 + // https://github.com/slack-go/slack/pull/298#discussion_r185159233 if string(b) == "[]" { return nil } diff --git a/vendor/github.com/slack-go/slack/views.go b/vendor/github.com/slack-go/slack/views.go new file mode 100644 index 00000000..afe391bf --- /dev/null +++ b/vendor/github.com/slack-go/slack/views.go @@ -0,0 +1,221 @@ +package slack + +import ( + "context" + "encoding/json" +) + +const ( + VTModal ViewType = "modal" + VTHomeTab ViewType = "home" +) + +type ViewType string + +type View struct { + SlackResponse + ID string `json:"id"` + TeamID string `json:"team_id"` + Type ViewType `json:"type"` + Title *TextBlockObject `json:"title"` + Close *TextBlockObject `json:"close"` + Submit *TextBlockObject `json:"submit"` + Blocks Blocks `json:"blocks"` + PrivateMetadata string `json:"private_metadata"` + CallbackID string `json:"callback_id"` + State interface{} `json:"state"` + Hash string `json:"hash"` + ClearOnClose bool `json:"clear_on_close"` + NotifyOnClose bool `json:"notify_on_close"` + RootViewID string `json:"root_view_id"` + PreviousViewID string `json:"previous_view_id"` + AppID string `json:"app_id"` + ExternalID string `json:"external_id"` + BotID string `json:"bot_id"` +} + +type ModalViewRequest struct { + Type ViewType `json:"type"` + Title *TextBlockObject `json:"title"` + Blocks Blocks `json:"blocks"` + Close *TextBlockObject `json:"close"` + Submit *TextBlockObject `json:"submit"` + PrivateMetadata string `json:"private_metadata"` + CallbackID string `json:"callback_id"` + ClearOnClose bool `json:"clear_on_close"` + NotifyOnClose bool `json:"notify_on_close"` + ExternalID string `json:"external_id"` +} + +func (v *ModalViewRequest) ViewType() ViewType { + return v.Type +} + +type HomeTabViewRequest struct { + Type ViewType `json:"type"` + Blocks Blocks `json:"blocks"` + PrivateMetadata string `json:"private_metadata"` + CallbackID string `json:"callback_id"` + ExternalID string `json:"external_id"` +} + +func (v *HomeTabViewRequest) ViewType() ViewType { + return v.Type +} + +type openViewRequest struct { + TriggerID string `json:"trigger_id"` + View ModalViewRequest `json:"view"` +} + +type publishViewRequest struct { + UserID string `json:"user_id"` + View HomeTabViewRequest `json:"view"` + Hash string `json:"hash"` +} + +type pushViewRequest struct { + TriggerID string `json:"trigger_id"` + View ModalViewRequest `json:"view"` +} + +type updateViewRequest struct { + View ModalViewRequest `json:"view"` + ExternalID string `json:"external_id"` + Hash string `json:"hash"` + ViewID string `json:"view_id"` +} + +type ViewResponse struct { + SlackResponse + View `json:"view"` +} + +// OpenView opens a view for a user. +func (api *Client) OpenView(triggerID string, view ModalViewRequest) (*ViewResponse, error) { + return api.OpenViewContext(context.Background(), triggerID, view) +} + +// OpenViewContext opens a view for a user with a custom context. +func (api *Client) OpenViewContext( + ctx context.Context, + triggerID string, + view ModalViewRequest, +) (*ViewResponse, error) { + if triggerID == "" { + return nil, ErrParametersMissing + } + req := openViewRequest{ + TriggerID: triggerID, + View: view, + } + encoded, err := json.Marshal(req) + if err != nil { + return nil, err + } + endpoint := api.endpoint + "views.open" + resp := &ViewResponse{} + err = postJSON(ctx, api.httpclient, endpoint, api.token, encoded, resp, api) + if err != nil { + return nil, err + } + return resp, resp.Err() +} + +// PublishView publishes a static view for a user. +func (api *Client) PublishView(userID string, view HomeTabViewRequest, hash string) (*ViewResponse, error) { + return api.PublishViewContext(context.Background(), userID, view, hash) +} + +// PublishViewContext publishes a static view for a user with a custom context. +func (api *Client) PublishViewContext( + ctx context.Context, + userID string, + view HomeTabViewRequest, + hash string, +) (*ViewResponse, error) { + if userID == "" { + return nil, ErrParametersMissing + } + req := publishViewRequest{ + UserID: userID, + View: view, + Hash: hash, + } + encoded, err := json.Marshal(req) + if err != nil { + return nil, err + } + endpoint := api.endpoint + "views.publish" + resp := &ViewResponse{} + err = postJSON(ctx, api.httpclient, endpoint, api.token, encoded, resp, api) + if err != nil { + return nil, err + } + return resp, resp.Err() +} + +// PushView pushes a view onto the stack of a root view. +func (api *Client) PushView(triggerID string, view ModalViewRequest) (*ViewResponse, error) { + return api.PushViewContext(context.Background(), triggerID, view) +} + +// PublishViewContext pushes a view onto the stack of a root view with a custom context. +func (api *Client) PushViewContext( + ctx context.Context, + triggerID string, + view ModalViewRequest, +) (*ViewResponse, error) { + if triggerID == "" { + return nil, ErrParametersMissing + } + req := pushViewRequest{ + TriggerID: triggerID, + View: view, + } + encoded, err := json.Marshal(req) + if err != nil { + return nil, err + } + endpoint := api.endpoint + "views.push" + resp := &ViewResponse{} + err = postJSON(ctx, api.httpclient, endpoint, api.token, encoded, resp, api) + if err != nil { + return nil, err + } + return resp, resp.Err() +} + +// UpdateView updates an existing view. +func (api *Client) UpdateView(view ModalViewRequest, externalID, hash, viewID string) (*ViewResponse, error) { + return api.UpdateViewContext(context.Background(), view, externalID, hash, viewID) +} + +// UpdateViewContext updates an existing view with a custom context. +func (api *Client) UpdateViewContext( + ctx context.Context, + view ModalViewRequest, + externalID, hash, + viewID string, +) (*ViewResponse, error) { + if externalID == "" && viewID == "" { + return nil, ErrParametersMissing + } + req := updateViewRequest{ + View: view, + ExternalID: externalID, + Hash: hash, + ViewID: viewID, + } + encoded, err := json.Marshal(req) + if err != nil { + return nil, err + } + endpoint := api.endpoint + "views.update" + resp := &ViewResponse{} + err = postJSON(ctx, api.httpclient, endpoint, api.token, encoded, resp, api) + if err != nil { + return nil, err + } + return resp, resp.Err() +} diff --git a/vendor/github.com/nlopes/slack/webhooks.go b/vendor/github.com/slack-go/slack/webhooks.go index 14e1b8dd..1016cb4f 100644 --- a/vendor/github.com/nlopes/slack/webhooks.go +++ b/vendor/github.com/slack-go/slack/webhooks.go @@ -1,11 +1,8 @@ package slack import ( - "bytes" - "encoding/json" + "context" "net/http" - - "github.com/pkg/errors" ) type WebhookMessage struct { @@ -20,21 +17,13 @@ type WebhookMessage struct { } func PostWebhook(url string, msg *WebhookMessage) error { - return PostWebhookCustomHTTP(url, http.DefaultClient, msg) + return PostWebhookCustomHTTPContext(context.Background(), url, http.DefaultClient, msg) } -func PostWebhookCustomHTTP(url string, httpClient *http.Client, msg *WebhookMessage) error { - raw, err := json.Marshal(msg) - - if err != nil { - return errors.Wrap(err, "marshal failed") - } - - response, err := httpClient.Post(url, "application/json", bytes.NewReader(raw)) - - if err != nil { - return errors.Wrap(err, "failed to post webhook") - } +func PostWebhookContext(ctx context.Context, url string, msg *WebhookMessage) error { + return PostWebhookCustomHTTPContext(ctx, url, http.DefaultClient, msg) +} - return checkStatusCode(response, discard{}) +func PostWebhookCustomHTTP(url string, httpClient *http.Client, msg *WebhookMessage) error { + return PostWebhookCustomHTTPContext(context.Background(), url, httpClient, msg) } diff --git a/vendor/github.com/slack-go/slack/webhooks_go112.go b/vendor/github.com/slack-go/slack/webhooks_go112.go new file mode 100644 index 00000000..4e0db0e4 --- /dev/null +++ b/vendor/github.com/slack-go/slack/webhooks_go112.go @@ -0,0 +1,34 @@ +// +build !go1.13 + +package slack + +import ( + "bytes" + "context" + "encoding/json" + "net/http" + + "github.com/pkg/errors" +) + +func PostWebhookCustomHTTPContext(ctx context.Context, url string, httpClient *http.Client, msg *WebhookMessage) error { + raw, err := json.Marshal(msg) + if err != nil { + return errors.Wrap(err, "marshal failed") + } + + req, err := http.NewRequest(http.MethodPost, url, bytes.NewReader(raw)) + if err != nil { + return errors.Wrap(err, "failed new request") + } + req = req.WithContext(ctx) + req.Header.Set("Content-Type", "application/json") + + resp, err := httpClient.Do(req) + if err != nil { + return errors.Wrap(err, "failed to post webhook") + } + defer resp.Body.Close() + + return checkStatusCode(resp, discard{}) +} diff --git a/vendor/github.com/slack-go/slack/webhooks_go113.go b/vendor/github.com/slack-go/slack/webhooks_go113.go new file mode 100644 index 00000000..99c243f5 --- /dev/null +++ b/vendor/github.com/slack-go/slack/webhooks_go113.go @@ -0,0 +1,33 @@ +// +build go1.13 + +package slack + +import ( + "bytes" + "context" + "encoding/json" + "net/http" + + "github.com/pkg/errors" +) + +func PostWebhookCustomHTTPContext(ctx context.Context, url string, httpClient *http.Client, msg *WebhookMessage) error { + raw, err := json.Marshal(msg) + if err != nil { + return errors.Wrap(err, "marshal failed") + } + + req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewReader(raw)) + if err != nil { + return errors.Wrap(err, "failed new request") + } + req.Header.Set("Content-Type", "application/json") + + resp, err := httpClient.Do(req) + if err != nil { + return errors.Wrap(err, "failed to post webhook") + } + defer resp.Body.Close() + + return checkStatusCode(resp, discard{}) +} diff --git a/vendor/github.com/nlopes/slack/websocket.go b/vendor/github.com/slack-go/slack/websocket.go index d6895f2a..d6895f2a 100644 --- a/vendor/github.com/nlopes/slack/websocket.go +++ b/vendor/github.com/slack-go/slack/websocket.go diff --git a/vendor/github.com/nlopes/slack/websocket_channels.go b/vendor/github.com/slack-go/slack/websocket_channels.go index 7dd3319b..7dd3319b 100644 --- a/vendor/github.com/nlopes/slack/websocket_channels.go +++ b/vendor/github.com/slack-go/slack/websocket_channels.go diff --git a/vendor/github.com/nlopes/slack/websocket_desktop_notification.go b/vendor/github.com/slack-go/slack/websocket_desktop_notification.go index 7c61abf7..7c61abf7 100644 --- a/vendor/github.com/nlopes/slack/websocket_desktop_notification.go +++ b/vendor/github.com/slack-go/slack/websocket_desktop_notification.go diff --git a/vendor/github.com/nlopes/slack/websocket_dm.go b/vendor/github.com/slack-go/slack/websocket_dm.go index 98bf6f88..98bf6f88 100644 --- a/vendor/github.com/nlopes/slack/websocket_dm.go +++ b/vendor/github.com/slack-go/slack/websocket_dm.go diff --git a/vendor/github.com/nlopes/slack/websocket_dnd.go b/vendor/github.com/slack-go/slack/websocket_dnd.go index 62ddea3a..62ddea3a 100644 --- a/vendor/github.com/nlopes/slack/websocket_dnd.go +++ b/vendor/github.com/slack-go/slack/websocket_dnd.go diff --git a/vendor/github.com/nlopes/slack/websocket_files.go b/vendor/github.com/slack-go/slack/websocket_files.go index 8c5bd4f8..8c5bd4f8 100644 --- a/vendor/github.com/nlopes/slack/websocket_files.go +++ b/vendor/github.com/slack-go/slack/websocket_files.go diff --git a/vendor/github.com/nlopes/slack/websocket_groups.go b/vendor/github.com/slack-go/slack/websocket_groups.go index eb88985c..eb88985c 100644 --- a/vendor/github.com/nlopes/slack/websocket_groups.go +++ b/vendor/github.com/slack-go/slack/websocket_groups.go diff --git a/vendor/github.com/nlopes/slack/websocket_internals.go b/vendor/github.com/slack-go/slack/websocket_internals.go index 3e1906ee..3e1906ee 100644 --- a/vendor/github.com/nlopes/slack/websocket_internals.go +++ b/vendor/github.com/slack-go/slack/websocket_internals.go diff --git a/vendor/github.com/nlopes/slack/websocket_managed_conn.go b/vendor/github.com/slack-go/slack/websocket_managed_conn.go index dbbf682d..6395938c 100644 --- a/vendor/github.com/nlopes/slack/websocket_managed_conn.go +++ b/vendor/github.com/slack-go/slack/websocket_managed_conn.go @@ -10,8 +10,8 @@ import ( "time" "github.com/gorilla/websocket" - "github.com/nlopes/slack/internal/errorsx" - "github.com/nlopes/slack/internal/timex" + "github.com/slack-go/slack/internal/errorsx" + "github.com/slack-go/slack/internal/timex" ) // ManageConnection can be called on a Slack RTM instance returned by the diff --git a/vendor/github.com/nlopes/slack/websocket_misc.go b/vendor/github.com/slack-go/slack/websocket_misc.go index 65a8bb65..65a8bb65 100644 --- a/vendor/github.com/nlopes/slack/websocket_misc.go +++ b/vendor/github.com/slack-go/slack/websocket_misc.go diff --git a/vendor/github.com/nlopes/slack/websocket_pins.go b/vendor/github.com/slack-go/slack/websocket_pins.go index 95445e28..95445e28 100644 --- a/vendor/github.com/nlopes/slack/websocket_pins.go +++ b/vendor/github.com/slack-go/slack/websocket_pins.go diff --git a/vendor/github.com/nlopes/slack/websocket_reactions.go b/vendor/github.com/slack-go/slack/websocket_reactions.go index e4973878..e4973878 100644 --- a/vendor/github.com/nlopes/slack/websocket_reactions.go +++ b/vendor/github.com/slack-go/slack/websocket_reactions.go diff --git a/vendor/github.com/nlopes/slack/websocket_stars.go b/vendor/github.com/slack-go/slack/websocket_stars.go index e0f2dda3..e0f2dda3 100644 --- a/vendor/github.com/nlopes/slack/websocket_stars.go +++ b/vendor/github.com/slack-go/slack/websocket_stars.go diff --git a/vendor/github.com/nlopes/slack/websocket_subteam.go b/vendor/github.com/slack-go/slack/websocket_subteam.go index a23b274c..a23b274c 100644 --- a/vendor/github.com/nlopes/slack/websocket_subteam.go +++ b/vendor/github.com/slack-go/slack/websocket_subteam.go diff --git a/vendor/github.com/nlopes/slack/websocket_teams.go b/vendor/github.com/slack-go/slack/websocket_teams.go index 3898c833..3898c833 100644 --- a/vendor/github.com/nlopes/slack/websocket_teams.go +++ b/vendor/github.com/slack-go/slack/websocket_teams.go diff --git a/vendor/modules.txt b/vendor/modules.txt index 1d3a2f21..ad37c05c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -135,11 +135,6 @@ github.com/nicksnyder/go-i18n/i18n github.com/nicksnyder/go-i18n/i18n/bundle github.com/nicksnyder/go-i18n/i18n/language github.com/nicksnyder/go-i18n/i18n/translation -# github.com/nlopes/slack v0.6.0 => github.com/matterbridge/slack v0.1.1-0.20191208194820-95190f11bfb6 -github.com/nlopes/slack -github.com/nlopes/slack/internal/errorsx -github.com/nlopes/slack/internal/timex -github.com/nlopes/slack/slackutilsx # github.com/paulrosania/go-charset v0.0.0-20190326053356-55c9d7a5834c github.com/paulrosania/go-charset/charset github.com/paulrosania/go-charset/data @@ -169,6 +164,11 @@ github.com/sirupsen/logrus github.com/skip2/go-qrcode github.com/skip2/go-qrcode/bitset github.com/skip2/go-qrcode/reedsolomon +# github.com/slack-go/slack v0.6.3-0.20200228121756-f56d616d5901 +github.com/slack-go/slack +github.com/slack-go/slack/internal/errorsx +github.com/slack-go/slack/internal/timex +github.com/slack-go/slack/slackutilsx # github.com/spf13/afero v1.1.2 github.com/spf13/afero github.com/spf13/afero/mem |