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:
* 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:
* 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

View File

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