Add /account/whoami endpoint

This commit is contained in:
Jonas Platte 2019-04-20 15:08:43 +02:00
parent d5b6e7e322
commit e9febfedbc
2 changed files with 23 additions and 0 deletions

View File

@ -5,3 +5,4 @@ pub mod deactivate;
pub mod register;
pub mod request_password_change_token;
pub mod request_register_token;
pub mod whoami;

22
src/r0/account/whoami.rs Normal file
View File

@ -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,
}
}