Update more endpoints

This commit is contained in:
Jonas Platte 2020-08-15 02:23:30 +02:00
parent 640c5602d5
commit e74158b262
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
4 changed files with 73 additions and 9 deletions

View File

@ -13,20 +13,36 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
#[non_exhaustive]
request: { request: {
/// The room to kick the user from. /// The room to kick the user from.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: &'a RoomId,
/// The user to ban. /// The user to ban.
pub user_id: UserId, pub user_id: &'a UserId,
/// The reason for banning the user. /// The reason for banning the user.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub reason: Option<String>, pub reason: Option<&'a str>,
} }
#[non_exhaustive]
response: {} response: {}
error: crate::Error 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
}
}

View File

@ -13,13 +13,29 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
#[non_exhaustive]
request: { request: {
/// The room to forget. /// The room to forget.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: &'a RoomId,
} }
#[non_exhaustive]
response: {} response: {}
error: crate::Error 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
}
}

View File

@ -13,20 +13,36 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
#[non_exhaustive]
request: { request: {
/// The room to kick the user from. /// The room to kick the user from.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: &'a RoomId,
/// The user to kick. /// The user to kick.
pub user_id: UserId, pub user_id: &'a UserId,
/// The reason for kicking the user. /// The reason for kicking the user.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub reason: Option<String>, pub reason: Option<&'a str>,
} }
#[non_exhaustive]
response: {} response: {}
error: crate::Error 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
}
}

View File

@ -13,16 +13,32 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
#[non_exhaustive]
request: { request: {
/// The room to unban the user from. /// The room to unban the user from.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: &'a RoomId,
/// The user to unban. /// The user to unban.
pub user_id: UserId, pub user_id: &'a UserId,
} }
#[non_exhaustive]
response: {} response: {}
error: crate::Error 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
}
}