Add updateConfig endpoint for apiV4 (#5706)

Этот коммит содержится в:
Carlos Tadeu Panato Junior
2017-03-20 13:37:34 +01:00
коммит произвёл George Goldberg
родитель 9b10f3ef54
Коммит ac8282cda1
5 изменённых файлов: 82 добавлений и 2 удалений

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

@@ -1191,6 +1191,7 @@ func (c *Client4) DatabaseRecycle() (bool, *Response) {
}
}
// InvalidateCaches will purge the cache and can affect the performance while is cleaning.
func (c *Client4) InvalidateCaches() (bool, *Response) {
if r, err := c.DoApiPost(c.GetCacheRoute()+"/invalidate", ""); err != nil {
return false, &Response{StatusCode: r.StatusCode, Error: err}
@@ -1200,6 +1201,16 @@ func (c *Client4) InvalidateCaches() (bool, *Response) {
}
}
// UpdateConfig will update the server configuration
func (c *Client4) UpdateConfig(config *Config) (*Config, *Response) {
if r, err := c.DoApiPut(c.GetConfigRoute(), config.ToJson()); err != nil {
return nil, &Response{StatusCode: r.StatusCode, Error: err}
} else {
defer closeBody(r)
return ConfigFromJson(r.Body), BuildResponse(r)
}
}
// Webhooks Section
// CreateIncomingWebhook creates an incoming webhook for a channel.