From e9febfedbcb07a0ae81fa3c80fcd9eb8a29930c7 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Sat, 20 Apr 2019 15:08:43 +0200 Subject: [PATCH] Add /account/whoami endpoint --- src/r0/account.rs | 1 + src/r0/account/whoami.rs | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/r0/account/whoami.rs diff --git a/src/r0/account.rs b/src/r0/account.rs index 7bc88a7c..d33db981 100644 --- a/src/r0/account.rs +++ b/src/r0/account.rs @@ -5,3 +5,4 @@ pub mod deactivate; pub mod register; pub mod request_password_change_token; pub mod request_register_token; +pub mod whoami; diff --git a/src/r0/account/whoami.rs b/src/r0/account/whoami.rs new file mode 100644 index 00000000..199fea39 --- /dev/null +++ b/src/r0/account/whoami.rs @@ -0,0 +1,22 @@ +//! [GET /_matrix/client/r0/account/whoami](https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-client-r0-account-whoami) + +use ruma_api_macros::ruma_api; +use serde::{Deserialize, Serialize}; + +ruma_api! { + metadata { + description: "Get information about the owner of a given access token.", + method: GET, + name: "whoami", + path: "/_matrix/client/r0/account/whoami", + rate_limited: true, + requires_authentication: true, + } + + request {} + + response { + /// The id of the user that owns the access token. + pub user_id: String, + } +}