client-api: Rename UserIdentifier::MatrixId to UserIdOrLocalpart
This commit is contained in:
parent
48da0a1a12
commit
c5a6cf033f
@ -21,6 +21,7 @@ Breaking changes:
|
|||||||
* Move `r0::uiaa::authorize_fallback` to `r0::uiaa::get_uiaa_fallback_page`
|
* Move `r0::uiaa::authorize_fallback` to `r0::uiaa::get_uiaa_fallback_page`
|
||||||
* Change type of field `start` of `r0::message::get_message_events::Response` to
|
* Change type of field `start` of `r0::message::get_message_events::Response` to
|
||||||
`String` in accordance with the updated specification.
|
`String` in accordance with the updated specification.
|
||||||
|
* Rename `uiaa::UserIdentifier::MatrixId` variant to `uiaa::UserIdentifier::UserIdOrLocalpart`
|
||||||
|
|
||||||
Improvements:
|
Improvements:
|
||||||
|
|
||||||
|
@ -310,7 +310,7 @@ pub mod v3 {
|
|||||||
"password": "ilovebananas"
|
"password": "ilovebananas"
|
||||||
}))
|
}))
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
IncomingLoginInfo::Password(IncomingPassword { identifier: IncomingUserIdentifier::MatrixId(user), password })
|
IncomingLoginInfo::Password(IncomingPassword { identifier: IncomingUserIdentifier::UserIdOrLocalpart(user), password })
|
||||||
if user == "cheeky_monkey" && password == "ilovebananas"
|
if user == "cheeky_monkey" && password == "ilovebananas"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ impl Outgoing for CustomAuthData<'_> {
|
|||||||
pub enum UserIdentifier<'a> {
|
pub enum UserIdentifier<'a> {
|
||||||
/// Either a fully qualified Matrix user ID, or just the localpart (as part of the 'identifier'
|
/// Either a fully qualified Matrix user ID, or just the localpart (as part of the 'identifier'
|
||||||
/// field).
|
/// field).
|
||||||
MatrixId(&'a str),
|
UserIdOrLocalpart(&'a str),
|
||||||
|
|
||||||
/// Third party identifier (as part of the 'identifier' field).
|
/// Third party identifier (as part of the 'identifier' field).
|
||||||
ThirdPartyId {
|
ThirdPartyId {
|
||||||
@ -602,7 +602,7 @@ pub enum UserIdentifier<'a> {
|
|||||||
impl IncomingUserIdentifier {
|
impl IncomingUserIdentifier {
|
||||||
pub(crate) fn to_outgoing(&self) -> UserIdentifier<'_> {
|
pub(crate) fn to_outgoing(&self) -> UserIdentifier<'_> {
|
||||||
match self {
|
match self {
|
||||||
Self::MatrixId(id) => UserIdentifier::MatrixId(id),
|
Self::UserIdOrLocalpart(id) => UserIdentifier::UserIdOrLocalpart(id),
|
||||||
Self::ThirdPartyId { address, medium } => {
|
Self::ThirdPartyId { address, medium } => {
|
||||||
UserIdentifier::ThirdPartyId { address, medium: medium.clone() }
|
UserIdentifier::ThirdPartyId { address, medium: medium.clone() }
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ use serde::Serialize;
|
|||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
pub(crate) enum UserIdentifier<'a> {
|
pub(crate) enum UserIdentifier<'a> {
|
||||||
#[serde(rename = "m.id.user")]
|
#[serde(rename = "m.id.user")]
|
||||||
MatrixId { user: &'a str },
|
UserIdOrLocalpart { user: &'a str },
|
||||||
#[serde(rename = "m.id.thirdparty")]
|
#[serde(rename = "m.id.thirdparty")]
|
||||||
ThirdPartyId { medium: Medium, address: &'a str },
|
ThirdPartyId { medium: Medium, address: &'a str },
|
||||||
#[serde(rename = "m.id.phone")]
|
#[serde(rename = "m.id.phone")]
|
||||||
@ -25,7 +25,7 @@ impl<'a> From<super::UserIdentifier<'a>> for UserIdentifier<'a> {
|
|||||||
use super::UserIdentifier as SuperId;
|
use super::UserIdentifier as SuperId;
|
||||||
|
|
||||||
match id {
|
match id {
|
||||||
SuperId::MatrixId(user) => SerdeId::MatrixId { user },
|
SuperId::UserIdOrLocalpart(user) => SerdeId::UserIdOrLocalpart { user },
|
||||||
SuperId::ThirdPartyId { address, medium } => SerdeId::ThirdPartyId { address, medium },
|
SuperId::ThirdPartyId { address, medium } => SerdeId::ThirdPartyId { address, medium },
|
||||||
SuperId::PhoneNumber { country, phone } => SerdeId::PhoneNumber { country, phone },
|
SuperId::PhoneNumber { country, phone } => SerdeId::PhoneNumber { country, phone },
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ impl From<IncomingUserIdentifier> for super::IncomingUserIdentifier {
|
|||||||
use super::IncomingUserIdentifier as SuperId;
|
use super::IncomingUserIdentifier as SuperId;
|
||||||
|
|
||||||
match id {
|
match id {
|
||||||
SerdeId::MatrixId { user } => SuperId::MatrixId(user),
|
SerdeId::UserIdOrLocalpart { user } => SuperId::UserIdOrLocalpart(user),
|
||||||
SerdeId::ThirdPartyId { address, medium } => SuperId::ThirdPartyId { address, medium },
|
SerdeId::ThirdPartyId { address, medium } => SuperId::ThirdPartyId { address, medium },
|
||||||
SerdeId::PhoneNumber { country, phone } => SuperId::PhoneNumber { country, phone },
|
SerdeId::PhoneNumber { country, phone } => SuperId::PhoneNumber { country, phone },
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ fn deserialize_user_identifier() {
|
|||||||
"user": "cheeky_monkey"
|
"user": "cheeky_monkey"
|
||||||
}))
|
}))
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
IncomingUserIdentifier::MatrixId(id)
|
IncomingUserIdentifier::UserIdOrLocalpart(id)
|
||||||
if id == "cheeky_monkey"
|
if id == "cheeky_monkey"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ impl<C: HttpClient> Client<C> {
|
|||||||
) -> Result<login::v3::Response, Error<C::Error, ruma_client_api::Error>> {
|
) -> Result<login::v3::Response, Error<C::Error, ruma_client_api::Error>> {
|
||||||
let response = self
|
let response = self
|
||||||
.send_request(assign!(login::v3::Request::new(
|
.send_request(assign!(login::v3::Request::new(
|
||||||
LoginInfo::Password(login::v3::Password::new(UserIdentifier::MatrixId(user), password))), {
|
LoginInfo::Password(login::v3::Password::new(UserIdentifier::UserIdOrLocalpart(user), password))), {
|
||||||
device_id,
|
device_id,
|
||||||
initial_device_display_name,
|
initial_device_display_name,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user