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
Этот коммит содержится в:
Joram Wilander
2017-04-10 08:19:49 -04:00
коммит произвёл Christopher Speller
родитель 7b77bcf87e
Коммит dfc6db7374
11 изменённых файлов: 494 добавлений и 284 удалений

Просмотреть файл

@@ -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.