Skip to main content

synapse_admin_api/rooms/room_details/
v1.rs

1//! [GET /_synapse/admin/v1/rooms/:room_id](https://github.com/element-hq/synapse/blob/master/docs/admin_api/rooms.md#room-details-api)
2use ruma::{
3    OwnedMxcUri, OwnedRoomAliasId, OwnedRoomId, OwnedUserId, UInt,
4    api::{auth_scheme::AccessToken, metadata, request, response},
5    events::room::{guest_access::GuestAccess, history_visibility::HistoryVisibility},
6    room::{JoinRuleKind, RoomType},
7    uint,
8};
9
10metadata! {
11    method: GET,
12    rate_limited: false,
13    authentication: AccessToken,
14    path: "/_synapse/admin/v1/rooms/{room_id}",
15}
16
17#[request]
18pub struct Request {
19    /// ID of the room to show the details of.
20    #[ruma_api(path)]
21    pub room_id: OwnedRoomId,
22}
23
24#[response]
25pub struct Response {
26    /// Room ID
27    pub room_id: OwnedRoomId,
28
29    /// Room name
30    pub name: Option<String>,
31
32    /// Room topic
33    pub topic: Option<String>,
34
35    /// Room avatar
36    pub avatar: Option<OwnedMxcUri>,
37
38    /// Room alias ID
39    pub canonical_alias: Option<OwnedRoomAliasId>,
40
41    /// Amount of joined members.
42    pub joined_members: UInt,
43
44    /// Amount of local members.
45    pub joined_local_members: UInt,
46
47    /// Amount of local devices.
48    pub joined_local_devices: UInt,
49
50    /// Room version
51    pub version: Option<String>,
52
53    /// User ID of the room creator.
54    #[serde(deserialize_with = "ruma::serde::empty_string_as_none")]
55    pub creator: Option<OwnedUserId>,
56
57    /// Room encryption.
58    pub encryption: Option<String>,
59
60    /// Whether the room is federatable
61    #[serde(deserialize_with = "crate::serde::bool_or_uint")]
62    pub federatable: bool,
63
64    /// Whether the room is public.
65    #[serde(deserialize_with = "crate::serde::bool_or_uint")]
66    pub public: bool,
67
68    /// Join rules of the room.
69    pub join_rules: Option<JoinRuleKind>,
70
71    /// Guest access of the room
72    pub guest_access: Option<GuestAccess>,
73
74    /// History visibility of the room
75    pub history_visibility: Option<HistoryVisibility>,
76
77    /// State events of the room.
78    pub state_events: UInt,
79
80    /// Room type of the room.
81    pub room_type: Option<RoomType>,
82
83    /// Whether all local users have forgotten the room.
84    #[serde(deserialize_with = "crate::serde::bool_or_uint")]
85    pub forgotten: bool,
86}
87
88impl Request {
89    /// Creates a `Request` with the given room ID.
90    pub fn new(room_id: OwnedRoomId) -> Self {
91        Self { room_id }
92    }
93}
94
95impl Response {
96    /// Creates a `Response` with the given room ID and default values.
97    pub fn new(room_id: OwnedRoomId) -> Self {
98        Self {
99            room_id,
100            name: None,
101            topic: None,
102            avatar: None,
103            canonical_alias: None,
104            joined_members: uint!(0),
105            joined_local_members: uint!(0),
106            joined_local_devices: uint!(0),
107            version: None,
108            creator: None,
109            encryption: None,
110            federatable: false,
111            public: false,
112            join_rules: None,
113            guest_access: None,
114            history_visibility: None,
115            state_events: uint!(0),
116            room_type: None,
117            forgotten: false,
118        }
119    }
120}