Skip to main content

synapse_admin_api/room_membership/join_room/
v1.rs

1//! [POST /_synapse/admin/v1/join/:room_id_or_alias](https://github.com/element-hq/synapse/blob/master/docs/admin_api/room_membership.md)
2
3use ruma::{
4    OwnedRoomId, OwnedRoomOrAliasId, OwnedUserId,
5    api::{auth_scheme::AccessToken, request, response},
6    metadata,
7};
8
9metadata! {
10    method: POST,
11    rate_limited: false,
12    authentication: AccessToken,
13    path: "/_synapse/admin/v1/join/{room_id_or_alias}",
14}
15
16#[request]
17pub struct Request {
18    /// Alias or ID of the room to join.
19    #[ruma_api(path)]
20    pub room_id_or_alias: OwnedRoomOrAliasId,
21
22    /// User to join the room.
23    pub user_id: OwnedUserId,
24}
25
26#[response]
27pub struct Response {
28    /// Room ID of the joined room.
29    pub room_id: OwnedRoomId,
30}
31
32impl Request {
33    /// Creates a new `Request` with the given room or alias ID and user id.
34    pub fn new(room_id_or_alias: OwnedRoomOrAliasId, user_id: OwnedUserId) -> Self {
35        Self { room_id_or_alias, user_id }
36    }
37}
38
39impl Response {
40    /// Creates a new `Response` with the given room id
41    pub fn new(room_id: OwnedRoomId) -> Self {
42        Self { room_id }
43    }
44}