Fix r0::session::get_login_types::Response
The previous version was expecting one level of nesting too many, i.e.: {"type": {"type": "m.login.password"}} This is a breaking change, so bump the version number too.
This commit is contained in:
parent
45b64aabf5
commit
1c2ab9e768
@ -1,5 +1,9 @@
|
||||
# [unreleased]
|
||||
|
||||
Breaking changes:
|
||||
|
||||
* Fix `r0::session::get_login_types`
|
||||
|
||||
# 0.6.0
|
||||
|
||||
Breaking changes:
|
||||
|
@ -17,19 +17,11 @@ ruma_api! {
|
||||
|
||||
response {
|
||||
/// The homeserver's supported login types.
|
||||
pub flows: Vec<LoginFlow>
|
||||
pub flows: Vec<LoginType>
|
||||
}
|
||||
}
|
||||
|
||||
/// A supported login type in a homeserver
|
||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
||||
pub struct LoginFlow {
|
||||
/// The login type.
|
||||
#[serde(rename = "type")]
|
||||
pub login_type: LoginType,
|
||||
}
|
||||
|
||||
/// The authentication mechanism.
|
||||
/// An authentication mechanism.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize, Serialize)]
|
||||
#[serde(tag = "type")]
|
||||
pub enum LoginType {
|
||||
@ -40,3 +32,16 @@ pub enum LoginType {
|
||||
#[serde(rename = "m.login.token")]
|
||||
Token,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::LoginType;
|
||||
|
||||
#[test]
|
||||
fn deserialize_login_type() {
|
||||
assert_eq!(
|
||||
serde_json::from_str::<LoginType>(r#" {"type": "m.login.password"} "#).unwrap(),
|
||||
LoginType::Password,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user