summaryrefslogtreecommitdiffstats
path: root/model/client4.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-03-21 09:06:08 -0400
committerGitHub <noreply@github.com>2017-03-21 09:06:08 -0400
commitfd6e2f3f73c1fbdda49e4f32d0e40e8d7230518b (patch)
tree708faaa67a39648dcd9deab953d836771f531d8f /model/client4.go
parent4968ef0759087f34c1674a385707f6befef810b7 (diff)
downloadchat-fd6e2f3f73c1fbdda49e4f32d0e40e8d7230518b.tar.gz
chat-fd6e2f3f73c1fbdda49e4f32d0e40e8d7230518b.tar.bz2
chat-fd6e2f3f73c1fbdda49e4f32d0e40e8d7230518b.zip
Implement GET /audits endpoint for APIv4 (#5779)
* Implement GET /audits endpoint for APIv4 * Fix log unit test
Diffstat (limited to 'model/client4.go')
-rw-r--r--model/client4.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/model/client4.go b/model/client4.go
index 7af2a0b39..b94412706 100644
--- a/model/client4.go
+++ b/model/client4.go
@@ -606,8 +606,8 @@ func (c *Client4) GetTeamsUnreadForUser(userId, teamIdToExclude string) ([]*Team
}
}
-// GetAudits returns a list of audit based on the provided user id string.
-func (c *Client4) GetAudits(userId string, page int, perPage int, etag string) (Audits, *Response) {
+// GetUserAudits returns a list of audit based on the provided user id string.
+func (c *Client4) GetUserAudits(userId string, page int, perPage int, etag string) (Audits, *Response) {
query := fmt.Sprintf("?page=%v&per_page=%v", page, perPage)
if r, err := c.DoApiGet(c.GetUserRoute(userId)+"/audits"+query, etag); err != nil {
return nil, &Response{StatusCode: r.StatusCode, Error: err}
@@ -1605,6 +1605,19 @@ func (c *Client4) TestLdap() (bool, *Response) {
}
}
+// Audits Section
+
+// GetAudits returns a list of audits for the whole system.
+func (c *Client4) GetAudits(page int, perPage int, etag string) (Audits, *Response) {
+ query := fmt.Sprintf("?page=%v&per_page=%v", page, perPage)
+ if r, err := c.DoApiGet("/audits"+query, etag); err != nil {
+ return nil, &Response{StatusCode: r.StatusCode, Error: err}
+ } else {
+ defer closeBody(r)
+ return AuditsFromJson(r.Body), BuildResponse(r)
+ }
+}
+
// Brand Section
// GetBrandImage retrieves the previously uploaded brand image.