Add GET /analytics/old endpoint for v4 (#6666)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
ef9326bcbb
Коммит
5627f3fd1d
@@ -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.
|
||||
|
||||
Ссылка в новой задаче
Block a user