client-api: Break up the ill-named contacts module

This commit is contained in:
Jonas Platte 2021-11-09 11:41:21 +01:00
parent ac6ecc3e5e
commit a9ecd7f397
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
6 changed files with 6 additions and 76 deletions

View File

@ -9,6 +9,10 @@ Breaking changes:
* `LoginInfo` no longer implements `PartialEq` and `Eq` due to the custom variant that was added.
* `LoginInfo` converted to newtype variants.
* Use `Raw` for `create_room::Request::creation_content`
* Delete `r0::contact` module
* `request_contact_verification_token` was an out-of-date duplicate of
`r0::account::request_3pid_management_token_via_email`
* `get_contacts` has been can now be found at `r0::account::get_3pids`
Improvements:

View File

@ -7,7 +7,6 @@ pub mod appservice;
pub mod backup;
pub mod capabilities;
pub mod config;
pub mod contact;
pub mod context;
pub mod device;
pub mod directory;

View File

@ -5,6 +5,7 @@ pub mod bind_3pid;
pub mod change_password;
pub mod deactivate;
pub mod delete_3pid;
pub mod get_3pids;
pub mod get_username_availability;
pub mod register;
pub mod request_3pid_management_token_via_email;

View File

@ -7,7 +7,7 @@ ruma_api! {
metadata: {
description: "Get a list of 3rd party contacts associated with the user's account.",
method: GET,
name: "get_contacts",
name: "get_3pids",
path: "/_matrix/client/r0/account/3pid",
rate_limited: false,
authentication: AccessToken,

View File

@ -1,4 +0,0 @@
//! Endpoints for account contact information.
pub mod get_contacts;
pub mod request_contact_verification_token;

View File

@ -1,70 +0,0 @@
//! [POST /_matrix/client/r0/account/3pid/email/requestToken](https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-account-3pid-email-requesttoken)
use js_int::UInt;
use ruma_api::ruma_api;
use ruma_identifiers::ClientSecret;
ruma_api! {
metadata: {
description: "Ask for a verification token for a given 3rd party ID.",
method: POST,
name: "request_contact_verification_token",
path: "/_matrix/client/r0/account/3pid/email/requestToken",
rate_limited: false,
authentication: None,
}
request: {
/// Client-generated secret string used to protect this session.
pub client_secret: &'a ClientSecret,
/// The email address.
pub email: &'a str,
/// Used to distinguish protocol level retries from requests to re-send
/// the email.
pub send_attempt: UInt,
/// A URL for the identity server to redirect the user to after
/// validation is completed.
#[serde(skip_serializing_if = "Option::is_none")]
pub next_link: Option<&'a str>,
/// The identity server to send the onward request to as a hostname with
/// an appended colon and port number if the port is not the default.
#[serde(skip_serializing_if = "Option::is_none")]
pub id_server: Option<&'a str>,
/// An access token previously registered with the identity server.
///
/// Required if an `id_server` is supplied.
#[serde(skip_serializing_if = "Option::is_none")]
pub id_access_token: Option<&'a str>,
}
#[derive(Default)]
response: {}
error: crate::Error
}
impl<'a> Request<'a> {
/// Creates a new `Request` with the given client secret, email and send-attempt counter.
pub fn new(client_secret: &'a ClientSecret, email: &'a str, send_attempt: UInt) -> Self {
Self {
client_secret,
email,
send_attempt,
next_link: None,
id_server: None,
id_access_token: None,
}
}
}
impl Response {
/// Creates an empty `Response`.
pub fn new() -> Self {
Self {}
}
}