diff options
author | Saturnino Abril <saturnino.abril@gmail.com> | 2017-02-21 21:07:57 +0900 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2017-02-21 12:07:57 +0000 |
commit | 5c19d9be7f20d4528331a0f9f6673d20bf16d57a (patch) | |
tree | 172c6483af5c7984724d1381cb4fc7616542bbd6 /model | |
parent | 7068307a1c12d7e045f68e73448ab728fc2b10c7 (diff) | |
download | chat-5c19d9be7f20d4528331a0f9f6673d20bf16d57a.tar.gz chat-5c19d9be7f20d4528331a0f9f6673d20bf16d57a.tar.bz2 chat-5c19d9be7f20d4528331a0f9f6673d20bf16d57a.zip |
Implement endpoint for APIv4: GET /users/{user_id}/audits (#5472)
Diffstat (limited to 'model')
-rw-r--r-- | model/client4.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go index f4447b769..8f9bb82f5 100644 --- a/model/client4.go +++ b/model/client4.go @@ -459,6 +459,17 @@ func (c *Client4) RevokeSession(userId, sessionId string) (bool, *Response) { } } +// 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) { + 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} + } else { + defer closeBody(r) + return AuditsFromJson(r.Body), BuildResponse(r) + } +} + // Team Section // CreateTeam creates a team in the system based on the provided team struct. |