Endpoint for APIv4 POST /channels/{channel_id}/members (#5775)
Этот коммит содержится в:
коммит произвёл
George Goldberg
родитель
ac8282cda1
Коммит
7e89077a93
@@ -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 {
|
||||
|
||||
Ссылка в новой задаче
Block a user