From 44714dfcb18b9a393dc34be3c182b0c092eec28a Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Thu, 17 Sep 2015 21:00:59 -0700 Subject: PLT-11 Adding ability to save config file --- model/client.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'model/client.go') diff --git a/model/client.go b/model/client.go index 9a89e8208..d720f30f8 100644 --- a/model/client.go +++ b/model/client.go @@ -385,6 +385,24 @@ func (c *Client) GetClientProperties() (*Result, *AppError) { } } +func (c *Client) GetConfig() (*Result, *AppError) { + if r, err := c.DoApiGet("/admin/config", "", ""); err != nil { + return nil, err + } else { + return &Result{r.Header.Get(HEADER_REQUEST_ID), + r.Header.Get(HEADER_ETAG_SERVER), ConfigFromJson(r.Body)}, nil + } +} + +func (c *Client) SaveConfig(config *Config) (*Result, *AppError) { + if r, err := c.DoApiPost("/admin/save_config", config.ToJson()); err != nil { + return nil, err + } else { + return &Result{r.Header.Get(HEADER_REQUEST_ID), + r.Header.Get(HEADER_ETAG_SERVER), ConfigFromJson(r.Body)}, nil + } +} + func (c *Client) CreateChannel(channel *Channel) (*Result, *AppError) { if r, err := c.DoApiPost("/channels/create", channel.ToJson()); err != nil { return nil, err -- cgit v1.2.3-1-g7c22