From fc626d08694bd1f81d8543ee5b77e464b06207bf Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Tue, 5 May 2020 00:41:51 +0200 Subject: [PATCH] Whitespace and comment wrapping adjustments --- src/error.rs | 32 +++++++++++++++++++ src/r0/account.rs | 2 ++ src/r0/account/add_3pid.rs | 3 +- src/r0/account/bind_3pid.rs | 2 ++ src/r0/account/change_password.rs | 1 + src/r0/account/deactivate.rs | 1 + src/r0/account/delete_3pid.rs | 2 ++ src/r0/account/register.rs | 9 ++++++ ...request_3pid_management_token_via_email.rs | 5 +++ ...equest_3pid_management_token_via_msisdn.rs | 6 ++++ src/r0/account/request_openid_token.rs | 3 ++ ...request_password_change_token_via_email.rs | 5 +++ ...equest_password_change_token_via_msisdn.rs | 5 +++ .../request_registration_token_via_email.rs | 5 +++ .../request_registration_token_via_msisdn.rs | 6 ++++ src/r0/account/unbind_3pid.rs | 2 ++ src/r0/alias/create_alias.rs | 1 + src/r0/alias/get_alias.rs | 1 + src/r0/appservice/set_room_visibility.rs | 2 ++ src/r0/config/get_global_account_data.rs | 1 + src/r0/config/get_room_account_data.rs | 2 ++ src/r0/contact/get_contacts.rs | 3 ++ src/r0/device.rs | 3 ++ src/r0/device/delete_device.rs | 1 + src/r0/device/update_device.rs | 1 + src/r0/directory.rs | 8 +++++ src/r0/directory/get_public_rooms.rs | 5 +++ src/r0/directory/get_public_rooms_filtered.rs | 9 ++++++ src/r0/filter.rs | 20 ++++++++++++ src/r0/keys.rs | 7 ++++ src/r0/keys/get_keys.rs | 20 +++++++----- src/r0/media/get_content.rs | 4 +++ src/r0/media/get_content_as_filename.rs | 5 +++ src/r0/media/get_content_thumbnail.rs | 7 ++++ src/r0/media/get_media_preview.rs | 1 + src/r0/membership.rs | 3 ++ src/r0/membership/get_member_events.rs | 3 ++ src/r0/membership/invite_user.rs | 2 ++ src/r0/membership/joined_members.rs | 1 + src/r0/message/get_message_events.rs | 9 ++++++ src/r0/presence/get_presence.rs | 3 ++ src/r0/push.rs | 1 + src/r0/room.rs | 1 + src/r0/room/create_room.rs | 15 +++++++++ src/r0/room/get_room_event.rs | 1 + src/r0/room/report_content.rs | 3 ++ src/r0/room/upgrade_room.rs | 1 + src/r0/search/search_events.rs | 11 +++++++ src/r0/session/get_login_types.rs | 1 + src/r0/session/login.rs | 13 ++++++++ src/r0/sync/sync_events.rs | 28 ++++++++++++++++ src/r0/thirdparty.rs | 13 ++++++++ .../thirdparty/get_location_for_protocol.rs | 1 + src/r0/thirdparty/get_user_for_protocol.rs | 1 + src/r0/to_device.rs | 1 + src/r0/to_device/send_event_to_device.rs | 2 ++ src/r0/uiaa.rs | 8 +++++ src/r0/user_directory/search_users.rs | 4 +++ src/unversioned/get_supported_versions.rs | 1 + 59 files changed, 308 insertions(+), 9 deletions(-) diff --git a/src/error.rs b/src/error.rs index 102467ce..fb939caa 100644 --- a/src/error.rs +++ b/src/error.rs @@ -16,118 +16,147 @@ pub enum ErrorKind { #[serde(rename = "M_FORBIDDEN")] #[strum(to_string = "M_FORBIDDEN")] Forbidden, + /// M_UNKNOWN_TOKEN #[serde(rename = "M_UNKNOWN_TOKEN")] #[strum(to_string = "M_UNKNOWN_TOKEN")] UnknownToken, + /// M_MISSING_TOKEN #[serde(rename = "M_MISSING_TOKEN")] #[strum(to_string = "M_MISSING_TOKEN")] MissingToken, + /// M_BAD_JSON #[serde(rename = "M_BAD_JSON")] #[strum(to_string = "M_BAD_JSON")] BadJson, + /// M_NOT_JSON #[serde(rename = "M_NOT_JSON")] #[strum(to_string = "M_NOT_JSON")] NotJson, + /// M_NOT_FOUND #[serde(rename = "M_NOT_FOUND")] #[strum(to_string = "M_NOT_FOUND")] NotFound, + /// M_LIMIT_EXCEEDED #[serde(rename = "M_LIMIT_EXCEEDED")] #[strum(to_string = "M_LIMIT_EXCEEDED")] LimitExceeded, + /// M_UNKNOWN #[serde(rename = "M_UNKNOWN")] #[strum(to_string = "M_UNKNOWN")] Unknown, + /// M_UNRECOGNIZED #[serde(rename = "M_UNRECOGNIZED")] #[strum(to_string = "M_UNRECOGNIZED")] Unrecognized, + /// M_UNAUTHORIZED #[serde(rename = "M_UNAUTHORIZED")] #[strum(to_string = "M_UNAUTHORIZED")] Unauthorized, + /// M_USER_DEACTIVATED #[serde(rename = "M_USER_DEACTIVATED")] #[strum(to_string = "M_USER_DEACTIVATED")] UserDeactivated, + /// M_USER_IN_USE #[serde(rename = "M_USER_IN_USE")] #[strum(to_string = "M_USER_IN_USE")] UserInUse, + /// M_INVALID_USERNAME #[serde(rename = "M_INVALID_USERNAME")] #[strum(to_string = "M_INVALID_USERNAME")] InvalidUsername, + /// M_ROOM_IN_USE #[serde(rename = "M_ROOM_IN_USE")] #[strum(to_string = "M_ROOM_IN_USE")] RoomInUse, + /// M_INVALID_ROOM_STATE #[serde(rename = "M_INVALID_ROOM_STATE")] #[strum(to_string = "M_INVALID_ROOM_STATE")] InvalidRoomState, + /// M_THREEPID_IN_USE #[serde(rename = "M_THREEPID_IN_USE")] #[strum(to_string = "M_THREEPID_IN_USE")] ThreepidInUse, + /// M_THREEPID_NOT_FOUND #[serde(rename = "M_THREEPID_NOT_FOUND")] #[strum(to_string = "M_THREEPID_NOT_FOUND")] ThreepidNotFound, + /// M_THREEPID_AUTH_FAILED #[serde(rename = "M_THREEPID_AUTH_FAILED")] #[strum(to_string = "M_THREEPID_AUTH_FAILED")] ThreepidAuthFailed, + /// M_THREEPID_DENIED #[serde(rename = "M_THREEPID_DENIED")] #[strum(to_string = "M_THREEPID_DENIED")] ThreepidDenied, + /// M_SERVER_NOT_TRUSTED #[serde(rename = "M_SERVER_NOT_TRUSTED")] #[strum(to_string = "M_SERVER_NOT_TRUSTED")] ServerNotTrusted, + /// M_UNSUPPORTED_ROOM_VERSION #[serde(rename = "M_UNSUPPORTED_ROOM_VERSION")] #[strum(to_string = "M_UNSUPPORTED_ROOM_VERSION")] UnsupportedRoomVersion, + /// M_INCOMPATIBLE_ROOM_VERSION #[serde(rename = "M_INCOMPATIBLE_ROOM_VERSION")] #[strum(to_string = "M_INCOMPATIBLE_ROOM_VERSION")] IncompatibleRoomVersion, + /// M_BAD_STATE #[serde(rename = "M_BAD_STATE")] #[strum(to_string = "M_BAD_STATE")] BadState, + /// M_GUEST_ACCESS_FORBIDDEN #[serde(rename = "M_GUEST_ACCESS_FORBIDDEN")] #[strum(to_string = "M_GUEST_ACCESS_FORBIDDEN")] GuestAccessForbidden, + /// M_CAPTCHA_NEEDED #[serde(rename = "M_CAPTCHA_NEEDED")] #[strum(to_string = "M_CAPTCHA_NEEDED")] CaptchaNeeded, + /// M_CAPTCHA_INVALID #[serde(rename = "M_CAPTCHA_INVALID")] #[strum(to_string = "M_CAPTCHA_INVALID")] CaptchaInvalid, + /// M_MISSING_PARAM #[serde(rename = "M_MISSING_PARAM")] #[strum(to_string = "M_MISSING_PARAM")] MissingParam, + /// M_INVALID_PARAM #[serde(rename = "M_INVALID_PARAM")] #[strum(to_string = "M_INVALID_PARAM")] InvalidParam, + /// M_TOO_LARGE #[serde(rename = "M_TOO_LARGE")] #[strum(to_string = "M_TOO_LARGE")] TooLarge, + /// M_EXCLUSIVE #[serde(rename = "M_EXCLUSIVE")] #[strum(to_string = "M_EXCLUSIVE")] @@ -141,6 +170,7 @@ pub struct ErrorBody { /// A value which can be used to handle an error message #[serde(flatten)] pub kind: ErrorKind, + /// A human-readable error message, usually a sentence explaining what went wrong. #[serde(rename = "error")] pub message: String, @@ -151,8 +181,10 @@ pub struct ErrorBody { pub struct Error { /// A value which can be used to handle an error message pub kind: ErrorKind, + /// A human-readable error message, usually a sentence explaining what went wrong. pub message: String, + /// The http status code pub status_code: http::StatusCode, } diff --git a/src/r0/account.rs b/src/r0/account.rs index c015ab2f..f1a70ac8 100644 --- a/src/r0/account.rs +++ b/src/r0/account.rs @@ -25,6 +25,7 @@ pub struct IdentityServerInfo { /// The ID server to send the onward request to as a hostname with an /// appended colon and port number if the port is not the default. pub id_server: String, + /// Access token previously registered with identity server. pub id_access_token: String, } @@ -36,6 +37,7 @@ pub enum ThirdPartyIdRemovalStatus { /// Either the homeserver couldn't determine the right identity server to contact, or the /// identity server refused the operation. NoSupport, + /// Success. Success, } diff --git a/src/r0/account/add_3pid.rs b/src/r0/account/add_3pid.rs index adef2d45..44b663b2 100644 --- a/src/r0/account/add_3pid.rs +++ b/src/r0/account/add_3pid.rs @@ -18,8 +18,10 @@ ruma_api! { /// Additional information for the User-Interactive Authentication API. #[serde(skip_serializing_if = "Option::is_none")] pub auth: Option, + /// Client-generated secret string used to protect this session. pub client_secret: String, + /// The session identifier given by the identity server. pub sid: String, } @@ -28,4 +30,3 @@ ruma_api! { error: UiaaResponse } - diff --git a/src/r0/account/bind_3pid.rs b/src/r0/account/bind_3pid.rs index 81bd7c46..d13c31b2 100644 --- a/src/r0/account/bind_3pid.rs +++ b/src/r0/account/bind_3pid.rs @@ -17,10 +17,12 @@ ruma_api! { request { /// Client-generated secret string used to protect this session. pub client_secret: String, + /// The ID 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(flatten)] pub identity_server_info: IdentityServerInfo, + /// The session identifier given by the identity server. pub sid: String, } diff --git a/src/r0/account/change_password.rs b/src/r0/account/change_password.rs index 6eb5f045..8a4223d1 100644 --- a/src/r0/account/change_password.rs +++ b/src/r0/account/change_password.rs @@ -17,6 +17,7 @@ ruma_api! { request { /// The new password for the account. pub new_password: String, + /// Additional authentication information for the user-interactive authentication API. pub auth: Option, } diff --git a/src/r0/account/deactivate.rs b/src/r0/account/deactivate.rs index 5a21a071..6a1a7fd7 100644 --- a/src/r0/account/deactivate.rs +++ b/src/r0/account/deactivate.rs @@ -20,6 +20,7 @@ ruma_api! { /// Additional authentication information for the user-interactive authentication API. #[serde(skip_serializing_if = "Option::is_none")] pub auth: Option, + /// Identity server from which to unbind the user's third party /// identifier. #[serde(skip_serializing_if = "Option::is_none")] diff --git a/src/r0/account/delete_3pid.rs b/src/r0/account/delete_3pid.rs index ad95fd7b..3138cdb5 100644 --- a/src/r0/account/delete_3pid.rs +++ b/src/r0/account/delete_3pid.rs @@ -19,8 +19,10 @@ ruma_api! { /// Identity server to delete from. #[serde(skip_serializing_if = "Option::is_none")] pub id_server: Option, + /// Medium of the 3PID to be removed. pub medium: Medium, + /// Third-party address being removed. pub address: String, } diff --git a/src/r0/account/register.rs b/src/r0/account/register.rs index 27046397..1c14e99a 100644 --- a/src/r0/account/register.rs +++ b/src/r0/account/register.rs @@ -23,22 +23,26 @@ ruma_api! { /// with a password, e.g., for guest or application service accounts. #[serde(skip_serializing_if = "Option::is_none")] pub password: Option, + /// local part of the desired Matrix ID. /// /// If omitted, the homeserver MUST generate a Matrix ID local part. #[serde(skip_serializing_if = "Option::is_none")] pub username: Option, + /// ID of the client device. /// /// If this does not correspond to a known client device, a new device will be created. /// The server will auto-generate a device_id if this is not specified. #[serde(skip_serializing_if = "Option::is_none")] pub device_id: Option, + /// A display name to assign to the newly-created device. /// /// Ignored if `device_id` corresponds to a known device. #[serde(skip_serializing_if = "Option::is_none")] pub initial_device_display_name: Option, + /// Additional authentication information for the user-interactive authentication API. /// /// Note that this information is not used to define how the registered user should be @@ -47,12 +51,14 @@ ruma_api! { /// with status code 401. #[serde(skip_serializing_if = "Option::is_none")] pub auth: Option, + /// Kind of account to register /// /// Defaults to `User` if omitted. #[ruma_api(query)] #[serde(skip_serializing_if = "Option::is_none")] pub kind: Option, + /// If `true`, an `access_token` and `device_id` should not be returned /// from this call, therefore preventing an automatic login. #[serde(default, skip_serializing_if = "ruma_serde::is_default")] @@ -65,8 +71,10 @@ ruma_api! { /// This access token can then be used to authorize other requests. #[serde(skip_serializing_if = "Option::is_none")] pub access_token: Option, + /// The fully-qualified Matrix ID that has been registered. pub user_id: UserId, + /// ID of the registered device. /// /// Will be the same as the corresponding parameter in the request, if one was specified. @@ -84,6 +92,7 @@ pub enum RegistrationKind { /// /// These accounts may have limited permissions and may not be supported by all servers. Guest, + /// A regular user account User, } diff --git a/src/r0/account/request_3pid_management_token_via_email.rs b/src/r0/account/request_3pid_management_token_via_email.rs index dc6ceb7e..3042225b 100644 --- a/src/r0/account/request_3pid_management_token_via_email.rs +++ b/src/r0/account/request_3pid_management_token_via_email.rs @@ -18,13 +18,17 @@ ruma_api! { request { /// Client-generated secret string used to protect this session. pub client_secret: String, + /// The email address. pub email: String, + /// Used to distinguish protocol level retries from requests to re-send the email. pub send_attempt: UInt, + /// Return URL for identity server to redirect the client back to. #[serde(skip_serializing_if = "Option::is_none")] pub next_link: Option, + /// Optional identity server hostname and access token. Deprecated since r0.6.0. #[serde(flatten)] #[serde(skip_serializing_if = "Option::is_none")] @@ -34,6 +38,7 @@ ruma_api! { response { /// The session identifier given by the identity server. pub sid: String, + /// URL to submit validation token to. If omitted, verification happens without client. #[serde(skip_serializing_if = "Option::is_none")] pub submit_url: Option diff --git a/src/r0/account/request_3pid_management_token_via_msisdn.rs b/src/r0/account/request_3pid_management_token_via_msisdn.rs index f7e04125..21ce58af 100644 --- a/src/r0/account/request_3pid_management_token_via_msisdn.rs +++ b/src/r0/account/request_3pid_management_token_via_msisdn.rs @@ -18,15 +18,20 @@ ruma_api! { request { /// Client-generated secret string used to protect this session. pub client_secret: String, + /// Two-letter ISO 3166 country code for the phone number. pub country: String, + /// Phone number to validate. pub phone_number: String, + /// Used to distinguish protocol level retries from requests to re-send the SMS. pub send_attempt: UInt, + /// Return URL for identity server to redirect the client back to. #[serde(skip_serializing_if = "Option::is_none")] pub next_link: Option, + /// Optional identity server hostname and access token. Deprecated since r0.6.0. #[serde(flatten)] #[serde(skip_serializing_if = "Option::is_none")] @@ -36,6 +41,7 @@ ruma_api! { response { /// The session identifier given by the identity server. pub sid: String, + /// URL to submit validation token to. If omitted, verification happens without client. #[serde(skip_serializing_if = "Option::is_none")] pub submit_url: Option diff --git a/src/r0/account/request_openid_token.rs b/src/r0/account/request_openid_token.rs index ee5166d5..94107189 100644 --- a/src/r0/account/request_openid_token.rs +++ b/src/r0/account/request_openid_token.rs @@ -25,10 +25,13 @@ ruma_api! { response { /// Access token for verifying user's identity. pub access_token: String, + /// Access token type. pub token_type: TokenType, + /// Homeserver domain for verification of user's identity. pub matrix_server_name: String, + /// Seconds until token expiration. #[serde(with = "ruma_serde::duration::secs")] pub expires_in: Duration, diff --git a/src/r0/account/request_password_change_token_via_email.rs b/src/r0/account/request_password_change_token_via_email.rs index ae7096c6..1fd70ae3 100644 --- a/src/r0/account/request_password_change_token_via_email.rs +++ b/src/r0/account/request_password_change_token_via_email.rs @@ -18,13 +18,17 @@ ruma_api! { request { /// Client-generated secret string used to protect this session. pub client_secret: String, + /// The email address. pub email: String, + /// Used to distinguish protocol level retries from requests to re-send the email. pub send_attempt: UInt, + /// Return URL for identity server to redirect the client back to. #[serde(skip_serializing_if = "Option::is_none")] pub next_link: Option, + /// Optional identity server hostname and access token. Deprecated since r0.6.0. #[serde(flatten)] #[serde(skip_serializing_if = "Option::is_none")] @@ -34,6 +38,7 @@ ruma_api! { response { /// The session identifier given by the identity server. pub sid: String, + /// URL to submit validation token to. If omitted, verification happens without client. #[serde(skip_serializing_if = "Option::is_none")] pub submit_url: Option diff --git a/src/r0/account/request_password_change_token_via_msisdn.rs b/src/r0/account/request_password_change_token_via_msisdn.rs index 40f865a7..54b22a4b 100644 --- a/src/r0/account/request_password_change_token_via_msisdn.rs +++ b/src/r0/account/request_password_change_token_via_msisdn.rs @@ -16,12 +16,16 @@ ruma_api! { request { /// Client-generated secret string used to protect this session. pub client_secret: String, + /// Two-letter ISO 3166 country code for the phone number. pub country: String, + /// Phone number to validate. pub phone_number: String, + /// Used to distinguish protocol level retries from requests to re-send the SMS. pub send_attempt: UInt, + /// Return URL for identity server to redirect the client back to. #[serde(skip_serializing_if = "Option::is_none")] pub next_link: Option, @@ -30,6 +34,7 @@ ruma_api! { response { /// The session identifier given by the identity server. pub sid: String, + /// URL to submit validation token to. If omitted, verification happens without client. #[serde(skip_serializing_if = "Option::is_none")] pub submit_url: Option diff --git a/src/r0/account/request_registration_token_via_email.rs b/src/r0/account/request_registration_token_via_email.rs index 38468bfd..dc1c4cd0 100644 --- a/src/r0/account/request_registration_token_via_email.rs +++ b/src/r0/account/request_registration_token_via_email.rs @@ -18,13 +18,17 @@ ruma_api! { request { /// Client-generated secret string used to protect this session. pub client_secret: String, + /// The email address. pub email: String, + /// Used to distinguish protocol level retries from requests to re-send the email. pub send_attempt: UInt, + /// Return URL for identity server to redirect the client back to. #[serde(skip_serializing_if = "Option::is_none")] pub next_link: Option, + /// Optional identity server hostname and access token. Deprecated since r0.6.0. #[serde(flatten)] #[serde(skip_serializing_if = "Option::is_none")] @@ -34,6 +38,7 @@ ruma_api! { response { /// The session identifier given by the identity server. pub sid: String, + /// URL to submit validation token to. If omitted, verification happens without client. #[serde(skip_serializing_if = "Option::is_none")] pub submit_url: Option diff --git a/src/r0/account/request_registration_token_via_msisdn.rs b/src/r0/account/request_registration_token_via_msisdn.rs index cce91ba7..89dac820 100644 --- a/src/r0/account/request_registration_token_via_msisdn.rs +++ b/src/r0/account/request_registration_token_via_msisdn.rs @@ -18,15 +18,20 @@ ruma_api! { request { /// Client-generated secret string used to protect this session. pub client_secret: String, + /// Two-letter ISO 3166 country code for the phone number. pub country: String, + /// Phone number to validate. pub phone_number: String, + /// Return URL for identity server to redirect the client back to. #[serde(skip_serializing_if = "Option::is_none")] pub next_link: Option, + /// Used to distinguish protocol level retries from requests to re-send the SMS. pub send_attempt: UInt, + /// Optional identity server hostname and access token. Deprecated since r0.6.0. #[serde(flatten)] #[serde(skip_serializing_if = "Option::is_none")] @@ -36,6 +41,7 @@ ruma_api! { response { /// The session identifier given by the identity server. pub sid: String, + /// URL to submit validation token to. If omitted, verification happens without client. #[serde(skip_serializing_if = "Option::is_none")] pub submit_url: Option diff --git a/src/r0/account/unbind_3pid.rs b/src/r0/account/unbind_3pid.rs index fec859cb..8bdd7098 100644 --- a/src/r0/account/unbind_3pid.rs +++ b/src/r0/account/unbind_3pid.rs @@ -19,8 +19,10 @@ ruma_api! { /// Identity server to unbind from. #[serde(skip_serializing_if = "Option::is_none")] pub id_server: Option, + /// Medium of the 3PID to be removed. pub medium: Medium, + /// Third-party address being removed. pub address: String, } diff --git a/src/r0/alias/create_alias.rs b/src/r0/alias/create_alias.rs index 9770d22e..0c84c30c 100644 --- a/src/r0/alias/create_alias.rs +++ b/src/r0/alias/create_alias.rs @@ -17,6 +17,7 @@ ruma_api! { /// The room alias to set. #[ruma_api(path)] pub room_alias: RoomAliasId, + /// The room ID to set. pub room_id: RoomId, } diff --git a/src/r0/alias/get_alias.rs b/src/r0/alias/get_alias.rs index 00ec2100..8e462a7c 100644 --- a/src/r0/alias/get_alias.rs +++ b/src/r0/alias/get_alias.rs @@ -22,6 +22,7 @@ ruma_api! { response { /// The room ID for this room alias. pub room_id: RoomId, + /// A list of servers that are aware of this room ID. pub servers: Vec, } diff --git a/src/r0/appservice/set_room_visibility.rs b/src/r0/appservice/set_room_visibility.rs index 5df0c5d7..f819e762 100644 --- a/src/r0/appservice/set_room_visibility.rs +++ b/src/r0/appservice/set_room_visibility.rs @@ -19,9 +19,11 @@ ruma_api! { /// The protocol (network) ID to update the room list for. #[ruma_api(path)] pub network_id: String, + /// The room ID to add to the directory. #[ruma_api(path)] pub room_id: RoomId, + /// Whether the room should be visible (public) in the directory or not (private). pub visibility: Visibility, } diff --git a/src/r0/config/get_global_account_data.rs b/src/r0/config/get_global_account_data.rs index 41cb40f9..d8c1d763 100644 --- a/src/r0/config/get_global_account_data.rs +++ b/src/r0/config/get_global_account_data.rs @@ -18,6 +18,7 @@ ruma_api! { /// User ID of user for whom to retrieve data. #[ruma_api(path)] pub user_id: UserId, + /// Type of data to retrieve. #[ruma_api(path)] pub event_type: String, diff --git a/src/r0/config/get_room_account_data.rs b/src/r0/config/get_room_account_data.rs index 2f7a978e..a2b39600 100644 --- a/src/r0/config/get_room_account_data.rs +++ b/src/r0/config/get_room_account_data.rs @@ -18,9 +18,11 @@ ruma_api! { /// User ID of user for whom to retrieve data. #[ruma_api(path)] pub user_id: UserId, + /// Room ID for which to retrieve data. #[ruma_api(path)] pub room_id: RoomId, + /// Type of data to retrieve. #[ruma_api(path)] pub event_type: String, diff --git a/src/r0/contact/get_contacts.rs b/src/r0/contact/get_contacts.rs index 06834c64..06de18bc 100644 --- a/src/r0/contact/get_contacts.rs +++ b/src/r0/contact/get_contacts.rs @@ -35,11 +35,14 @@ ruma_api! { pub struct ThirdPartyIdentifier { /// The third party identifier address. pub address: String, + /// The medium of third party identifier. pub medium: Medium, + /// The time when the identifier was validated by the identity server. #[serde(with = "ruma_serde::time::ms_since_unix_epoch")] pub validated_at: SystemTime, + /// The time when the homeserver associated the third party identifier with the user. #[serde(with = "ruma_serde::time::ms_since_unix_epoch")] pub added_at: SystemTime, diff --git a/src/r0/device.rs b/src/r0/device.rs index 6e0a8620..0c22c151 100644 --- a/src/r0/device.rs +++ b/src/r0/device.rs @@ -16,10 +16,13 @@ pub mod update_device; pub struct Device { /// Device ID pub device_id: DeviceId, + /// Public display name of the device. pub display_name: Option, + /// Most recently seen IP address of the session. pub ip: Option, + /// Unix timestamp that the session was last active. #[serde( with = "ruma_serde::time::opt_ms_since_unix_epoch", diff --git a/src/r0/device/delete_device.rs b/src/r0/device/delete_device.rs index 2f5f33f0..19a8df30 100644 --- a/src/r0/device/delete_device.rs +++ b/src/r0/device/delete_device.rs @@ -19,6 +19,7 @@ ruma_api! { /// The device to delete. #[ruma_api(path)] pub device_id: DeviceId, + /// Additional authentication information for the user-interactive authentication API. #[serde(skip_serializing_if = "Option::is_none")] pub auth: Option, diff --git a/src/r0/device/update_device.rs b/src/r0/device/update_device.rs index 239dd07d..fdd30d67 100644 --- a/src/r0/device/update_device.rs +++ b/src/r0/device/update_device.rs @@ -17,6 +17,7 @@ ruma_api! { /// The device to update. #[ruma_api(path)] pub device_id: DeviceId, + /// The new display name for this device. If this is `None`, the display name won't be /// changed. #[serde(skip_serializing_if = "Option::is_none")] diff --git a/src/r0/directory.rs b/src/r0/directory.rs index a0bdcc1d..9e8a1099 100644 --- a/src/r0/directory.rs +++ b/src/r0/directory.rs @@ -13,25 +13,33 @@ pub struct PublicRoomsChunk { /// Aliases of the room. #[serde(default, skip_serializing_if = "Vec::is_empty")] pub aliases: Vec, + /// The canonical alias of the room, if any. #[serde(skip_serializing_if = "Option::is_none")] pub canonical_alias: Option, + /// The name of the room, if any. #[serde(skip_serializing_if = "Option::is_none")] pub name: Option, + /// The number of members joined to the room. pub num_joined_members: UInt, + /// The ID of the room. pub room_id: RoomId, + /// The topic of the room, if any. #[serde(skip_serializing_if = "Option::is_none")] pub topic: Option, + /// Whether the room may be viewed by guest users without joining. pub world_readable: bool, + /// Whether guest users may join the room and participate in it. /// /// If they can, they will be subject to ordinary power level rules like any other user. pub guest_can_join: bool, + /// The URL for the room's avatar, if one is set. #[serde(skip_serializing_if = "Option::is_none")] pub avatar_url: Option, diff --git a/src/r0/directory/get_public_rooms.rs b/src/r0/directory/get_public_rooms.rs index c7a54495..edac36b8 100644 --- a/src/r0/directory/get_public_rooms.rs +++ b/src/r0/directory/get_public_rooms.rs @@ -20,10 +20,12 @@ ruma_api! { #[serde(skip_serializing_if = "Option::is_none")] #[ruma_api(query)] pub limit: Option, + /// Pagination token from a previous request. #[serde(skip_serializing_if = "Option::is_none")] #[ruma_api(query)] pub since: Option, + /// The server to fetch the public room lists from. /// /// `None` means the server this request is sent to. @@ -35,10 +37,13 @@ ruma_api! { response { /// A paginated chunk of public rooms. pub chunk: Vec, + /// A pagination token for the response. pub next_batch: Option, + /// A pagination token that allows fetching previous results. pub prev_batch: Option, + /// An estimate on the total number of public rooms, if the server has an estimate. pub total_room_count_estimate: Option, } diff --git a/src/r0/directory/get_public_rooms_filtered.rs b/src/r0/directory/get_public_rooms_filtered.rs index 716df562..9680c55a 100644 --- a/src/r0/directory/get_public_rooms_filtered.rs +++ b/src/r0/directory/get_public_rooms_filtered.rs @@ -31,15 +31,19 @@ ruma_api! { #[serde(skip_serializing_if = "Option::is_none")] #[ruma_api(query)] pub server: Option, + /// Limit for the number of results to return. #[serde(skip_serializing_if = "Option::is_none")] pub limit: Option, + /// Pagination token from a previous request. #[serde(skip_serializing_if = "Option::is_none")] pub since: Option, + /// Filter to apply to the results. #[serde(skip_serializing_if = "Option::is_none")] pub filter: Option, + /// Network to fetch the public room lists from. #[serde(flatten, skip_serializing_if = "ruma_serde::is_default")] pub room_network: RoomNetwork, @@ -48,10 +52,13 @@ ruma_api! { response { /// A paginated chunk of public rooms. pub chunk: Vec, + /// A pagination token for the response. pub next_batch: Option, + /// A pagination token that allows fetching previous results. pub prev_batch: Option, + /// An estimate on the total number of public rooms, if the server has an estimate. pub total_room_count_estimate: Option, } @@ -73,8 +80,10 @@ pub struct Filter { pub enum RoomNetwork { /// Return rooms from the Matrix network. Matrix, + /// Return rooms from all the networks/protocols the homeserver knows about. All, + /// Return rooms from a specific third party network/protocol. ThirdParty(String), } diff --git a/src/r0/filter.rs b/src/r0/filter.rs index 707a1c7b..ae004c32 100644 --- a/src/r0/filter.rs +++ b/src/r0/filter.rs @@ -19,6 +19,7 @@ use serde::{ pub enum EventFormat { /// Client format, as described in the Client API. Client, + /// Raw events from federation. Federation, } @@ -33,43 +34,51 @@ pub struct RoomEventFilter { /// sequence of characters. #[serde(default, skip_serializing_if = "Vec::is_empty")] pub not_types: Vec, + /// A list of room IDs to exclude. /// /// If this list is absent then no rooms are excluded. A matching room will be excluded even if /// it is listed in the 'rooms' filter. #[serde(default, skip_serializing_if = "Vec::is_empty")] pub not_rooms: Vec, + /// The maximum number of events to return. #[serde(skip_serializing_if = "Option::is_none")] pub limit: Option, + /// A list of room IDs to include. /// /// If this list is absent then all rooms are included. #[serde(default, skip_serializing_if = "Option::is_none")] pub rooms: Option>, + /// A list of sender IDs to exclude. /// /// If this list is absent then no senders are excluded. A matching sender will be excluded even /// if it is listed in the 'senders' filter. #[serde(default, skip_serializing_if = "Vec::is_empty")] pub not_senders: Vec, + /// A list of senders IDs to include. /// /// If this list is absent then all senders are included. #[serde(default, skip_serializing_if = "Option::is_none")] pub senders: Option>, + /// A list of event types to include. /// /// If this list is absent then all event types are included. A '*' can be used as a wildcard to /// match any sequence of characters. #[serde(default, skip_serializing_if = "Option::is_none")] pub types: Option>, + /// If `true` include only events with a URL key in their content. /// If `false`, exclude such events. /// /// If this item is absent then all event types are included. #[serde(skip_serializing_if = "Option::is_none")] pub contains_url: Option, + /// Options to control lazy-loading of membership events. #[serde(flatten)] pub lazy_load_options: LazyLoadOptions, @@ -93,19 +102,24 @@ pub struct RoomFilter { /// Defaults to false if not included. #[serde(skip_serializing_if = "Option::is_none")] pub include_leave: Option, + /// The per user account data to include for rooms. #[serde(skip_serializing_if = "Option::is_none")] pub account_data: Option, + /// The message and state update events to include for rooms. #[serde(skip_serializing_if = "Option::is_none")] pub timeline: Option, + /// The events that aren't recorded in the room history, e.g. typing and receipts, to include /// for rooms. #[serde(skip_serializing_if = "Option::is_none")] pub ephemeral: Option, + /// The state events to include for rooms. #[serde(skip_serializing_if = "Option::is_none")] pub state: Option, + /// A list of room IDs to exclude. /// /// If this list is absent then no rooms are excluded. A matching room will be excluded even if @@ -113,6 +127,7 @@ pub struct RoomFilter { /// `ephemeral`, `state`, `timeline` or `account_data`. #[serde(default, skip_serializing_if = "Vec::is_empty")] pub not_rooms: Vec, + /// A list of room IDs to include. /// /// If this list is absent then all rooms are included. This filter is applied before the @@ -141,20 +156,24 @@ pub struct Filter { /// sequence of characters. #[serde(default, skip_serializing_if = "Vec::is_empty")] pub not_types: Vec, + /// The maximum number of events to return. #[serde(skip_serializing_if = "Option::is_none")] pub limit: Option, + /// A list of senders IDs to include. /// /// If this list is absent then all senders are included. #[serde(default, skip_serializing_if = "Option::is_none")] pub senders: Option>, + /// A list of event types to include. /// /// If this list is absent then all event types are included. A '*' can be used as a wildcard to /// match any sequence of characters. #[serde(default, skip_serializing_if = "Option::is_none")] pub types: Option>, + /// A list of sender IDs to exclude. /// /// If this list is absent then no senders are excluded. A matching sender will be excluded even @@ -225,6 +244,7 @@ impl FilterDefinition { pub enum LazyLoadOptions { /// Disables lazy-loading of membership events. Disabled, + /// Enables lazy-loading of events. Enabled { /// If `true`, sends all membership events for all events, even if they have diff --git a/src/r0/keys.rs b/src/r0/keys.rs index 1d14d27d..0d53dea5 100644 --- a/src/r0/keys.rs +++ b/src/r0/keys.rs @@ -111,14 +111,19 @@ impl<'de> Deserialize<'de> for AlgorithmAndDeviceId { pub struct DeviceKeys { /// The ID of the user the device belongs to. Must match the user ID used when logging in. pub user_id: UserId, + /// The ID of the device these keys belong to. Must match the device ID used when logging in. pub device_id: DeviceId, + /// The encryption algorithms supported by this device. pub algorithms: Vec, + /// Public identity keys. pub keys: BTreeMap, + /// Signatures for the device key object. pub signatures: BTreeMap>, + /// Additional data added to the device key information by intermediate servers, and /// not covered by the signatures. #[serde(skip_serializing_if = "Option::is_none")] @@ -137,6 +142,7 @@ pub struct UnsignedDeviceInfo { pub struct SignedKey { /// Base64-encoded 32-byte Curve25519 public key. pub key: String, + /// Signatures for the key object. pub signatures: BTreeMap>, } @@ -147,6 +153,7 @@ pub struct SignedKey { pub enum OneTimeKey { /// A key containing signatures, for the SignedCurve25519 algorithm. SignedKey(SignedKey), + /// A string-valued key, for the Ed25519 and Curve25519 algorithms. Key(String), } diff --git a/src/r0/keys/get_keys.rs b/src/r0/keys/get_keys.rs index 74194f38..a8ec4dd2 100644 --- a/src/r0/keys/get_keys.rs +++ b/src/r0/keys/get_keys.rs @@ -19,8 +19,8 @@ ruma_api! { } request { - /// The time (in milliseconds) to wait when downloading keys from remote servers. - /// 10 seconds is the recommended default. + /// The time (in milliseconds) to wait when downloading keys from remote + /// servers. 10 seconds is the recommended default. #[serde( with = "ruma_serde::duration::opt_ms", default, @@ -28,19 +28,23 @@ ruma_api! { )] pub timeout: Option, - /// The keys to be downloaded. An empty list indicates all devices for the corresponding user. + /// The keys to be downloaded. An empty list indicates all devices for + /// the corresponding user. pub device_keys: BTreeMap>, - /// If the client is fetching keys as a result of a device update received in a sync request, - /// this should be the 'since' token of that sync request, or any later sync token. - /// This allows the server to ensure its response contains the keys advertised by the notification in that sync. + /// If the client is fetching keys as a result of a device update + /// received in a sync request, this should be the 'since' token of that + /// sync request, or any later sync token. This allows the server to + /// ensure its response contains the keys advertised by the notification + /// in that sync. #[serde(skip_serializing_if = "Option::is_none")] pub token: Option, } response { - /// If any remote homeservers could not be reached, they are recorded here. - /// The names of the properties are the names of the unreachable servers. + /// If any remote homeservers could not be reached, they are recorded + /// here. The names of the properties are the names of the unreachable + /// servers. pub failures: BTreeMap, /// Information on the queried devices. diff --git a/src/r0/media/get_content.rs b/src/r0/media/get_content.rs index 22ec5d2f..97fe4eb0 100644 --- a/src/r0/media/get_content.rs +++ b/src/r0/media/get_content.rs @@ -16,9 +16,11 @@ ruma_api! { /// The media ID from the mxc:// URI (the path component). #[ruma_api(path)] pub media_id: String, + /// The server name from the mxc:// URI (the authoritory component). #[ruma_api(path)] pub server_name: String, + /// Whether to fetch media deemed remote. /// Used to prevent routing loops. Defaults to `true`. #[ruma_api(query)] @@ -29,9 +31,11 @@ ruma_api! { /// The content that was previously uploaded. #[ruma_api(raw_body)] pub file: Vec, + /// The content type of the file that was previously uploaded. #[ruma_api(header = CONTENT_TYPE)] pub content_type: String, + /// The name of the file that was previously uploaded, if set. #[ruma_api(header = CONTENT_DISPOSITION)] pub content_disposition: String, diff --git a/src/r0/media/get_content_as_filename.rs b/src/r0/media/get_content_as_filename.rs index f97692d1..0664b331 100644 --- a/src/r0/media/get_content_as_filename.rs +++ b/src/r0/media/get_content_as_filename.rs @@ -16,12 +16,15 @@ ruma_api! { /// The media ID from the mxc:// URI (the path component). #[ruma_api(path)] pub media_id: String, + /// The server name from the mxc:// URI (the authoritory component). #[ruma_api(path)] pub server_name: String, + /// The filename to return in the `Content-Disposition` header. #[ruma_api(path)] pub filename: String, + /// Whether to fetch media deemed remote. /// Used to prevent routing loops. Defaults to `true`. #[ruma_api(query)] @@ -32,9 +35,11 @@ ruma_api! { /// The content that was previously uploaded. #[ruma_api(raw_body)] pub file: Vec, + /// The content type of the file that was previously uploaded. #[ruma_api(header = CONTENT_TYPE)] pub content_type: String, + /// The name of the file that was previously uploaded, if set. #[ruma_api(header = CONTENT_DISPOSITION)] pub content_disposition: String, diff --git a/src/r0/media/get_content_thumbnail.rs b/src/r0/media/get_content_thumbnail.rs index a6d9a127..54b5ef40 100644 --- a/src/r0/media/get_content_thumbnail.rs +++ b/src/r0/media/get_content_thumbnail.rs @@ -10,6 +10,7 @@ use serde::{Deserialize, Serialize}; pub enum Method { /// Crop the original to produce the requested image dimensions. Crop, + /// Maintain the original aspect ratio of the source image. Scale, } @@ -31,20 +32,25 @@ ruma_api! { #[ruma_api(query)] #[serde(skip_serializing_if = "Option::is_none")] pub allow_remote: Option, + /// The media ID from the mxc:// URI (the path component). #[ruma_api(path)] pub media_id: String, + /// The server name from the mxc:// URI (the authoritory component). #[ruma_api(path)] pub server_name: String, + /// The *desired* height of the thumbnail. The actual thumbnail may not match the size /// specified. #[ruma_api(query)] pub height: UInt, + /// The desired resizing method. #[ruma_api(query)] #[serde(skip_serializing_if = "Option::is_none")] pub method: Option, + /// The *desired* width of the thumbnail. The actual thumbnail may not match the size /// specified. #[ruma_api(query)] @@ -55,6 +61,7 @@ ruma_api! { /// The content type of the thumbnail. #[ruma_api(header = CONTENT_TYPE)] pub content_type: String, + /// A thumbnail of the requested content. #[ruma_api(body)] pub file: Vec, diff --git a/src/r0/media/get_media_preview.rs b/src/r0/media/get_media_preview.rs index be407264..d387b142 100644 --- a/src/r0/media/get_media_preview.rs +++ b/src/r0/media/get_media_preview.rs @@ -19,6 +19,7 @@ ruma_api! { /// URL to get a preview of. #[ruma_api(query)] pub url: String, + /// Preferred point in time (in milliseconds) to return a preview for. #[ruma_api(query)] #[serde(with = "ruma_serde::time::ms_since_unix_epoch")] diff --git a/src/r0/membership.rs b/src/r0/membership.rs index 4acac3db..047276f0 100644 --- a/src/r0/membership.rs +++ b/src/r0/membership.rs @@ -40,10 +40,13 @@ pub struct ThirdPartySigned { pub struct Invite3pid { /// Hostname and port of identity server to be used for account lookups. pub id_server: String, + /// An access token registered with the identity server. pub id_access_token: String, + /// Type of third party ID. pub medium: Medium, + /// Third party identifier. pub address: String, } diff --git a/src/r0/membership/get_member_events.rs b/src/r0/membership/get_member_events.rs index 76d83b65..4ca6686c 100644 --- a/src/r0/membership/get_member_events.rs +++ b/src/r0/membership/get_member_events.rs @@ -54,10 +54,13 @@ ruma_api! { pub enum MembershipEventFilter { /// The user has joined. Join, + /// The user has been invited. Invite, + /// The user has left. Leave, + /// The user has been banned. Ban, } diff --git a/src/r0/membership/invite_user.rs b/src/r0/membership/invite_user.rs index 9febe0d7..1f4796f6 100644 --- a/src/r0/membership/invite_user.rs +++ b/src/r0/membership/invite_user.rs @@ -26,6 +26,7 @@ ruma_api! { /// The room where the user should be invited. #[ruma_api(path)] pub room_id: RoomId, + /// The user to invite. #[ruma_api(body)] pub recipient: InvitationRecipient, @@ -45,6 +46,7 @@ pub enum InvitationRecipient { /// Matrix identifier of user. user_id: UserId, }, + /// Used to invite user by a third party identifer. ThirdPartyId(Invite3pid), } diff --git a/src/r0/membership/joined_members.rs b/src/r0/membership/joined_members.rs index 400ee601..dfd92cbc 100644 --- a/src/r0/membership/joined_members.rs +++ b/src/r0/membership/joined_members.rs @@ -37,6 +37,7 @@ pub struct RoomMember { /// The display name of the user. #[serde(skip_serializing_if = "Option::is_none")] pub display_name: Option, + /// The mxc avatar url of the user. #[serde(skip_serializing_if = "Option::is_none")] pub avatar_url: Option, diff --git a/src/r0/message/get_message_events.rs b/src/r0/message/get_message_events.rs index 2f70ed81..0248c9e7 100644 --- a/src/r0/message/get_message_events.rs +++ b/src/r0/message/get_message_events.rs @@ -25,6 +25,7 @@ ruma_api! { /// The room to get events from. #[ruma_api(path)] pub room_id: RoomId, + /// The token to start returning events from. /// /// This token can be obtained from a @@ -32,6 +33,7 @@ ruma_api! { /// returned by a previous request to this endpoint. #[ruma_api(query)] pub from: String, + /// The token to stop returning events at. /// /// This token can be obtained from a prev_batch @@ -40,15 +42,18 @@ ruma_api! { #[serde(skip_serializing_if = "Option::is_none")] #[ruma_api(query)] pub to: Option, + /// The direction to return events from. #[ruma_api(query)] pub dir: Direction, + /// The maximum number of events to return. /// /// Default: 10. #[serde(skip_serializing_if = "Option::is_none")] #[ruma_api(query)] pub limit: Option, + /// A RoomEventFilter to filter returned events with. #[ruma_api(query)] #[serde( @@ -63,12 +68,15 @@ ruma_api! { /// The token the pagination starts from. #[serde(skip_serializing_if = "Option::is_none")] pub start: Option, + /// The token the pagination ends at. #[serde(skip_serializing_if = "Option::is_none")] pub end: Option, + /// A list of room events. #[serde(default, skip_serializing_if = "Vec::is_empty")] pub chunk: Vec>, + /// A list of state events relevant to showing the `chunk`. #[serde(default, skip_serializing_if = "Vec::is_empty")] pub state: Vec>, @@ -83,6 +91,7 @@ pub enum Direction { /// Return events backwards in time from the requested `from` token. #[serde(rename = "b")] Backward, + /// Return events forwards in time from the requested `from` token. #[serde(rename = "f")] Forward, diff --git a/src/r0/presence/get_presence.rs b/src/r0/presence/get_presence.rs index b6e02d6e..bb7184c2 100644 --- a/src/r0/presence/get_presence.rs +++ b/src/r0/presence/get_presence.rs @@ -26,9 +26,11 @@ ruma_api! { /// The state message for this user if one was set. #[serde(skip_serializing_if = "Option::is_none")] pub status_msg: Option, + /// Whether or not the user is currently active. #[serde(skip_serializing_if = "Option::is_none")] pub currently_active: Option, + /// The length of time in milliseconds since an action was performed by the user. #[serde( with = "ruma_serde::duration::opt_ms", @@ -36,6 +38,7 @@ ruma_api! { skip_serializing_if = "Option::is_none", )] pub last_active_ago: Option, + /// The user's presence state. pub presence: PresenceState, } diff --git a/src/r0/push.rs b/src/r0/push.rs index cf922f8d..19d310dd 100644 --- a/src/r0/push.rs +++ b/src/r0/push.rs @@ -84,6 +84,7 @@ pub enum PushCondition { EventMatch { /// The dot-separated field of the event to match, e.g. `content.body` key: String, + /// The glob-style pattern to match against. pattern: String, }, diff --git a/src/r0/room.rs b/src/r0/room.rs index 52853f4e..6c20c58b 100644 --- a/src/r0/room.rs +++ b/src/r0/room.rs @@ -13,6 +13,7 @@ use serde::{Deserialize, Serialize}; pub enum Visibility { /// Indicates that the room will be shown in the published room list. Public, + /// Indicates that the room will not be shown in the published room list. Private, } diff --git a/src/r0/room/create_room.rs b/src/r0/room/create_room.rs index 89ca0dfd..83b6c35f 100644 --- a/src/r0/room/create_room.rs +++ b/src/r0/room/create_room.rs @@ -23,43 +23,54 @@ ruma_api! { /// Extra keys to be added to the content of the `m.room.create`. #[serde(skip_serializing_if = "Option::is_none")] pub creation_content: Option, + /// List of state events to send to the new room. /// /// Takes precedence over events set by preset, but gets overriden by /// name and topic keys. #[serde(default, skip_serializing_if = "Vec::is_empty")] pub initial_state: Vec, + /// A list of user IDs to invite to the room. /// /// This will tell the server to invite everyone in the list to the newly created room. #[serde(default, skip_serializing_if = "Vec::is_empty")] pub invite: Vec, + /// List of third party IDs of users to invite. #[serde(default, skip_serializing_if = "Vec::is_empty")] pub invite_3pid: Vec, + /// If set, this sets the `is_direct` flag on room invites. #[serde(skip_serializing_if = "Option::is_none")] pub is_direct: Option, + /// If this is included, an `m.room.name` event will be sent into the room to indicate /// the name of the room. #[serde(skip_serializing_if = "Option::is_none")] pub name: Option, + /// Power level content to override in the default power level event. #[serde(skip_serializing_if = "Option::is_none")] pub power_level_content_override: Option>, + /// Convenience parameter for setting various default state events based on a preset. #[serde(skip_serializing_if = "Option::is_none")] pub preset: Option, + /// The desired room alias local part. #[serde(skip_serializing_if = "Option::is_none")] pub room_alias_name: Option, + /// Room version to set for the room. Defaults to homeserver's default if not specified. #[serde(skip_serializing_if = "Option::is_none")] pub room_version: Option, + /// If this is included, an `m.room.topic` event will be sent into the room to indicate /// the topic for the room. #[serde(skip_serializing_if = "Option::is_none")] pub topic: Option, + /// A public visibility indicates that the room will be shown in the published room /// list. A private visibility will hide the room from the published room list. Rooms /// default to private visibility if this key is not included. @@ -91,8 +102,10 @@ pub struct CreationContent { pub enum RoomPreset { /// `join_rules` is set to `invite` and `history_visibility` is set to `shared`. PrivateChat, + /// `join_rules` is set to `public` and `history_visibility` is set to `shared`. PublicChat, + /// Same as `PrivateChat`, but all initial invitees get the same power level as the creator. TrustedPrivateChat, } @@ -103,8 +116,10 @@ pub struct InitialStateEvent { /// State event type. #[serde(rename = "type")] pub event_type: String, + /// `state_key` of the event to be sent. pub state_key: Option, + /// JSON content of the state event. pub content: JsonValue, } diff --git a/src/r0/room/get_room_event.rs b/src/r0/room/get_room_event.rs index b38c9e7f..fdf58126 100644 --- a/src/r0/room/get_room_event.rs +++ b/src/r0/room/get_room_event.rs @@ -18,6 +18,7 @@ ruma_api! { /// The ID of the room the event is in. #[ruma_api(path)] pub room_id: RoomId, + /// The ID of the event. #[ruma_api(path)] pub event_id: EventId, diff --git a/src/r0/room/report_content.rs b/src/r0/room/report_content.rs index 40ef14d1..690e3d03 100644 --- a/src/r0/room/report_content.rs +++ b/src/r0/room/report_content.rs @@ -18,11 +18,14 @@ ruma_api! { /// Room in which the event to be reported is located. #[ruma_api(path)] pub room_id: RoomId, + /// Event to report. #[ruma_api(path)] pub event_id: EventId, + /// Integer between -100 and 0 rating offensivness. pub score: Int, + /// Reason to report content. May be blank. pub reason: String, } diff --git a/src/r0/room/upgrade_room.rs b/src/r0/room/upgrade_room.rs index 5a152b3e..58e7e925 100644 --- a/src/r0/room/upgrade_room.rs +++ b/src/r0/room/upgrade_room.rs @@ -17,6 +17,7 @@ ruma_api! { /// ID of the room to be upgraded. #[ruma_api(path)] pub room_id: RoomId, + /// New version for the room. pub new_version: String, } diff --git a/src/r0/search/search_events.rs b/src/r0/search/search_events.rs index e2e7b240..1e07ff62 100644 --- a/src/r0/search/search_events.rs +++ b/src/r0/search/search_events.rs @@ -204,18 +204,23 @@ pub struct ResultCategories { pub struct RoomEventJsons { /// An approximate count of the total number of results found. pub count: UInt, + /// Any groups that were requested. pub groups: BTreeMap>, + /// Token that can be used to get the next batch of results, by passing as the `next_batch` /// parameter to the next call. If this field is absent, there are no more results. #[serde(skip_serializing_if = "Option::is_none")] pub next_batch: Option, + /// List of results in the requested order. pub results: Vec, + /// The current state for every room in the results. This is included if the request had the /// `include_state` key set with a value of `true`. #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] pub state: BTreeMap>>, + /// List of words which should be highlighted, useful for stemming which may /// change the query terms. #[serde(default, skip_serializing_if = "Vec::is_empty")] @@ -230,8 +235,10 @@ pub struct ResultGroup { /// results in this group. #[serde(skip_serializing_if = "Option::is_none")] pub next_batch: Option, + /// Key that can be used to order different groups. pub order: UInt, + /// Which results are in this group. pub results: Vec, } @@ -242,9 +249,11 @@ pub struct SearchResult { /// Context for result, if requested. #[serde(skip_serializing_if = "Option::is_none")] pub context: Option, + /// A number that describes how closely this result matches the search. Higher is closer. #[serde(skip_serializing_if = "Option::is_none")] pub rank: Option, + /// The event that matched. #[serde(skip_serializing_if = "Option::is_none")] pub result: Option>, @@ -256,6 +265,7 @@ pub struct UserProfile { /// The user's avatar URL, if set. #[serde(skip_serializing_if = "Option::is_none")] pub avatar_url: Option, + /// The user's display name, if set. #[serde(skip_serializing_if = "Option::is_none")] pub displayname: Option, @@ -266,6 +276,7 @@ pub struct UserProfile { pub enum RoomIdOrUserId { /// Represents a room ID. RoomId(RoomId), + /// Represents a user ID. UserId(UserId), } diff --git a/src/r0/session/get_login_types.rs b/src/r0/session/get_login_types.rs index a07da00c..0e30d789 100644 --- a/src/r0/session/get_login_types.rs +++ b/src/r0/session/get_login_types.rs @@ -30,6 +30,7 @@ pub enum LoginType { /// A password is supplied to authenticate. #[serde(rename = "m.login.password")] Password, + /// Token-based login. #[serde(rename = "m.login.token")] Token, diff --git a/src/r0/session/login.rs b/src/r0/session/login.rs index f9444bf9..7c0216b2 100644 --- a/src/r0/session/login.rs +++ b/src/r0/session/login.rs @@ -20,12 +20,15 @@ ruma_api! { /// Identification information for the user. #[serde(flatten)] pub user: UserInfo, + /// The authentication mechanism. #[serde(flatten)] pub login_info: LoginInfo, + /// ID of the client device #[serde(skip_serializing_if = "Option::is_none")] pub device_id: Option, + /// A display name to assign to the newly-created device. Ignored if device_id corresponds /// to a known device. #[serde(skip_serializing_if = "Option::is_none")] @@ -35,19 +38,23 @@ ruma_api! { response { /// The fully-qualified Matrix ID that has been registered. pub user_id: UserId, + /// An access token for the account. pub access_token: String, + /// The hostname of the homeserver on which the account has been registered. /// /// Deprecated: Clients should extract the server_name from user_id (by splitting at the /// first colon) if they require it. #[serde(skip_serializing_if = "Option::is_none")] pub home_server: Option, + /// ID of the logged-in device. /// /// Will be the same as the corresponging parameter in the request, if one was /// specified. pub device_id: String, + /// Client configuration provided by the server. /// /// If present, clients SHOULD use the provided object to reconfigure themselves. @@ -64,18 +71,22 @@ pub enum UserInfo { /// Either a fully qualified Matrix user ID, or just the localpart (as part of the 'identifier' /// field). MatrixId(String), + /// Third party identifier (as part of the 'identifier' field). ThirdPartyId { /// Third party identifier for the user. address: String, + /// The medium of the identifier. medium: Medium, }, + /// Same as third-party identification with medium == msisdn, but with a non-canonicalised /// phone number. PhoneNumber { /// The country that the phone number is from. country: String, + /// The phone number. phone: String, }, @@ -91,6 +102,7 @@ pub enum LoginInfo { /// The password. password: String, }, + /// Token-based login. #[serde(rename = "m.login.token")] Token { @@ -105,6 +117,7 @@ pub struct DiscoveryInfo { /// Information about the homeserver to connect to. #[serde(rename = "m.homeserver")] pub homeserver: HomeserverInfo, + /// Information about the identity server to connect to. #[serde(rename = "m.identity_server")] pub identity_server: Option, diff --git a/src/r0/sync/sync_events.rs b/src/r0/sync/sync_events.rs index 9a9add73..489191ae 100644 --- a/src/r0/sync/sync_events.rs +++ b/src/r0/sync/sync_events.rs @@ -34,6 +34,7 @@ ruma_api! { #[serde(skip_serializing_if = "Option::is_none")] #[ruma_api(query)] pub filter: Option, + /// A point in time to continue a sync from. /// /// Should be a token from the `next_batch` field of a previous `/sync` @@ -41,14 +42,17 @@ ruma_api! { #[serde(skip_serializing_if = "Option::is_none")] #[ruma_api(query)] pub since: Option, + /// Controls whether to include the full state for all rooms the user is a member of. #[serde(default, skip_serializing_if = "ruma_serde::is_default")] #[ruma_api(query)] pub full_state: bool, + /// Controls whether the client is automatically marked as online by polling this API. #[serde(default, skip_serializing_if = "ruma_serde::is_default")] #[ruma_api(query)] pub set_presence: SetPresence, + /// The maximum time to poll in milliseconds before returning this request. #[serde( with = "ruma_serde::duration::opt_ms", @@ -62,20 +66,26 @@ ruma_api! { response { /// The batch token to supply in the `since` param of the next `/sync` request. pub next_batch: String, + /// Updates to rooms. pub rooms: Rooms, + /// Updates to the presence status of other users. pub presence: Presence, + /// The global private data created by this user. pub account_data: AccountData, + /// Messages sent dirrectly between devices. #[serde(default, skip_serializing_if = "ToDevice::is_empty")] pub to_device: ToDevice, + /// Information on E2E device updates. /// /// Only present on an incremental sync. #[serde(skip_serializing_if = "Option::is_none")] pub device_lists: Option, + /// For each key algorithm, the number of unclaimed one-time keys /// currently held on the server for a device. #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] @@ -91,8 +101,10 @@ ruma_api! { pub enum SetPresence { /// Do not set the presence of the user calling this API. Offline, + /// Mark client as online explicitly. Assumed by default. Online, + /// Mark client as being idle. Unavailable, } @@ -121,6 +133,7 @@ pub enum Filter { #[serde(with = "ruma_serde::json_string")] /// A complete filter definition serialized to JSON. FilterDefinition(FilterDefinition), + /// The ID of a filter saved on the server. FilterId(String), } @@ -130,8 +143,10 @@ pub enum Filter { pub struct Rooms { /// The rooms that the user has left or been banned from. pub leave: BTreeMap, + /// The rooms that the user has joined. pub join: BTreeMap, + /// The rooms that the user has been invited to. pub invite: BTreeMap, } @@ -142,8 +157,10 @@ pub struct LeftRoom { /// The timeline of messages and state changes in the room up to the point when the user /// left. pub timeline: Timeline, + /// The state updates for the room up to the start of the timeline. pub state: State, + /// The private data that this user has attached to this room. #[serde(skip_serializing_if = "Option::is_none")] pub account_data: Option, @@ -155,17 +172,22 @@ pub struct JoinedRoom { /// Information about the room which clients may need to correctly render it /// to users. pub summary: RoomSummary, + /// Counts of unread notifications for this room. pub unread_notifications: UnreadNotificationsCount, + /// The timeline of messages and state changes in the room. pub timeline: Timeline, + /// Updates to the state, between the time indicated by the `since` parameter, and the start /// of the `timeline` (or all state up to the start of the `timeline`, if `since` is not /// given, or `full_state` is true). pub state: State, + /// The private data that this user has attached to this room. #[serde(skip_serializing_if = "Option::is_none")] pub account_data: Option, + /// The ephemeral events in the room that aren't recorded in the timeline or state of the /// room. e.g. typing. pub ephemeral: Ephemeral, @@ -177,6 +199,7 @@ pub struct UnreadNotificationsCount { /// The number of unread notifications for this room with the highlight flag set. #[serde(skip_serializing_if = "Option::is_none")] pub highlight_count: Option, + /// The total number of unread notifications for this room. #[serde(skip_serializing_if = "Option::is_none")] pub notification_count: Option, @@ -188,10 +211,12 @@ pub struct Timeline { /// True if the number of events returned was limited by the `limit` on the filter. #[serde(skip_serializing_if = "Option::is_none")] pub limited: Option, + /// A token that can be supplied to to the `from` parameter of the /// `/rooms/{roomId}/messages` endpoint. #[serde(skip_serializing_if = "Option::is_none")] pub prev_batch: Option, + /// A list of events. pub events: Vec>, } @@ -224,6 +249,7 @@ pub struct RoomSummary { /// one. Required if room name or canonical aliases are not set or empty. #[serde(rename = "m.heroes", default, skip_serializing_if = "Vec::is_empty")] pub heroes: Vec, + /// Number of users whose membership status is `join`. /// Required if field has changed since last sync; otherwise, it may be /// omitted. @@ -232,6 +258,7 @@ pub struct RoomSummary { skip_serializing_if = "Option::is_none" )] pub joined_member_count: Option, + /// Number of users whose membership status is `invite`. /// Required if field has changed since last sync; otherwise, it may be /// omitted. @@ -289,6 +316,7 @@ pub struct DeviceLists { /// share an encrypted room with the client since the previous sync #[serde(default, skip_serializing_if = "Vec::is_empty")] pub changed: Vec, + /// List of users who no longer share encrypted rooms since the previous sync /// response. #[serde(default, skip_serializing_if = "Vec::is_empty")] diff --git a/src/r0/thirdparty.rs b/src/r0/thirdparty.rs index 99a3566f..91f890e2 100644 --- a/src/r0/thirdparty.rs +++ b/src/r0/thirdparty.rs @@ -18,12 +18,16 @@ use serde::{Deserialize, Serialize}; pub struct Protocol { /// Fields which may be used to identify a third party user. pub user_fields: Vec, + /// Fields which may be used to identify a third party location. pub location_fields: Vec, + /// A content URI representing an icon for the third party protocol. pub icon: String, + /// The type definitions for the fields defined in `user_fields` and `location_fields`. pub field_types: BTreeMap, + /// A list of objects representing independent instances of configuration. pub instances: Vec, } @@ -33,11 +37,14 @@ pub struct Protocol { pub struct ProtocolInstance { /// A human-readable description for the protocol, such as the name. pub desc: String, + /// An optional content URI representing the protocol. #[serde(skip_serializing_if = "Option::is_none")] pub icon: Option, + /// Preset values for `fields` the client may use to search by. pub fields: BTreeMap, + /// A unique identifier across all instances. pub network_id: String, } @@ -47,6 +54,7 @@ pub struct ProtocolInstance { pub struct FieldType { /// A regular expression for validation of a field's value. pub regexp: String, + /// A placeholder serving as a valid example of the field value. pub placeholder: String, } @@ -56,8 +64,10 @@ pub struct FieldType { pub struct Location { /// An alias for a matrix room. pub alias: RoomAliasId, + /// The protocol ID that the third party location is a part of. pub protocol: String, + /// Information used to identify this third party location. pub fields: BTreeMap, } @@ -67,8 +77,10 @@ pub struct Location { pub struct User { /// A matrix user ID representing a third party user. pub userid: UserId, + /// The protocol ID that the third party user is a part of. pub protocol: String, + /// Information used to identify this third party user. pub fields: BTreeMap, } @@ -79,6 +91,7 @@ pub struct User { pub enum Medium { /// Email address identifier Email, + /// Phone number identifier MSISDN, } diff --git a/src/r0/thirdparty/get_location_for_protocol.rs b/src/r0/thirdparty/get_location_for_protocol.rs index e0c30b17..d3aab76d 100644 --- a/src/r0/thirdparty/get_location_for_protocol.rs +++ b/src/r0/thirdparty/get_location_for_protocol.rs @@ -20,6 +20,7 @@ ruma_api! { /// The protocol used to communicate to the third party network. #[ruma_api(path)] pub protocol: String, + /// One or more custom fields to help identify the third party location. // The specification is incorrect for this parameter. See matrix-org/matrix-doc#2352. #[ruma_api(query_map)] diff --git a/src/r0/thirdparty/get_user_for_protocol.rs b/src/r0/thirdparty/get_user_for_protocol.rs index ab9c74a1..424c4c82 100644 --- a/src/r0/thirdparty/get_user_for_protocol.rs +++ b/src/r0/thirdparty/get_user_for_protocol.rs @@ -20,6 +20,7 @@ ruma_api! { /// The protocol used to communicate to the third party network. #[ruma_api(path)] pub protocol: String, + /// One or more custom fields that are passed to the AS to help identify the user. // The specification is incorrect for this parameter. See matrix-org/matrix-doc#2352. #[ruma_api(query_map)] diff --git a/src/r0/to_device.rs b/src/r0/to_device.rs index 6e68ce68..f75176d8 100644 --- a/src/r0/to_device.rs +++ b/src/r0/to_device.rs @@ -18,6 +18,7 @@ pub mod send_event_to_device; pub enum DeviceIdOrAllDevices { /// Represents a device Id for one of a user's devices. DeviceId(DeviceId), + /// Represents all devices for a user. AllDevices, } diff --git a/src/r0/to_device/send_event_to_device.rs b/src/r0/to_device/send_event_to_device.rs index f31e9eff..a0187ad7 100644 --- a/src/r0/to_device/send_event_to_device.rs +++ b/src/r0/to_device/send_event_to_device.rs @@ -22,9 +22,11 @@ ruma_api! { /// Type of event being sent to each device. #[ruma_api(path)] pub event_type: EventType, + /// A request identifier unique to the access token used to send the request. #[ruma_api(path)] pub txn_id: String, + /// A map of users to devices to a message event to be sent to the user's /// device. Individual message events can be sent to devices, but all /// events must be of the same type. diff --git a/src/r0/uiaa.rs b/src/r0/uiaa.rs index 14b7a97a..273317bf 100644 --- a/src/r0/uiaa.rs +++ b/src/r0/uiaa.rs @@ -22,13 +22,16 @@ pub enum AuthData { /// 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. #[serde(skip_serializing_if = "Option::is_none")] session: Option, + /// Parameters submitted for a particular authentication stage. #[serde(flatten)] auth_parameters: BTreeMap, }, + /// Used by the client to acknowledge that the user has completed a UIAA /// stage through the fallback method. FallbackAcknowledgement { @@ -44,14 +47,18 @@ pub enum AuthData { pub struct UiaaInfo { /// List of authentication flows available for this endpoint. pub flows: Vec, + /// List of stages in the current flow completed by the client. #[serde(default, skip_serializing_if = "Vec::is_empty")] pub completed: Vec, + /// Authentication parameters required for the client to complete authentication. pub params: JsonValue, + /// Session key for client to use to complete authentication. #[serde(skip_serializing_if = "Option::is_none")] pub session: Option, + /// Authentication-related errors for previous request returned by homeserver. #[serde(flatten, skip_serializing_if = "Option::is_none")] pub auth_error: Option, @@ -73,6 +80,7 @@ pub struct AuthFlow { pub enum UiaaResponse { /// User-Interactive Authentication API response AuthResponse(UiaaInfo), + /// Matrix error response MatrixError(MatrixError), } diff --git a/src/r0/user_directory/search_users.rs b/src/r0/user_directory/search_users.rs index a0b54cee..998488cd 100644 --- a/src/r0/user_directory/search_users.rs +++ b/src/r0/user_directory/search_users.rs @@ -18,6 +18,7 @@ ruma_api! { request { /// The term to search for. pub search_term: String, + /// The maximum number of results to return. /// /// Defaults to 10. @@ -28,6 +29,7 @@ ruma_api! { response { /// Ordered by rank and then whether or not profile info is available. pub results: Vec, + /// Indicates if the result list has been truncated by the limit. pub limited: bool, } @@ -40,9 +42,11 @@ ruma_api! { pub struct User { /// The user's matrix user ID. pub user_id: UserId, + /// The display name of the user, if one exists. #[serde(skip_serializing_if = "Option::is_none")] pub display_name: Option, + /// The avatar url, as an MXC, if one exists. #[serde(skip_serializing_if = "Option::is_none")] pub avatar_url: Option, diff --git a/src/unversioned/get_supported_versions.rs b/src/unversioned/get_supported_versions.rs index 874c334a..9e6e466d 100644 --- a/src/unversioned/get_supported_versions.rs +++ b/src/unversioned/get_supported_versions.rs @@ -19,6 +19,7 @@ ruma_api! { response { /// A list of Matrix client API protocol versions supported by the homeserver. pub versions: Vec, + /// Experimental features supported by the server. #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] pub unstable_features: BTreeMap