diff options
author | Carlos Tadeu Panato Junior <ctadeu@gmail.com> | 2017-03-20 13:37:34 +0100 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2017-03-20 12:37:34 +0000 |
commit | ac8282cda1455802f52ebe6687eeeef6c950bf49 (patch) | |
tree | a0eb38c5de6c6605399f91bf35b0fc5434bd4911 /model/client4.go | |
parent | 9b10f3ef5450886bc2eb47fc58b649ff67109b1d (diff) | |
download | chat-ac8282cda1455802f52ebe6687eeeef6c950bf49.tar.gz chat-ac8282cda1455802f52ebe6687eeeef6c950bf49.tar.bz2 chat-ac8282cda1455802f52ebe6687eeeef6c950bf49.zip |
Add updateConfig endpoint for apiV4 (#5706)
Diffstat (limited to 'model/client4.go')
-rw-r--r-- | model/client4.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go index a2878df6f..307d52c55 100644 --- a/model/client4.go +++ b/model/client4.go @@ -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. |