client-api: Make a few more types non-exhaustive
This commit is contained in:
parent
3342deed55
commit
f940ff5d11
@ -25,11 +25,19 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
/// A wrapper around a mapping of session IDs to key data.
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
pub struct RoomKeyBackup {
|
||||
/// A map of session IDs to key data.
|
||||
pub sessions: BTreeMap<String, KeyBackupData>,
|
||||
}
|
||||
|
||||
impl RoomKeyBackup {
|
||||
/// Creates a new `RoomKeyBackup` with the given sessions.
|
||||
pub fn new(sessions: BTreeMap<String, KeyBackupData>) -> Self {
|
||||
Self { sessions }
|
||||
}
|
||||
}
|
||||
|
||||
/// The algorithm used for storing backups.
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(tag = "algorithm", content = "auth_data")]
|
||||
|
@ -22,6 +22,7 @@ use serde::Serialize;
|
||||
/// A signature of an `m.third_party_invite` token to prove that this user owns a third party
|
||||
/// identity which has been invited to the room.
|
||||
#[derive(Clone, Debug, Outgoing, Serialize)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
pub struct ThirdPartySigned<'a> {
|
||||
/// The Matrix ID of the user who issued the invite.
|
||||
pub sender: &'a UserId,
|
||||
@ -36,6 +37,19 @@ pub struct ThirdPartySigned<'a> {
|
||||
pub signatures: BTreeMap<ServerNameBox, BTreeMap<ServerSigningKeyId, String>>,
|
||||
}
|
||||
|
||||
impl<'a> ThirdPartySigned<'a> {
|
||||
/// Creates a new `ThirdPartySigned` from the given sender and invitee user IDs, state key token
|
||||
/// and signatures.
|
||||
pub fn new(
|
||||
sender: &'a UserId,
|
||||
mxid: &'a UserId,
|
||||
token: &'a str,
|
||||
signatures: BTreeMap<ServerNameBox, BTreeMap<ServerSigningKeyId, String>>,
|
||||
) -> Self {
|
||||
Self { sender, mxid, token, signatures }
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents third party IDs to invite to the room.
|
||||
#[derive(Clone, Debug, PartialEq, Outgoing, Serialize)]
|
||||
#[incoming_derive(PartialEq)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user