1
0
Fork 0
mirror of https://forgejo.ellis.link/continuwuation/continuwuity.git synced 2025-07-28 02:38:30 +00:00
continuwuity/src/api/ruma_wrapper/mod.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
723 B
Rust
Raw Normal View History

pub(crate) mod axum;
mod xmatrix;
use std::ops::Deref;
use ruma::{CanonicalJsonValue, OwnedDeviceId, OwnedServerName, OwnedUserId};
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
pub(crate) struct Ruma<T> {
/// Request struct body
pub(crate) body: T,
pub(crate) sender_user: Option<OwnedUserId>,
pub(crate) sender_device: Option<OwnedDeviceId>,
/// X-Matrix origin/server
pub(crate) origin: Option<OwnedServerName>,
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
}