ruma_client_api/membership/
mutual_rooms.rs1pub mod unstable {
6 use ruma_common::{
11 api::{request, response, Metadata},
12 metadata, OwnedRoomId, OwnedUserId,
13 };
14
15 const METADATA: Metadata = metadata! {
16 method: GET,
17 rate_limited: true,
18 authentication: AccessToken,
19 history: {
20 unstable("uk.half-shot.msc2666.query_mutual_rooms") => "/_matrix/client/unstable/uk.half-shot.msc2666/user/mutual_rooms",
21 }
22 };
23
24 #[request(error = crate::Error)]
26 pub struct Request {
27 #[ruma_api(query)]
29 pub user_id: OwnedUserId,
30
31 #[serde(skip_serializing_if = "Option::is_none")]
34 #[ruma_api(query)]
35 pub batch_token: Option<String>,
36 }
37
38 #[response(error = crate::Error)]
40 pub struct Response {
41 pub joined: Vec<OwnedRoomId>,
43
44 #[serde(skip_serializing_if = "Option::is_none")]
46 pub next_batch_token: Option<String>,
47 }
48
49 impl Request {
50 pub fn new(user_id: OwnedUserId) -> Self {
52 Self { user_id, batch_token: None }
53 }
54
55 pub fn with_token(user_id: OwnedUserId, token: String) -> Self {
57 Self { user_id, batch_token: Some(token) }
58 }
59 }
60
61 impl Response {
62 pub fn new(joined: Vec<OwnedRoomId>) -> Self {
64 Self { joined, next_batch_token: None }
65 }
66
67 pub fn with_token(joined: Vec<OwnedRoomId>, token: String) -> Self {
69 Self { joined, next_batch_token: Some(token) }
70 }
71 }
72}