* APIv4 post /channels/ids

* updated enpoint as /teams/{team_id}/channels/ids
Этот коммит содержится в:
Saturnino Abril
2017-03-27 20:41:40 +09:00
коммит произвёл enahum
родитель 720ee81113
Коммит 01aaccb340
8 изменённых файлов: 259 добавлений и 5 удалений

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

@@ -98,7 +98,7 @@ func (c *Client4) GetChannelsRoute() string {
return fmt.Sprintf("/channels")
}
func (c *Client4) GetPublicChannelsForTeamRoute(teamId string) string {
func (c *Client4) GetChannelsForTeamRoute(teamId string) string {
return fmt.Sprintf(c.GetTeamRoute(teamId) + "/channels")
}
@@ -962,7 +962,17 @@ func (c *Client4) GetChannelStats(channelId string, etag string) (*ChannelStats,
// GetPublicChannelsForTeam returns a list of public channels based on the provided team id string.
func (c *Client4) GetPublicChannelsForTeam(teamId string, page int, perPage int, etag string) (*ChannelList, *Response) {
query := fmt.Sprintf("?page=%v&per_page=%v", page, perPage)
if r, err := c.DoApiGet(c.GetPublicChannelsForTeamRoute(teamId)+query, etag); err != nil {
if r, err := c.DoApiGet(c.GetChannelsForTeamRoute(teamId)+query, etag); err != nil {
return nil, &Response{StatusCode: r.StatusCode, Error: err}
} else {
defer closeBody(r)
return ChannelListFromJson(r.Body), BuildResponse(r)
}
}
// GetPublicChannelsByIdsForTeam returns a list of public channels based on provided team id string
func (c *Client4) GetPublicChannelsByIdsForTeam(teamId string, channelIds []string) (*ChannelList, *Response) {
if r, err := c.DoApiPost(c.GetChannelsForTeamRoute(teamId)+"/ids", ArrayToJson(channelIds)); err != nil {
return nil, &Response{StatusCode: r.StatusCode, Error: err}
} else {
defer closeBody(r)
@@ -982,7 +992,7 @@ func (c *Client4) GetChannelsForTeamForUser(teamId, userId, etag string) (*Chann
// SearchChannels returns the channels on a team matching the provided search term.
func (c *Client4) SearchChannels(teamId string, search *ChannelSearch) (*ChannelList, *Response) {
if r, err := c.DoApiPost(c.GetTeamRoute(teamId)+"/channels/search", search.ToJson()); err != nil {
if r, err := c.DoApiPost(c.GetChannelsForTeamRoute(teamId)+"/search", search.ToJson()); err != nil {
return nil, &Response{StatusCode: r.StatusCode, Error: err}
} else {
defer closeBody(r)