diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-03-21 09:06:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-21 09:06:08 -0400 |
commit | fd6e2f3f73c1fbdda49e4f32d0e40e8d7230518b (patch) | |
tree | 708faaa67a39648dcd9deab953d836771f531d8f /model | |
parent | 4968ef0759087f34c1674a385707f6befef810b7 (diff) | |
download | chat-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')
-rw-r--r-- | model/client4.go | 17 |
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. |