synapse_admin_api/users/list_joined_rooms/
v1.rs

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