use std::ops::Deref; use ruma::{api::client::uiaa::UiaaResponse, CanonicalJsonValue, OwnedDeviceId, OwnedServerName, OwnedUserId}; use crate::{service::appservice::RegistrationInfo, Error}; mod axum; /// Extractor for Ruma request structs pub(crate) struct Ruma { pub(crate) body: T, pub(crate) sender_user: Option, pub(crate) sender_device: Option, pub(crate) sender_servername: Option, pub(crate) json_body: Option, // This is None when body is not a valid string pub(crate) appservice_info: Option, } impl Deref for Ruma { type Target = T; fn deref(&self) -> &Self::Target { &self.body } } #[derive(Clone)] pub(crate) struct RumaResponse(pub(crate) T); impl From for RumaResponse { fn from(t: T) -> Self { Self(t) } } impl From for RumaResponse { fn from(t: Error) -> Self { t.to_response() } }