[APIV4] GET /config - getConfig endpoint for apiV4 (#5701)
Этот коммит содержится в:
коммит произвёл
George Goldberg
родитель
e8a81db968
Коммит
c372ceebf8
@@ -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.
|
||||
|
||||
Ссылка в новой задаче
Block a user