From c4550208021f6c1cd445d399926514f90b251724 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Fri, 29 Nov 2019 00:27:25 +0100 Subject: [PATCH] Update r0::account::change_password to r0.6.0 --- CHANGELOG.md | 3 +++ src/r0/account.rs | 12 ++++++++++++ src/r0/account/change_password.rs | 7 +++++-- src/r0/account/register.rs | 12 ++---------- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25140c88..0553d0e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Breaking changes: * Move `r0::directory::get_public_rooms::PublicRoomsChunk` to `r0::directory::PublicRoomsChunk` * Move `r0::room::create_room::Visibility` to `r0::room::Visibility` * Our Minimum Supported Rust Version is now 1.36.0 +* Move `r0::account::register::AuthenticationData` to `r0::account::AuthenticationData` Improvements: @@ -13,3 +14,5 @@ Improvements: * Add `filter` optional parameter to `r0::sync::get_message_events` (introduced upstream in r0.3.0) * Add `r0::appservice::set_room_visibility` (part of application service extensions for the client-server API) * Add `contains_url` to `r0::filter::RoomEventFilter` (introduced upstream in r0.3.0) +* Update `r0::account::change_password` from r0.3.0 to r0.6.0 + * Add optional `auth` field diff --git a/src/r0/account.rs b/src/r0/account.rs index d33db981..c1507fa9 100644 --- a/src/r0/account.rs +++ b/src/r0/account.rs @@ -6,3 +6,15 @@ pub mod register; pub mod request_password_change_token; pub mod request_register_token; pub mod whoami; + +use serde::{Deserialize, Serialize}; + +/// Additional authentication information for the user-interactive authentication API. +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct AuthenticationData { + /// The login type that the client is attempting to complete. + #[serde(rename = "type")] + kind: String, + /// The value of the session key given by the homeserver. + session: Option, +} diff --git a/src/r0/account/change_password.rs b/src/r0/account/change_password.rs index eb8a074d..96989561 100644 --- a/src/r0/account/change_password.rs +++ b/src/r0/account/change_password.rs @@ -1,7 +1,9 @@ -//! [POST /_matrix/client/r0/account/password](https://matrix.org/docs/spec/client_server/r0.4.0.html#post-matrix-client-r0-account-password) +//! [POST /_matrix/client/r0/account/password](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-account-password) use ruma_api::ruma_api; +use super::AuthenticationData; + ruma_api! { metadata { description: "Change the password of the current user's account.", @@ -15,7 +17,8 @@ ruma_api! { request { /// The new password for the account. pub new_password: String, - // TODO: missing `auth` field + /// Additional authentication information for the user-interactive authentication API. + pub auth: Option, } response {} diff --git a/src/r0/account/register.rs b/src/r0/account/register.rs index 64c71d66..7c06297b 100644 --- a/src/r0/account/register.rs +++ b/src/r0/account/register.rs @@ -4,6 +4,8 @@ use ruma_api::ruma_api; use ruma_identifiers::UserId; use serde::{Deserialize, Serialize}; +use super::AuthenticationData; + ruma_api! { metadata { description: "Register an account on this homeserver.", @@ -73,16 +75,6 @@ ruma_api! { } } -/// Additional authentication information for the user-interactive authentication API. -#[derive(Clone, Debug, Deserialize, Serialize)] -pub struct AuthenticationData { - /// The login type that the client is attempting to complete. - #[serde(rename = "type")] - kind: String, - /// The value of the session key given by the homeserver. - session: Option, -} - /// The kind of account being registered. #[derive(Copy, Clone, Debug, Deserialize, Serialize)] #[serde(rename_all = "snake_case")]