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    api::{metadata, request, response, Metadata},
4    OwnedRoomId, OwnedUserId, UInt,
5};
6
7const METADATA: Metadata = metadata! {
8    method: GET,
9    rate_limited: false,
10    authentication: AccessToken,
11    history: {
12        unstable => "/_synapse/admin/v1/rooms/{room_id}/members",
13    }
14};
15
16#[request]
17pub struct Request {
18    /// ID of the room to list the members of.
19    #[ruma_api(path)]
20    pub room_id: OwnedRoomId,
21}
22
23#[response]
24pub struct Response {
25    /// List of members that are present in the room
26    pub members: Vec<OwnedUserId>,
27
28    /// Amount of members in the room.
29    pub total: UInt,
30}
31
32impl Request {
33    /// Creates a `Request` with the given room ID.
34    pub fn new(room_id: OwnedRoomId) -> Self {
35        Self { room_id }
36    }
37}
38
39impl Response {
40    /// Creates a `Response` with the given members and total count,
41    pub fn new(members: Vec<OwnedUserId>, total: UInt) -> Self {
42        Self { members, total }
43    }
44}