arminius_server_client/handlers/
account.rs1mod tests;
8
9use arminius_lib_component::{Component, ServerState, ruma_requests::ArminiusResponse};
10use axum::{Router, routing::get};
11use ruma::api::client::account::{get_3pids, whoami};
12
13use crate::client_request::AuthenticatedClientRequest;
14
15async fn get_3pids_handler(
23 AuthenticatedClientRequest(_claims, _request): AuthenticatedClientRequest<
24 get_3pids::v3::Request,
25 >,
26) -> ArminiusResponse<get_3pids::v3::Response> {
27 get_3pids::v3::Response::new(vec![]).into()
28}
29
30async fn whoami_handler(
35 AuthenticatedClientRequest(claims, _request): AuthenticatedClientRequest<whoami::v3::Request>,
36) -> ArminiusResponse<whoami::v3::Response> {
37 let mut resp = whoami::v3::Response::new(claims.user_id, false);
38 resp.device_id = Some(claims.device_id);
39
40 resp.into()
41}
42
43#[derive(Debug)]
45pub struct AccountComponent;
46
47impl Component for AccountComponent {
48 fn router() -> Router<ServerState> {
49 Router::new()
50 .route("/_matrix/client/v3/account/3pid", get(get_3pids_handler))
51 .route("/_matrix/client/v3/account/whoami", get(whoami_handler))
52 }
53}