1//! Endpoints for room membership.
23pub mod ban_user;
4pub mod forget_room;
5pub mod get_member_events;
6pub mod invite_user;
7pub mod join_room_by_id;
8pub mod join_room_by_id_or_alias;
9pub mod joined_members;
10pub mod joined_rooms;
11pub mod kick_user;
12pub mod leave_room;
13#[cfg(feature = "unstable-msc2666")]
14pub mod mutual_rooms;
15pub mod unban_user;
1617use ruma_common::{thirdparty::Medium, OwnedUserId, ServerSignatures};
18use serde::{Deserialize, Serialize};
1920/// A signature of an `m.third_party_invite` token to prove that this user owns a third party
21/// identity which has been invited to the room.
22#[derive(Clone, Debug, Deserialize, Serialize)]
23#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
24pub struct ThirdPartySigned {
25/// The Matrix ID of the user who issued the invite.
26pub sender: OwnedUserId,
2728/// The Matrix ID of the invitee.
29pub mxid: OwnedUserId,
3031/// The state key of the `m.third_party_invite` event.
32pub token: String,
3334/// A signatures object containing a signature of the entire signed object.
35pub signatures: ServerSignatures,
36}
3738impl ThirdPartySigned {
39/// Creates a new `ThirdPartySigned` from the given sender and invitee user IDs, state key token
40 /// and signatures.
41pub fn new(
42 sender: OwnedUserId,
43 mxid: OwnedUserId,
44 token: String,
45 signatures: ServerSignatures,
46 ) -> Self {
47Self { sender, mxid, token, signatures }
48 }
49}
5051/// Represents third party IDs to invite to the room.
52///
53/// To create an instance of this type, first create a `Invite3pidInit` and convert it via
54/// `Invite3pid::from` / `.into()`.
55#[derive(Clone, Debug, Deserialize, Serialize)]
56#[cfg_attr(not(ruma_unstable_exhaustive_types), non_exhaustive)]
57pub struct Invite3pid {
58/// Hostname and port of identity server to be used for account lookups.
59pub id_server: String,
6061/// An access token registered with the identity server.
62pub id_access_token: String,
6364/// Type of third party ID.
65pub medium: Medium,
6667/// Third party identifier.
68pub address: String,
69}
7071/// Initial set of fields of `Invite3pid`.
72///
73/// This struct will not be updated even if additional fields are added to `Invite3pid` in a new
74/// (non-breaking) release of the Matrix specification.
75#[derive(Debug)]
76#[allow(clippy::exhaustive_structs)]
77pub struct Invite3pidInit {
78/// Hostname and port of identity server to be used for account lookups.
79pub id_server: String,
8081/// An access token registered with the identity server.
82pub id_access_token: String,
8384/// Type of third party ID.
85pub medium: Medium,
8687/// Third party identifier.
88pub address: String,
89}
9091impl From<Invite3pidInit> for Invite3pid {
92fn from(init: Invite3pidInit) -> Self {
93let Invite3pidInit { id_server, id_access_token, medium, address } = init;
94Self { id_server, id_access_token, medium, address }
95 }
96}