Implement POST /channels endpoint for APIv4 (#5241)

Этот коммит содержится в:
Joram Wilander
2017-02-02 09:04:36 -05:00
коммит произвёл GitHub
родитель 2ac4f36587
Коммит 609d4f43d9
10 изменённых файлов: 309 добавлений и 36 удалений

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

@@ -60,6 +60,14 @@ func (c *Client4) GetTeamsRoute() string {
return fmt.Sprintf("/teams")
}
func (c *Client4) GetChannelsRoute() string {
return fmt.Sprintf("/channels")
}
func (c *Client4) GetChannelRoute(channelId string) string {
return fmt.Sprintf(c.GetChannelsRoute()+"/%v", channelId)
}
func (c *Client4) GetTeamRoute(teamId string) string {
return fmt.Sprintf(c.GetTeamsRoute()+"/%v", teamId)
}
@@ -236,7 +244,16 @@ func (c *Client4) CreateTeam(team *Team) (*Team, *Response) {
}
// Channel Section
// to be filled in..
// CreateChannel creates a channel based on the provided channel struct.
func (c *Client4) CreateChannel(channel *Channel) (*Channel, *Response) {
if r, err := c.DoApiPost(c.GetChannelsRoute(), channel.ToJson()); 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..