Skip to main content

synapse_admin_api/rooms/room_members/
v1.rs

1//! [GET /_synapse/admin/v1/rooms/:room_id/members](https://github.com/element-hq/synapse/blob/master/docs/admin_api/rooms.md#room-members-api)
2use ruma::{
3    OwnedRoomId, OwnedUserId, UInt,
4    api::{auth_scheme::AccessToken, metadata, request, response},
5};
6
7metadata! {
8    method: GET,
9    rate_limited: false,
10    authentication: AccessToken,
11    path: "/_synapse/admin/v1/rooms/{room_id}/members",
12}
13
14#[request]
15pub struct Request {
16    /// ID of the room to list the members of.
17    #[ruma_api(path)]
18    pub room_id: OwnedRoomId,
19}
20
21#[response]
22pub struct Response {
23    /// List of members that are present in the room
24    pub members: Vec<OwnedUserId>,
25
26    /// Amount of members in the room.
27    pub total: UInt,
28}
29
30impl Request {
31    /// Creates a `Request` with the given room ID.
32    pub fn new(room_id: OwnedRoomId) -> Self {
33        Self { room_id }
34    }
35}
36
37impl Response {
38    /// Creates a `Response` with the given members and total count,
39    pub fn new(members: Vec<OwnedUserId>, total: UInt) -> Self {
40        Self { members, total }
41    }
42}