diff options
Diffstat (limited to 'model/client4.go')
-rw-r--r-- | model/client4.go | 14 |
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. |