Endpoint for APIv4 POST /channels/{channel_id}/members (#5775)

Этот коммит содержится в:
Saturnino Abril
2017-03-20 21:44:08 +09:00
коммит произвёл George Goldberg
родитель ac8282cda1
Коммит 7e89077a93
5 изменённых файлов: 172 добавлений и 2 удалений

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

@@ -968,6 +968,17 @@ func (c *Client4) UpdateChannelRoles(channelId, userId, roles string) (bool, *Re
}
}
// AddChannelMember adds user to channel and return a channel member.
func (c *Client4) AddChannelMember(channelId, userId string) (*ChannelMember, *Response) {
requestBody := map[string]string{"user_id": userId}
if r, err := c.DoApiPost(c.GetChannelMembersRoute(channelId)+"", MapToJson(requestBody)); err != nil {
return nil, &Response{StatusCode: r.StatusCode, Error: err}
} else {
defer closeBody(r)
return ChannelMemberFromJson(r.Body), BuildResponse(r)
}
}
// RemoveUserFromChannel will delete the channel member object for a user, effectively removing the user from a channel.
func (c *Client4) RemoveUserFromChannel(channelId, userId string) (bool, *Response) {
if r, err := c.DoApiDelete(c.GetChannelMemberRoute(channelId, userId)); err != nil {