federation-api: Make bind_callback forwards compatible with add'l medium support

This commit is contained in:
Jonas Platte 2021-06-18 14:02:40 +02:00
parent ff03f4c805
commit ecad815a5b
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
2 changed files with 22 additions and 6 deletions

View File

@ -3,10 +3,12 @@
Breaking Changes: Breaking Changes:
* Change types of keys::claim_keys::v1 response to match the client-server endpoint * Change types of keys::claim_keys::v1 response to match the client-server endpoint
* Update `thirdparty::bind_callback::v1::Request::new` to have a `medium` parameter
Improvements: Improvements:
* Add master_keys and self_signing keys to keys::get_keys::v1 response * Add master_keys and self_signing keys to keys::get_keys::v1 response
* Add `thirdparty::bind_callback::v1::Request::email` convenience constructor
# 0.1.0 # 0.1.0

View File

@ -18,10 +18,14 @@ ruma_api! {
} }
request: { request: {
/// The type of third party identifier. Currently only "email" is a possible value. /// The type of third party identifier.
pub medium: Medium, ///
/// Currently only `Medium::Email` is supported.
pub medium: &'a Medium,
/// The third party identifier itself. For example, an email address. /// The third party identifier itself.
///
/// For example: an email address.
pub address: &'a str, pub address: &'a str,
/// The user that is now bound to the third party identifier. /// The user that is now bound to the third party identifier.
@ -35,9 +39,19 @@ ruma_api! {
} }
impl<'a> Request<'a> { impl<'a> Request<'a> {
/// Creates a new `Request` with the given address, matrix id and third party invites. /// Creates a new `Request` with the given medium, address, user ID and third party invites.
pub fn new(address: &'a str, mxid: &'a UserId, invites: &'a [ThirdPartyInvite]) -> Self { pub fn new(
Self { medium: Medium::Email, address, mxid, invites } medium: &'a Medium,
address: &'a str,
mxid: &'a UserId,
invites: &'a [ThirdPartyInvite],
) -> Self {
Self { medium, address, mxid, invites }
}
/// Creates a new `Request` with the given email address, user ID and third party invites.
pub fn email(address: &'a str, mxid: &'a UserId, invites: &'a [ThirdPartyInvite]) -> Self {
Self::new(&Medium::Email, address, mxid, invites)
} }
} }