Skip to main content

synapse_admin_api/users/list_joined_rooms/
v1.rs

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