diff options
author | Wim <wim@42.be> | 2020-12-06 23:16:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-06 23:16:02 +0100 |
commit | 0d7315249d20bf9856605068074a7b6c6bcce835 (patch) | |
tree | f8ab7e0f3e96491e439eb49beebf3fae658215c4 /vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/rest/channels.go | |
parent | 4913766d58cd1fe204b27dc93172c5dd4a95a88a (diff) | |
download | matterbridge-msglm-0d7315249d20bf9856605068074a7b6c6bcce835.tar.gz matterbridge-msglm-0d7315249d20bf9856605068074a7b6c6bcce835.tar.bz2 matterbridge-msglm-0d7315249d20bf9856605068074a7b6c6bcce835.zip |
Update vendor (#1330)
Diffstat (limited to 'vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/rest/channels.go')
-rw-r--r-- | vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/rest/channels.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/rest/channels.go b/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/rest/channels.go index 71377500..d5c8fa85 100644 --- a/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/rest/channels.go +++ b/vendor/github.com/matterbridge/Rocket.Chat.Go.SDK/rest/channels.go @@ -56,9 +56,17 @@ func (c *Client) LeaveChannel(channel *models.Channel) error { // https://rocket.chat/docs/developer-guides/rest-api/channels/info func (c *Client) GetChannelInfo(channel *models.Channel) (*models.Channel, error) { response := new(ChannelResponse) - if err := c.Get("channels.info", url.Values{"roomId": []string{channel.ID}}, response); err != nil { - return nil, err + switch { + case channel.Name != "" && channel.ID == "": + if err := c.Get("channels.info", url.Values{"roomName": []string{channel.Name}}, response); err != nil { + return nil, err + } + default: + if err := c.Get("channels.info", url.Values{"roomId": []string{channel.ID}}, response); err != nil { + return nil, err + } } return &response.Channel, nil } + |