diff --git a/ruma-client-api/src/r0/membership/ban_user.rs b/ruma-client-api/src/r0/membership/ban_user.rs index 54dbda5f..fd01a149 100644 --- a/ruma-client-api/src/r0/membership/ban_user.rs +++ b/ruma-client-api/src/r0/membership/ban_user.rs @@ -13,20 +13,36 @@ ruma_api! { requires_authentication: true, } + #[non_exhaustive] request: { /// The room to kick the user from. #[ruma_api(path)] - pub room_id: RoomId, + pub room_id: &'a RoomId, /// The user to ban. - pub user_id: UserId, + pub user_id: &'a UserId, /// The reason for banning the user. #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, + pub reason: Option<&'a str>, } + #[non_exhaustive] response: {} error: crate::Error } + +impl<'a> Request<'a> { + /// Creates a new `Request` with the given room id and room id. + pub fn new(room_id: &'a RoomId, user_id: &'a UserId) -> Self { + Self { room_id, user_id, reason: None } + } +} + +impl Response { + /// Creates an empty `Response`. + pub fn new() -> Self { + Self + } +} diff --git a/ruma-client-api/src/r0/membership/forget_room.rs b/ruma-client-api/src/r0/membership/forget_room.rs index 93b11867..28c4194e 100644 --- a/ruma-client-api/src/r0/membership/forget_room.rs +++ b/ruma-client-api/src/r0/membership/forget_room.rs @@ -13,13 +13,29 @@ ruma_api! { requires_authentication: true, } + #[non_exhaustive] request: { /// The room to forget. #[ruma_api(path)] - pub room_id: RoomId, + pub room_id: &'a RoomId, } + #[non_exhaustive] response: {} error: crate::Error } + +impl<'a> Request<'a> { + /// Creates a new `Request` with the given room id. + pub fn new(room_id: &'a RoomId) -> Self { + Self { room_id } + } +} + +impl Response { + /// Creates an empty `Response`. + pub fn new() -> Self { + Self + } +} diff --git a/ruma-client-api/src/r0/membership/kick_user.rs b/ruma-client-api/src/r0/membership/kick_user.rs index 19a15639..c97e6553 100644 --- a/ruma-client-api/src/r0/membership/kick_user.rs +++ b/ruma-client-api/src/r0/membership/kick_user.rs @@ -13,20 +13,36 @@ ruma_api! { requires_authentication: true, } + #[non_exhaustive] request: { /// The room to kick the user from. #[ruma_api(path)] - pub room_id: RoomId, + pub room_id: &'a RoomId, /// The user to kick. - pub user_id: UserId, + pub user_id: &'a UserId, /// The reason for kicking the user. #[serde(skip_serializing_if = "Option::is_none")] - pub reason: Option, + pub reason: Option<&'a str>, } + #[non_exhaustive] response: {} error: crate::Error } + +impl<'a> Request<'a> { + /// Creates a new `Request` with the given room id and room id. + pub fn new(room_id: &'a RoomId, user_id: &'a UserId) -> Self { + Self { room_id, user_id, reason: None } + } +} + +impl Response { + /// Creates an empty `Response`. + pub fn new() -> Self { + Self + } +} diff --git a/ruma-client-api/src/r0/membership/unban_user.rs b/ruma-client-api/src/r0/membership/unban_user.rs index ba1d6eab..c30dd51f 100644 --- a/ruma-client-api/src/r0/membership/unban_user.rs +++ b/ruma-client-api/src/r0/membership/unban_user.rs @@ -13,16 +13,32 @@ ruma_api! { requires_authentication: true, } + #[non_exhaustive] request: { /// The room to unban the user from. #[ruma_api(path)] - pub room_id: RoomId, + pub room_id: &'a RoomId, /// The user to unban. - pub user_id: UserId, + pub user_id: &'a UserId, } + #[non_exhaustive] response: {} error: crate::Error } + +impl<'a> Request<'a> { + /// Creates a new `Request` with the given room id and room id. + pub fn new(room_id: &'a RoomId, user_id: &'a UserId) -> Self { + Self { room_id, user_id } + } +} + +impl Response { + /// Creates an empty `Response`. + pub fn new() -> Self { + Self + } +}