synapse_admin_api/rooms/room_details/
v1.rs1use ruma::{
3 api::{metadata, request, response, Metadata},
4 events::room::{guest_access::GuestAccess, history_visibility::HistoryVisibility},
5 room::{JoinRuleKind, RoomType},
6 uint, OwnedMxcUri, OwnedRoomAliasId, OwnedRoomId, OwnedUserId, UInt,
7};
8
9const METADATA: Metadata = metadata! {
10 method: GET,
11 rate_limited: false,
12 authentication: AccessToken,
13 history: {
14 unstable => "/_synapse/admin/v1/rooms/{room_id}",
15 }
16};
17
18#[request]
19pub struct Request {
20 #[ruma_api(path)]
22 pub room_id: OwnedRoomId,
23}
24
25#[response]
26pub struct Response {
27 pub room_id: OwnedRoomId,
29
30 pub name: Option<String>,
32
33 pub topic: Option<String>,
35
36 pub avatar: Option<OwnedMxcUri>,
38
39 pub canonical_alias: Option<OwnedRoomAliasId>,
41
42 pub joined_members: UInt,
44
45 pub joined_local_members: UInt,
47
48 pub joined_local_devices: UInt,
50
51 pub version: Option<String>,
53
54 #[serde(deserialize_with = "ruma::serde::empty_string_as_none")]
56 pub creator: Option<OwnedUserId>,
57
58 pub encryption: Option<String>,
60
61 #[serde(deserialize_with = "crate::serde::bool_or_uint")]
63 pub federatable: bool,
64
65 #[serde(deserialize_with = "crate::serde::bool_or_uint")]
67 pub public: bool,
68
69 pub join_rules: Option<JoinRuleKind>,
71
72 pub guest_access: Option<GuestAccess>,
74
75 pub history_visibility: Option<HistoryVisibility>,
77
78 pub state_events: UInt,
80
81 pub room_type: Option<RoomType>,
83
84 #[serde(deserialize_with = "crate::serde::bool_or_uint")]
86 pub forgotten: bool,
87}
88
89impl Request {
90 pub fn new(room_id: OwnedRoomId) -> Self {
92 Self { room_id }
93 }
94}
95
96impl Response {
97 pub fn new(room_id: OwnedRoomId) -> Self {
99 Self {
100 room_id,
101 name: None,
102 topic: None,
103 avatar: None,
104 canonical_alias: None,
105 joined_members: uint!(0),
106 joined_local_members: uint!(0),
107 joined_local_devices: uint!(0),
108 version: None,
109 creator: None,
110 encryption: None,
111 federatable: false,
112 public: false,
113 join_rules: None,
114 guest_access: None,
115 history_visibility: None,
116 state_events: uint!(0),
117 room_type: None,
118 forgotten: false,
119 }
120 }
121}