summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2016-12-12 06:30:37 +0100
committerCorey Hulen <corey@hulen.com>2016-12-11 21:30:37 -0800
commitf0d71d87899967335210b9130a7e2b8d180bef46 (patch)
treed2941b8870e87677a84821dd32454a28594c889b /model
parentb5fcfd608c0e9ef764cace7328653e4d4c47a061 (diff)
downloadchat-f0d71d87899967335210b9130a7e2b8d180bef46.tar.gz
chat-f0d71d87899967335210b9130a7e2b8d180bef46.tar.bz2
chat-f0d71d87899967335210b9130a7e2b8d180bef46.zip
Add API call to get a channel by its name (#4700)
* add api for getByChannelName * add tests * fix test * rename and tests * check for permissions and test
Diffstat (limited to 'model')
-rw-r--r--model/client.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/model/client.go b/model/client.go
index 951b3388a..b8bd9fc44 100644
--- a/model/client.go
+++ b/model/client.go
@@ -1252,6 +1252,16 @@ func (c *Client) GetChannels(etag string) (*Result, *AppError) {
}
}
+func (c *Client) GetChannelByName(channelName string) (*Result, *AppError) {
+ if r, err := c.DoApiGet(c.GetChannelNameRoute(channelName), "", ""); err != nil {
+ return nil, err
+ } else {
+ defer closeBody(r)
+ return &Result{r.Header.Get(HEADER_REQUEST_ID),
+ r.Header.Get(HEADER_ETAG_SERVER), ChannelMemberFromJson(r.Body)}, nil
+ }
+}
+
func (c *Client) JoinChannel(id string) (*Result, *AppError) {
if r, err := c.DoApiPost(c.GetChannelRoute(id)+"/join", ""); err != nil {
return nil, err