pub mod unstable {
use ruma_common::{
OwnedDeviceId,
api::{auth_scheme::AccessToken, request, response},
metadata,
serde::Raw,
};
use ruma_events::AnyToDeviceEvent;
metadata! {
method: POST,
rate_limited: false,
authentication: AccessToken,
history: {
unstable => "/_matrix/client/unstable/org.matrix.msc3814.v1/dehydrated_device/{device_id}/events",
}
}
#[request(error = crate::Error)]
pub struct Request {
#[ruma_api(path)]
pub device_id: OwnedDeviceId,
#[serde(skip_serializing_if = "Option::is_none")]
pub next_batch: Option<String>,
}
#[response(error = crate::Error)]
pub struct Response {
pub next_batch: Option<String>,
pub events: Vec<Raw<AnyToDeviceEvent>>,
}
impl Request {
pub fn new(device_id: OwnedDeviceId) -> Self {
Self { device_id, next_batch: None }
}
}
impl Response {
pub fn new(events: Vec<Raw<AnyToDeviceEvent>>) -> Self {
Self { next_batch: None, events }
}
}
}