From 241f9e88889ea0579bab188f38199c0a2adff48c Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Thu, 16 Mar 2017 00:47:15 +0100 Subject: Implement update IncomingHook for apiV4 (#5762) --- model/client4.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'model') diff --git a/model/client4.go b/model/client4.go index 8f3328e80..2da69b6b4 100644 --- a/model/client4.go +++ b/model/client4.go @@ -1149,6 +1149,7 @@ func (c *Client4) ReloadConfig() (bool, *Response) { } } +// DatabaseRecycle will recycle the connections. Discard current connection and get new one. func (c *Client4) DatabaseRecycle() (bool, *Response) { if r, err := c.DoApiPost(c.GetDatabaseRoute()+"/recycle", ""); err != nil { return false, &Response{StatusCode: r.StatusCode, Error: err} @@ -1179,6 +1180,16 @@ func (c *Client4) CreateIncomingWebhook(hook *IncomingWebhook) (*IncomingWebhook } } +// UpdateIncomingWebhook updates an incoming webhook for a channel. +func (c *Client4) UpdateIncomingWebhook(hook *IncomingWebhook) (*IncomingWebhook, *Response) { + if r, err := c.DoApiPut(c.GetIncomingWebhookRoute(hook.Id), hook.ToJson()); err != nil { + return nil, &Response{StatusCode: r.StatusCode, Error: err} + } else { + defer closeBody(r) + return IncomingWebhookFromJson(r.Body), BuildResponse(r) + } +} + // GetIncomingWebhooks returns a page of incoming webhooks on the system. Page counting starts at 0. func (c *Client4) GetIncomingWebhooks(page int, perPage int, etag string) ([]*IncomingWebhook, *Response) { query := fmt.Sprintf("?page=%v&per_page=%v", page, perPage) -- cgit v1.2.3-1-g7c22