client-api: Add the reason field for remaining endpoints (MSC2367)
This commit is contained in:
parent
a7be60d9eb
commit
efd5ad52fa
@ -1,5 +1,17 @@
|
||||
# [unreleased]
|
||||
|
||||
Improvements:
|
||||
|
||||
* Add unstable support for reasons in the membership endpoints:
|
||||
```rust
|
||||
r0::membership::{
|
||||
join_room_by_id,
|
||||
join_room_by_id_or_alias,
|
||||
invite_user,
|
||||
unban_user
|
||||
}
|
||||
```
|
||||
|
||||
# 0.12.3
|
||||
|
||||
* Add a `feature = "compat"` workaround for Element failing on `GET /_matrix/client/r0/account/3pid`
|
||||
|
@ -30,8 +30,14 @@ ruma_api! {
|
||||
pub room_id: &'a RoomId,
|
||||
|
||||
/// The user to invite.
|
||||
#[ruma_api(body)]
|
||||
#[serde(flatten)]
|
||||
pub recipient: InvitationRecipient<'a>,
|
||||
|
||||
/// Optional reason for inviting the user.
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reason: Option<&'a str>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
@ -43,7 +49,12 @@ ruma_api! {
|
||||
impl<'a> Request<'a> {
|
||||
/// Creates a new `Request` with the given room ID and invitation recipient.
|
||||
pub fn new(room_id: &'a RoomId, recipient: InvitationRecipient<'a>) -> Self {
|
||||
Self { room_id, recipient }
|
||||
Self {
|
||||
room_id,
|
||||
recipient,
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
reason: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,12 @@ ruma_api! {
|
||||
/// party identity which has been invited to the room.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub third_party_signed: Option<ThirdPartySigned<'a>>,
|
||||
|
||||
/// Optional reason for joining the room.
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reason: Option<&'a str>,
|
||||
}
|
||||
|
||||
response: {
|
||||
@ -37,7 +43,12 @@ ruma_api! {
|
||||
impl<'a> Request<'a> {
|
||||
/// Creates a new `Request` with the given room id.
|
||||
pub fn new(room_id: &'a RoomId) -> Self {
|
||||
Self { room_id, third_party_signed: None }
|
||||
Self {
|
||||
room_id,
|
||||
third_party_signed: None,
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
reason: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,12 @@ ruma_api! {
|
||||
/// party identity which has been invited to the room.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub third_party_signed: Option<ThirdPartySigned<'a>>,
|
||||
|
||||
/// Optional reason for joining the room.
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reason: Option<&'a str>,
|
||||
}
|
||||
|
||||
response: {
|
||||
@ -43,7 +49,13 @@ ruma_api! {
|
||||
impl<'a> Request<'a> {
|
||||
/// Creates a new `Request` with the given room ID or alias ID.
|
||||
pub fn new(room_id_or_alias: &'a RoomIdOrAliasId) -> Self {
|
||||
Self { room_id_or_alias, server_name: &[], third_party_signed: None }
|
||||
Self {
|
||||
room_id_or_alias,
|
||||
server_name: &[],
|
||||
third_party_signed: None,
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
reason: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,12 @@ ruma_api! {
|
||||
|
||||
/// The user to unban.
|
||||
pub user_id: &'a UserId,
|
||||
|
||||
/// Optional reason for unbanning the user.
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "unstable-pre-spec")))]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub reason: Option<&'a str>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
@ -31,7 +37,12 @@ ruma_api! {
|
||||
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 }
|
||||
Self {
|
||||
room_id,
|
||||
user_id,
|
||||
#[cfg(feature = "unstable-pre-spec")]
|
||||
reason: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user