diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-06-19 16:35:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-19 16:35:53 -0400 |
commit | 5627f3fd1d315e1574a444daba36aee592f1c7b5 (patch) | |
tree | ecb255b95ed8cb9fd73e7984b8fc08c987da11ef /model | |
parent | ef9326bcbb461b4f3265f75a9f738e67e58b88d1 (diff) | |
download | chat-5627f3fd1d315e1574a444daba36aee592f1c7b5.tar.gz chat-5627f3fd1d315e1574a444daba36aee592f1c7b5.tar.bz2 chat-5627f3fd1d315e1574a444daba36aee592f1c7b5.zip |
Add GET /analytics/old endpoint for v4 (#6666)
Diffstat (limited to 'model')
-rw-r--r-- | model/client4.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go index cfecd7b25..efe12a3b9 100644 --- a/model/client4.go +++ b/model/client4.go @@ -258,6 +258,10 @@ func (c *Client4) GetJobsRoute() string { return fmt.Sprintf("/jobs") } +func (c *Client4) GetAnalyticsRoute() string { + return fmt.Sprintf("/analytics") +} + func (c *Client4) DoApiGet(url string, etag string) (*http.Response, *AppError) { return c.DoApiRequest(http.MethodGet, c.ApiUrl+url, "", etag) } @@ -1889,6 +1893,20 @@ func (c *Client4) RemoveLicenseFile() (bool, *Response) { } } +// GetAnalyticsOld will retrieve analytics using the old format. New format is not +// available but the "/analytics" endpoint is reserved for it. The "name" argument is optional +// and defaults to "standard". The "teamId" argument is optional and will limit results +// to a specific team. +func (c *Client4) GetAnalyticsOld(name, teamId string) (AnalyticsRows, *Response) { + query := fmt.Sprintf("?name=%v&teamId=%v", name, teamId) + if r, err := c.DoApiGet(c.GetAnalyticsRoute()+"/old"+query, ""); err != nil { + return nil, &Response{StatusCode: r.StatusCode, Error: err} + } else { + defer closeBody(r) + return AnalyticsRowsFromJson(r.Body), BuildResponse(r) + } +} + // Webhooks Section // CreateIncomingWebhook creates an incoming webhook for a channel. |