diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-03-27 09:17:34 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-03-27 09:17:34 -0400 |
commit | d145c3583835766c1f200a413131e7d6bad82229 (patch) | |
tree | 1671fd532293482f035f40accd068e19da1d86df /model/client4.go | |
parent | 84dc60a640bbfb3b670a65f1c9ea6ce35ad1b5cc (diff) | |
download | chat-d145c3583835766c1f200a413131e7d6bad82229.tar.gz chat-d145c3583835766c1f200a413131e7d6bad82229.tar.bz2 chat-d145c3583835766c1f200a413131e7d6bad82229.zip |
Implement PUT /users/sessions/device endpoint for APIv4 (#5866)
Diffstat (limited to 'model/client4.go')
-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 031973a34..e1bd70878 100644 --- a/model/client4.go +++ b/model/client4.go @@ -617,6 +617,17 @@ func (c *Client4) RevokeSession(userId, sessionId string) (bool, *Response) { } } +// AttachDeviceId attaches a mobile device ID to the current session. +func (c *Client4) AttachDeviceId(deviceId string) (bool, *Response) { + requestBody := map[string]string{"device_id": deviceId} + if r, err := c.DoApiPut(c.GetUsersRoute()+"/sessions/device", MapToJson(requestBody)); err != nil { + return false, &Response{StatusCode: r.StatusCode, Error: err} + } else { + defer closeBody(r) + return CheckStatusOK(r), BuildResponse(r) + } +} + // GetTeamsUnreadForUser will return an array with TeamUnread objects that contain the amount // of unread messages and mentions the current user has for the teams it belongs to. // An optional team ID can be set to exclude that team from the results. Must be authenticated. |