Skip to main content

tuwunel_api/client/device/
devices.rs

1use axum::extract::State;
2use futures::StreamExt;
3use ruma::api::client::device::{self, get_devices};
4use tuwunel_core::Result;
5
6use crate::Ruma;
7
8/// # `GET /_matrix/client/r0/devices`
9///
10/// Get metadata on all devices of the sender user.
11pub(crate) async fn get_devices_route(
12	State(services): State<crate::State>,
13	body: Ruma<get_devices::v3::Request>,
14) -> Result<get_devices::v3::Response> {
15	let devices: Vec<device::Device> = services
16		.users
17		.all_devices_metadata(body.sender_user())
18		.collect()
19		.await;
20
21	Ok(get_devices::v3::Response { devices })
22}