diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-04-10 08:19:49 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-04-10 08:19:49 -0400 |
commit | dfc6db737411bd4ad68a803be5182f06055a1769 (patch) | |
tree | 375d93b8d1d8b1384988dc708c9f337e0ea2366c /model/client4.go | |
parent | 7b77bcf87e85330a1f7f0b2a2dcbf71326bf2fba (diff) | |
download | chat-dfc6db737411bd4ad68a803be5182f06055a1769.tar.gz chat-dfc6db737411bd4ad68a803be5182f06055a1769.tar.bz2 chat-dfc6db737411bd4ad68a803be5182f06055a1769.zip |
Refactor switching login type code into app layer and add v4 endpoint (#6000)
* Refactor switching login type code into app layer and add v4 endpoint
* Fix unit test
Diffstat (limited to 'model/client4.go')
-rw-r--r-- | model/client4.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/model/client4.go b/model/client4.go index 634c477e2..6d4772431 100644 --- a/model/client4.go +++ b/model/client4.go @@ -409,6 +409,16 @@ func (c *Client4) Logout() (bool, *Response) { } } +// SwitchAccountType changes a user's login type from one type to another. +func (c *Client4) SwitchAccountType(switchRequest *SwitchRequest) (string, *Response) { + if r, err := c.DoApiPost(c.GetUsersRoute()+"/login/switch", switchRequest.ToJson()); err != nil { + return "", &Response{StatusCode: r.StatusCode, Error: err} + } else { + defer closeBody(r) + return MapFromJson(r.Body)["follow_link"], BuildResponse(r) + } +} + // User Section // CreateUser creates a user in the system based on the provided user struct. |