summaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorRobin Naundorf <r.naundorf@fh-muenster.de>2017-02-17 11:57:19 +0100
committerGeorge Goldberg <george@gberg.me>2017-02-17 10:57:19 +0000
commit48b785aded359c98cf0008bd652a4437ea807cbd (patch)
tree1458d3344f25a37bd1c369a0a885a44f628db58f /model
parenteadf37ad7ab0c25764f22923bae60ef70daea75f (diff)
downloadchat-48b785aded359c98cf0008bd652a4437ea807cbd.tar.gz
chat-48b785aded359c98cf0008bd652a4437ea807cbd.tar.bz2
chat-48b785aded359c98cf0008bd652a4437ea807cbd.zip
Add APIv4 /system/ping endpoint (#5443)
Diffstat (limited to 'model')
-rw-r--r--model/client4.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go
index 48a88e968..ec91460fd 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -112,6 +112,10 @@ func (c *Client4) GetPostRoute(postId string) string {
return fmt.Sprintf(c.GetPostsRoute()+"/%v", postId)
}
+func (c *Client4) GetSystemRoute() string {
+ return fmt.Sprintf("/system")
+}
+
func (c *Client4) DoApiGet(url string, etag string) (*http.Response, *AppError) {
return c.DoApiRequest(http.MethodGet, url, "", etag)
}
@@ -570,5 +574,14 @@ func (c *Client4) GetPostsForChannel(channelId string, page, perPage int, etag s
}
}
+func (c *Client4) GetPing() (bool, *Response) {
+ if r, err := c.DoApiGet(c.GetSystemRoute()+"/ping", ""); err != nil {
+ return false, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return CheckStatusOK(r), BuildResponse(r)
+ }
+}
+
// Files Section
// to be filled in..