add update channel endpoint for APIv4 (#5624)

Этот коммит содержится в:
Carlos Tadeu Panato Junior
2017-03-13 14:24:30 +01:00
коммит произвёл Christopher Speller
родитель e9c6cc269b
Коммит b299bc8999
4 изменённых файлов: 172 добавлений и 2 удалений

Просмотреть файл

@@ -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) {