diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-03-27 09:19:53 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-03-27 09:19:53 -0400 |
commit | a0d5c01dfd97b45478353ccff777de677f088d0f (patch) | |
tree | d4206ef53c44e5ec65fb5b5a01e68d3102e1adf6 /model | |
parent | d145c3583835766c1f200a413131e7d6bad82229 (diff) | |
download | chat-a0d5c01dfd97b45478353ccff777de677f088d0f.tar.gz chat-a0d5c01dfd97b45478353ccff777de677f088d0f.tar.bz2 chat-a0d5c01dfd97b45478353ccff777de677f088d0f.zip |
Implement client config/license endpoints for APIv4 (#5867)
Diffstat (limited to 'model')
-rw-r--r-- | model/client4.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go index e1bd70878..6306039ff 100644 --- a/model/client4.go +++ b/model/client4.go @@ -130,6 +130,10 @@ func (c *Client4) GetConfigRoute() string { return fmt.Sprintf("/config") } +func (c *Client4) GetLicenseRoute() string { + return fmt.Sprintf("/license") +} + func (c *Client4) GetPostRoute(postId string) string { return fmt.Sprintf(c.GetPostsRoute()+"/%v", postId) } @@ -1344,6 +1348,7 @@ func (c *Client4) GetPing() (bool, *Response) { } } +// TestEmail will attempt to connect to the configured SMTP server. func (c *Client4) TestEmail() (bool, *Response) { if r, err := c.DoApiPost(c.GetTestEmailRoute(), ""); err != nil { return false, &Response{StatusCode: r.StatusCode, Error: err} @@ -1373,6 +1378,28 @@ func (c *Client4) ReloadConfig() (bool, *Response) { } } +// GetOldClientConfig will retrieve the parts of the server configuration needed by the +// client, formatted in the old format. +func (c *Client4) GetOldClientConfig(etag string) (map[string]string, *Response) { + if r, err := c.DoApiGet(c.GetConfigRoute()+"/client?format=old", etag); err != nil { + return nil, &Response{StatusCode: r.StatusCode, Error: err} + } else { + defer closeBody(r) + return MapFromJson(r.Body), BuildResponse(r) + } +} + +// GetOldClientLicense will retrieve the parts of the server license needed by the +// client, formatted in the old format. +func (c *Client4) GetOldClientLicense(etag string) (map[string]string, *Response) { + if r, err := c.DoApiGet(c.GetLicenseRoute()+"/client?format=old", etag); err != nil { + return nil, &Response{StatusCode: r.StatusCode, Error: err} + } else { + defer closeBody(r) + return MapFromJson(r.Body), BuildResponse(r) + } +} + // 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 { |