client-api: Add support for mutual rooms endpoint (MSC2666)
This commit is contained in:
parent
afc311b01d
commit
34863ca80f
@ -19,6 +19,7 @@ rustdoc-args = ["--cfg", "docsrs"]
|
||||
compat = []
|
||||
unstable-exhaustive-types = []
|
||||
unstable-msc2246 = []
|
||||
unstable-msc2666 = []
|
||||
unstable-msc2448 = []
|
||||
unstable-msc2654 = []
|
||||
unstable-msc2675 = []
|
||||
|
@ -10,6 +10,8 @@ pub mod joined_members;
|
||||
pub mod joined_rooms;
|
||||
pub mod kick_user;
|
||||
pub mod leave_room;
|
||||
#[cfg(feature = "unstable-msc2666")]
|
||||
pub mod mutual_rooms;
|
||||
pub mod unban_user;
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
47
crates/ruma-client-api/src/membership/mutual_rooms.rs
Normal file
47
crates/ruma-client-api/src/membership/mutual_rooms.rs
Normal file
@ -0,0 +1,47 @@
|
||||
//! `GET /_matrix/client/*/user/mutual_rooms/{user_id}`
|
||||
|
||||
pub mod unstable {
|
||||
//! `/unstable/` ([spec])
|
||||
//!
|
||||
//! [spec]: https://github.com/matrix-org/matrix-spec-proposals/blob/hs/shared-rooms/proposals/2666-get-rooms-in-common.md
|
||||
|
||||
use ruma_common::{api::ruma_api, OwnedRoomId, UserId};
|
||||
|
||||
ruma_api! {
|
||||
metadata: {
|
||||
description: "Get mutual rooms with another user.",
|
||||
method: GET,
|
||||
name: "mutual_rooms",
|
||||
unstable_path: "/_matrix/client/unstable/uk.half-shot.msc2666/user/mutual_rooms/:user_id",
|
||||
rate_limited: true,
|
||||
authentication: AccessToken,
|
||||
}
|
||||
|
||||
request: {
|
||||
/// The user to search mutual rooms for.
|
||||
#[ruma_api(path)]
|
||||
pub user_id: &'a UserId,
|
||||
}
|
||||
|
||||
response: {
|
||||
/// A list of rooms the user is in together with the authenticated user.
|
||||
pub joined: Vec<OwnedRoomId>,
|
||||
}
|
||||
|
||||
error: crate::Error
|
||||
}
|
||||
|
||||
impl<'a> Request<'a> {
|
||||
/// Creates a new `Request` with the given user id.
|
||||
pub fn new(user_id: &'a UserId) -> Self {
|
||||
Self { user_id }
|
||||
}
|
||||
}
|
||||
|
||||
impl Response {
|
||||
/// Creates a `Response` with the given room ids.
|
||||
pub fn new(joined: Vec<OwnedRoomId>) -> Self {
|
||||
Self { joined }
|
||||
}
|
||||
}
|
||||
}
|
@ -124,6 +124,7 @@ unstable-msc2448 = [
|
||||
"ruma-federation-api?/unstable-msc2448"
|
||||
]
|
||||
unstable-msc2654 = ["ruma-client-api?/unstable-msc2654"]
|
||||
unstable-msc2666 = ["ruma-client-api?/unstable-msc2666"]
|
||||
unstable-msc2675 = [
|
||||
"ruma-client-api?/unstable-msc2675",
|
||||
"ruma-common/unstable-msc2675",
|
||||
@ -164,6 +165,7 @@ __ci = [
|
||||
"unstable-pre-spec",
|
||||
"unstable-msc1767",
|
||||
"unstable-msc2448",
|
||||
"unstable-msc2666",
|
||||
"unstable-msc2654",
|
||||
"unstable-msc2675",
|
||||
"unstable-msc2676",
|
||||
|
Loading…
x
Reference in New Issue
Block a user