summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-03-13 13:27:27 +0100
committerGeorge Goldberg <george@gberg.me>2017-03-13 12:27:27 +0000
commitc372ceebf87295408072a40c63df7c4be9bc2abc (patch)
tree6afb2d015e1e9a255c764e032a377f173b0be1fe /model
parente8a81db968caf81506dafb36abd56e49d9acdc98 (diff)
downloadchat-c372ceebf87295408072a40c63df7c4be9bc2abc.tar.gz
chat-c372ceebf87295408072a40c63df7c4be9bc2abc.tar.bz2
chat-c372ceebf87295408072a40c63df7c4be9bc2abc.zip
[APIV4] GET /config - getConfig endpoint for apiV4 (#5701)
Diffstat (limited to 'model')
-rw-r--r--model/client4.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go
index 43787cf08..6441abcc2 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -126,6 +126,10 @@ func (c *Client4) GetPostsRoute() string {
return fmt.Sprintf("/posts")
}
+func (c *Client4) GetConfigRoute() string {
+ return fmt.Sprintf("/config")
+}
+
func (c *Client4) GetPostRoute(postId string) string {
return fmt.Sprintf(c.GetPostsRoute()+"/%v", postId)
}
@@ -957,6 +961,16 @@ func (c *Client4) GetPing() (bool, *Response) {
}
}
+// GetConfig will retrieve the server config with some sanitized items.
+func (c *Client4) GetConfig() (*Config, *Response) {
+ if r, err := c.DoApiGet(c.GetConfigRoute(), ""); 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.