Implement POST /channels/direct endpoint for APIv4 (#5283)

Этот коммит содержится в:
Joram Wilander
2017-02-03 10:27:12 -05:00
коммит произвёл Christopher Speller
родитель ccb0343828
Коммит 9312469ad5
5 изменённых файлов: 113 добавлений и 4 удалений

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

@@ -265,5 +265,17 @@ func (c *Client4) CreateChannel(channel *Channel) (*Channel, *Response) {
}
}
// CreateDirectChannel creates a direct message channel based on the two user
// ids provided.
func (c *Client4) CreateDirectChannel(userId1, userId2 string) (*Channel, *Response) {
requestBody := []string{userId1, userId2}
if r, err := c.DoApiPost(c.GetChannelsRoute()+"/direct", ArrayToJson(requestBody)); err != nil {
return nil, &Response{StatusCode: r.StatusCode, Error: err}
} else {
defer closeBody(r)
return ChannelFromJson(r.Body), BuildResponse(r)
}
}
// Post Section
// to be filled in..