2024-05-23 18:44:19 +00:00
|
|
|
mod auth;
|
|
|
|
mod request;
|
2024-05-09 15:59:08 -07:00
|
|
|
mod xmatrix;
|
2020-07-25 23:08:00 -04:00
|
|
|
|
2024-05-09 15:59:08 -07:00
|
|
|
use std::ops::Deref;
|
2024-03-05 19:48:54 -05:00
|
|
|
|
2024-05-09 15:59:08 -07:00
|
|
|
use ruma::{CanonicalJsonValue, OwnedDeviceId, OwnedServerName, OwnedUserId};
|
2024-03-05 19:48:54 -05:00
|
|
|
|
2024-05-09 15:59:08 -07:00
|
|
|
use crate::service::appservice::RegistrationInfo;
|
2020-02-15 22:42:21 +01:00
|
|
|
|
2022-01-20 11:51:31 +01:00
|
|
|
/// Extractor for Ruma request structs
|
2024-04-22 23:48:57 -04:00
|
|
|
pub(crate) struct Ruma<T> {
|
2024-05-26 14:29:56 -04:00
|
|
|
/// Request struct body
|
2024-04-22 23:48:57 -04:00
|
|
|
pub(crate) body: T,
|
|
|
|
pub(crate) sender_user: Option<OwnedUserId>,
|
|
|
|
pub(crate) sender_device: Option<OwnedDeviceId>,
|
2024-05-26 14:29:56 -04:00
|
|
|
/// X-Matrix origin/server
|
|
|
|
pub(crate) origin: Option<OwnedServerName>,
|
2024-04-22 23:48:57 -04:00
|
|
|
pub(crate) json_body: Option<CanonicalJsonValue>, // This is None when body is not a valid string
|
|
|
|
pub(crate) appservice_info: Option<RegistrationInfo>,
|
2020-03-28 18:50:02 +01:00
|
|
|
}
|
2020-03-28 23:08:59 +01:00
|
|
|
|
2022-04-06 21:31:29 +02:00
|
|
|
impl<T> Deref for Ruma<T> {
|
|
|
|
type Target = T;
|
2020-02-15 22:42:21 +01:00
|
|
|
|
|
|
|
fn deref(&self) -> &Self::Target { &self.body }
|
2020-03-28 18:50:02 +01:00
|
|
|
}
|