#[cfg(feature = "unstable-msc4125")]
use ruma_common::OwnedServerName;
use ruma_common::{
OwnedEventId, OwnedRoomId, RoomVersionId,
api::{request, response},
metadata,
};
use serde_json::value::RawValue as RawJsonValue;
use crate::{authentication::ServerSignatures, membership::RawStrippedState};
metadata! {
method: PUT,
rate_limited: false,
authentication: ServerSignatures,
path: "/_matrix/federation/v2/invite/{room_id}/{event_id}",
}
#[request]
pub struct Request {
#[ruma_api(path)]
pub room_id: OwnedRoomId,
#[ruma_api(path)]
pub event_id: OwnedEventId,
pub room_version: RoomVersionId,
pub event: Box<RawJsonValue>,
pub invite_room_state: Vec<RawStrippedState>,
#[cfg(feature = "unstable-msc4125")]
#[serde(skip_serializing_if = "Option::is_none", rename = "org.matrix.msc4125.via")]
pub via: Option<Vec<OwnedServerName>>,
}
#[response]
pub struct Response {
pub event: Box<RawJsonValue>,
}
impl Request {
pub fn new(
room_id: OwnedRoomId,
event_id: OwnedEventId,
room_version: RoomVersionId,
event: Box<RawJsonValue>,
invite_room_state: Vec<RawStrippedState>,
) -> Self {
Self {
room_id,
event_id,
room_version,
event,
invite_room_state,
#[cfg(feature = "unstable-msc4125")]
via: None,
}
}
}
impl Response {
pub fn new(event: Box<RawJsonValue>) -> Self {
Self { event }
}
}