tuwunel_admin/debug/
get_short_pdu.rs1use tuwunel_core::{
2 Result, err,
3 matrix::pdu::{PduId, RawPduId},
4};
5use tuwunel_service::rooms::short::ShortRoomId;
6
7use crate::admin_command;
8
9#[admin_command]
10pub(super) async fn get_short_pdu(&self, shortroomid: ShortRoomId, count: i64) -> Result {
11 let pdu_id: RawPduId = PduId { shortroomid, count: count.into() }.into();
12
13 let pdu_json = self
14 .services
15 .timeline
16 .get_pdu_json_from_id(&pdu_id)
17 .await;
18
19 let json = pdu_json.map_err(|_| err!("PDU not found locally."))?;
20
21 let json_text = serde_json::to_string_pretty(&json)?;
22
23 write!(self, "```json\n{json_text}\n```").await
24}