From 3224d2f6a3bd95293fff25d6cc417b30b4f6e334 Mon Sep 17 00:00:00 2001 From: Saturnino Abril Date: Mon, 23 Apr 2018 20:18:58 +0800 Subject: add api to convert a channel from public to private and restrict that to system_admin (#8655) --- model/client4.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'model/client4.go') diff --git a/model/client4.go b/model/client4.go index 870e440e8..260d75df6 100644 --- a/model/client4.go +++ b/model/client4.go @@ -1491,6 +1491,16 @@ func (c *Client4) PatchChannel(channelId string, patch *ChannelPatch) (*Channel, } } +// ConvertChannelToPrivate converts public to private channel. +func (c *Client4) ConvertChannelToPrivate(channelId string) (*Channel, *Response) { + if r, err := c.DoApiPost(c.GetChannelRoute(channelId)+"/convert", ""); err != nil { + return nil, BuildErrorResponse(r, err) + } else { + defer closeBody(r) + return ChannelFromJson(r.Body), BuildResponse(r) + } +} + // RestoreChannel restores a previously deleted channel. Any missing fields are not updated. func (c *Client4) RestoreChannel(channelId string) (*Channel, *Response) { if r, err := c.DoApiPost(c.GetChannelRoute(channelId)+"/restore", ""); err != nil { -- cgit v1.2.3-1-g7c22