diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e49bf58..f5ba26a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ Improvements: * Add `r0::capabilities::get_capabilities` (introduced in r0.5.0) * Add `r0::keys` endpoints (introduced in r0.3.0) * Add `r0::session::get_login_types` (introduced in r0.4.0) +* Add `r0::account::get_username_availability` (introduced in r0.4.0) # 0.5.0 diff --git a/src/r0/account.rs b/src/r0/account.rs index c1507fa9..6dee7f72 100644 --- a/src/r0/account.rs +++ b/src/r0/account.rs @@ -2,6 +2,7 @@ pub mod change_password; pub mod deactivate; +pub mod get_username_availability; pub mod register; pub mod request_password_change_token; pub mod request_register_token; diff --git a/src/r0/account/get_username_availability.rs b/src/r0/account/get_username_availability.rs new file mode 100644 index 00000000..c2fc34ff --- /dev/null +++ b/src/r0/account/get_username_availability.rs @@ -0,0 +1,26 @@ +//! [GET /_matrix/client/r0/register/available](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-register-available) + +use ruma_api::ruma_api; + +ruma_api! { + metadata { + description: "Checks to see if a username is available, and valid, for the server.", + method: GET, + name: "get_username_availability", + path: "/_matrix/client/r0/register/available", + rate_limited: true, + requires_authentication: false, + } + + request { + /// The username to check the availability of. + #[ruma_api(query)] + pub username: String, + } + + response { + /// A flag to indicate that the username is available. + /// This should always be true when the server replies with 200 OK. + pub available: bool + } +}