Implement update IncomingHook for apiV4 (#5762)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
33d472c090
Коммит
241f9e8888
@@ -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)
|
||||
|
||||
Ссылка в новой задаче
Block a user