ruma_identity_service_api/authentication/get_account_information.rs
1//! `GET /_matrix/identity/*/account`
2//!
3//! Get information about what user owns the access token used in the request.
4
5pub mod v2 {
6 //! `/v2/` ([spec])
7 //!
8 //! [spec]: https://spec.matrix.org/latest/identity-service-api/#get_matrixidentityv2account
9
10 use ruma_common::{
11 OwnedUserId,
12 api::{auth_scheme::AccessToken, request, response},
13 metadata,
14 };
15
16 metadata! {
17 method: POST,
18 rate_limited: false,
19 authentication: AccessToken,
20 history: {
21 1.0 => "/_matrix/identity/v2/account",
22 }
23 }
24
25 /// Request type for the `get_account_information` endpoint.
26 #[request]
27 #[derive(Default)]
28 pub struct Request {}
29
30 /// Response type for the `get_account_information` endpoint.
31 #[response]
32 pub struct Response {
33 /// The user ID which registered the token.
34 pub user_id: OwnedUserId,
35 }
36
37 impl Request {
38 /// Creates an empty `Request`.
39 pub fn new() -> Self {
40 Self {}
41 }
42 }
43
44 impl Response {
45 /// Creates a new `Response` with the given `UserId`.
46 pub fn new(user_id: OwnedUserId) -> Self {
47 Self { user_id }
48 }
49 }
50}