Borrow strings and identifiers in membership::ThirdPartySigned and dependent endpoints

This commit is contained in:
Jonas Platte 2020-08-13 21:21:57 +02:00
parent 4a1b6d5607
commit a00129fcfb
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
3 changed files with 11 additions and 10 deletions

View File

@ -14,22 +14,23 @@ pub mod unban_user;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use ruma_api::Outgoing;
use ruma_common::thirdparty::Medium; use ruma_common::thirdparty::Medium;
use ruma_identifiers::{ServerKeyId, ServerName}; use ruma_identifiers::{ServerKeyId, ServerName};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// A signature of an `m.third_party_invite` token to prove that this user owns a third party /// 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. /// identity which has been invited to the room.
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Outgoing, Serialize)]
pub struct ThirdPartySigned { pub struct ThirdPartySigned<'a> {
/// The Matrix ID of the user who issued the invite. /// The Matrix ID of the user who issued the invite.
pub sender: String, pub sender: &'a str,
/// The Matrix ID of the invitee. /// The Matrix ID of the invitee.
pub mxid: String, pub mxid: &'a str,
/// The state key of the m.third_party_invite event. /// The state key of the m.third_party_invite event.
pub token: String, pub token: &'a str,
/// A signatures object containing a signature of the entire signed object. /// A signatures object containing a signature of the entire signed object.
pub signatures: BTreeMap<Box<ServerName>, BTreeMap<ServerKeyId, String>>, pub signatures: BTreeMap<Box<ServerName>, BTreeMap<ServerKeyId, String>>,

View File

@ -3,7 +3,7 @@
use ruma_api::ruma_api; use ruma_api::ruma_api;
use ruma_identifiers::RoomId; use ruma_identifiers::RoomId;
use super::ThirdPartySigned; use super::{IncomingThirdPartySigned, ThirdPartySigned};
ruma_api! { ruma_api! {
metadata: { metadata: {
@ -23,7 +23,7 @@ ruma_api! {
/// The signature of a `m.third_party_invite` token to prove that this user owns a third /// The signature of a `m.third_party_invite` token to prove that this user owns a third
/// party identity which has been invited to the room. /// party identity which has been invited to the room.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub third_party_signed: Option<ThirdPartySigned>, pub third_party_signed: Option<ThirdPartySigned<'a>>,
} }
response: { response: {

View File

@ -3,7 +3,7 @@
use ruma_api::ruma_api; use ruma_api::ruma_api;
use ruma_identifiers::{RoomId, RoomIdOrAliasId, ServerName}; use ruma_identifiers::{RoomId, RoomIdOrAliasId, ServerName};
use super::ThirdPartySigned; use super::{IncomingThirdPartySigned, ThirdPartySigned};
ruma_api! { ruma_api! {
metadata: { metadata: {
@ -24,12 +24,12 @@ ruma_api! {
/// must be participating in the room. /// must be participating in the room.
#[ruma_api(query)] #[ruma_api(query)]
#[serde(default)] #[serde(default)]
pub server_name: Vec<Box<ServerName>>, pub server_name: &'a [Box<ServerName>],
/// The signature of a `m.third_party_invite` token to prove that this user owns a third /// The signature of a `m.third_party_invite` token to prove that this user owns a third
/// party identity which has been invited to the room. /// party identity which has been invited to the room.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub third_party_signed: Option<ThirdPartySigned>, pub third_party_signed: Option<ThirdPartySigned<'a>>,
} }
response: { response: {