1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
use std::collections::BTreeMap;
use ruma_api::ruma_api;
use ruma_common::thirdparty::Medium;
use ruma_identifiers::{RoomId, ServerNameBox, ServerSigningKeyId, UserId};
use serde::{Deserialize, Serialize};
ruma_api! {
metadata: {
description: "Used by identity servers to notify the homeserver that one of its users has bound a third party identifier successfully",
method: PUT,
name: "bind_callback",
path: "/_matrix/federation/v1/3pid/onbind",
rate_limited: false,
authentication: None,
}
request: {
pub medium: &'a Medium,
pub address: &'a str,
pub mxid: &'a UserId,
pub invites: &'a [ThirdPartyInvite],
}
response: {}
}
impl<'a> Request<'a> {
pub fn new(
medium: &'a Medium,
address: &'a str,
mxid: &'a UserId,
invites: &'a [ThirdPartyInvite],
) -> Self {
Self { medium, address, mxid, invites }
}
pub fn email(address: &'a str, mxid: &'a UserId, invites: &'a [ThirdPartyInvite]) -> Self {
Self::new(&Medium::Email, address, mxid, invites)
}
}
#[derive(Debug, Clone, Deserialize, Serialize)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct ThirdPartyInvite {
pub medium: Medium,
pub address: String,
pub mxid: UserId,
pub room_id: RoomId,
pub sender: UserId,
pub signed: BTreeMap<ServerNameBox, BTreeMap<ServerSigningKeyId, String>>,
}
impl ThirdPartyInvite {
pub fn new(
address: String,
mxid: UserId,
room_id: RoomId,
sender: UserId,
signed: BTreeMap<ServerNameBox, BTreeMap<ServerSigningKeyId, String>>,
) -> Self {
Self { medium: Medium::Email, address, mxid, room_id, sender, signed }
}
}