diff options
author | kegsay <kegan@matrix.org> | 2022-02-18 11:28:02 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-18 11:28:02 +0000 |
commit | 0a7dea44505f703af1e7e069602ca95aa5a83700 (patch) | |
tree | 7cec9f92c3782e7e5ba9b29c215694616b6df189 /clientapi | |
parent | 131bedc1a11135eb1f67a26389fe8f53c82c537d (diff) |
Update /whoami response to match Spec v1.2 (#2201)
Basically include `is_guest` and `device_id`. The latter is
needed for https://github.com/matrix-org/complement/pull/305
Diffstat (limited to 'clientapi')
-rw-r--r-- | clientapi/routing/whoami.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clientapi/routing/whoami.go b/clientapi/routing/whoami.go index 26280f6c..a1d9d667 100644 --- a/clientapi/routing/whoami.go +++ b/clientapi/routing/whoami.go @@ -21,7 +21,9 @@ import ( // whoamiResponse represents an response for a `whoami` request type whoamiResponse struct { - UserID string `json:"user_id"` + UserID string `json:"user_id"` + DeviceID string `json:"device_id"` + IsGuest bool `json:"is_guest"` } // Whoami implements `/account/whoami` which enables client to query their account user id. @@ -29,6 +31,10 @@ type whoamiResponse struct { func Whoami(req *http.Request, device *api.Device) util.JSONResponse { return util.JSONResponse{ Code: http.StatusOK, - JSON: whoamiResponse{UserID: device.UserID}, + JSON: whoamiResponse{ + UserID: device.UserID, + DeviceID: device.ID, + IsGuest: device.AccountType == api.AccountTypeGuest, + }, } } |