From a00129fcfb8bb45e97d407710cd2ac2f9ff1f69a Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Thu, 13 Aug 2020 21:21:57 +0200 Subject: [PATCH] Borrow strings and identifiers in membership::ThirdPartySigned and dependent endpoints --- ruma-client-api/src/r0/membership.rs | 11 ++++++----- ruma-client-api/src/r0/membership/join_room_by_id.rs | 4 ++-- .../src/r0/membership/join_room_by_id_or_alias.rs | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ruma-client-api/src/r0/membership.rs b/ruma-client-api/src/r0/membership.rs index 47e5f429..2c23eac3 100644 --- a/ruma-client-api/src/r0/membership.rs +++ b/ruma-client-api/src/r0/membership.rs @@ -14,22 +14,23 @@ pub mod unban_user; use std::collections::BTreeMap; +use ruma_api::Outgoing; use ruma_common::thirdparty::Medium; use ruma_identifiers::{ServerKeyId, ServerName}; use serde::{Deserialize, 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, Deserialize, Serialize)] -pub struct ThirdPartySigned { +#[derive(Clone, Debug, Outgoing, Serialize)] +pub struct ThirdPartySigned<'a> { /// The Matrix ID of the user who issued the invite. - pub sender: String, + pub sender: &'a str, /// The Matrix ID of the invitee. - pub mxid: String, + pub mxid: &'a str, /// 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. pub signatures: BTreeMap, BTreeMap>, diff --git a/ruma-client-api/src/r0/membership/join_room_by_id.rs b/ruma-client-api/src/r0/membership/join_room_by_id.rs index af6f0b50..8cd968cd 100644 --- a/ruma-client-api/src/r0/membership/join_room_by_id.rs +++ b/ruma-client-api/src/r0/membership/join_room_by_id.rs @@ -3,7 +3,7 @@ use ruma_api::ruma_api; use ruma_identifiers::RoomId; -use super::ThirdPartySigned; +use super::{IncomingThirdPartySigned, ThirdPartySigned}; ruma_api! { metadata: { @@ -23,7 +23,7 @@ ruma_api! { /// 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. #[serde(skip_serializing_if = "Option::is_none")] - pub third_party_signed: Option, + pub third_party_signed: Option>, } response: { diff --git a/ruma-client-api/src/r0/membership/join_room_by_id_or_alias.rs b/ruma-client-api/src/r0/membership/join_room_by_id_or_alias.rs index 375146ba..013dc043 100644 --- a/ruma-client-api/src/r0/membership/join_room_by_id_or_alias.rs +++ b/ruma-client-api/src/r0/membership/join_room_by_id_or_alias.rs @@ -3,7 +3,7 @@ use ruma_api::ruma_api; use ruma_identifiers::{RoomId, RoomIdOrAliasId, ServerName}; -use super::ThirdPartySigned; +use super::{IncomingThirdPartySigned, ThirdPartySigned}; ruma_api! { metadata: { @@ -24,12 +24,12 @@ ruma_api! { /// must be participating in the room. #[ruma_api(query)] #[serde(default)] - pub server_name: Vec>, + pub server_name: &'a [Box], /// 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. #[serde(skip_serializing_if = "Option::is_none")] - pub third_party_signed: Option, + pub third_party_signed: Option>, } response: {