summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-03-13 14:24:30 +0100
committerChristopher Speller <crspeller@gmail.com>2017-03-13 09:24:30 -0400
commitb299bc89999818da07fdec323a74ff29819aaf65 (patch)
tree6f8d295c1dfe3464d65e5ee028d92d9c413c3a40 /model
parente9c6cc269b5c9fe82e5f38d63344a07365bccd6b (diff)
downloadchat-b299bc89999818da07fdec323a74ff29819aaf65.tar.gz
chat-b299bc89999818da07fdec323a74ff29819aaf65.tar.bz2
chat-b299bc89999818da07fdec323a74ff29819aaf65.zip
add update channel endpoint for APIv4 (#5624)
Diffstat (limited to 'model')
-rw-r--r--model/client4.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go
index 70466ec59..f2dc7625b 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -741,6 +741,16 @@ func (c *Client4) CreateChannel(channel *Channel) (*Channel, *Response) {
}
}
+// UpdateChannel update a channel based on the provided channel struct.
+func (c *Client4) UpdateChannel(channel *Channel) (*Channel, *Response) {
+ if r, err := c.DoApiPut(c.GetChannelRoute(channel.Id), channel.ToJson()); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return ChannelFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// CreateDirectChannel creates a direct message channel based on the two user
// ids provided.
func (c *Client4) CreateDirectChannel(userId1, userId2 string) (*Channel, *Response) {