Update to ruma-api v0.3.
Also fixes a few errors encountered in the process and remove depcrecated tokenrefresh endpoint.
This commit is contained in:
parent
28598352aa
commit
8ab3c737b8
@ -11,7 +11,7 @@ repository = "https://github.com/ruma/ruma-client-api"
|
||||
version = "0.1.0"
|
||||
|
||||
[dependencies]
|
||||
ruma-api = "0.2.0"
|
||||
ruma-api = "0.3.0"
|
||||
ruma-events = "0.3.0"
|
||||
ruma-identifiers = "0.6.0"
|
||||
ruma-signatures = "0.1.0"
|
||||
|
@ -108,11 +108,27 @@ pub mod register {
|
||||
}
|
||||
|
||||
fn request_path(_params: Self::PathParams) -> String {
|
||||
Self::router_path()
|
||||
Self::router_path().to_string()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/register".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/register"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"register"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Register an account on this homeserver."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -120,6 +136,8 @@ pub mod register {
|
||||
/// [POST /_matrix/client/r0/account/password/email/requestToken](https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-account-password-email-requesttoken)
|
||||
pub mod request_password_change_token {
|
||||
// TODO: according to the spec, this does not has any params
|
||||
// probably the spec's fault, as this would not make any sense.
|
||||
// But the BodyParams here are probably wrong
|
||||
/// This API endpoint's body parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct BodyParams {
|
||||
@ -145,11 +163,27 @@ pub mod request_password_change_token {
|
||||
}
|
||||
|
||||
fn request_path(_params: Self::PathParams) -> String {
|
||||
Self::router_path()
|
||||
Self::router_path().to_string()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/account/password/email/requestToken".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/account/password/email/requestToken"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"request_password_change_token"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Request that a password change token is sent to the given email address."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -173,11 +207,27 @@ pub mod deactivate {
|
||||
}
|
||||
|
||||
fn request_path(_params: Self::PathParams) -> String {
|
||||
Self::router_path()
|
||||
Self::router_path().to_string()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/account/deactivate".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/account/deactivate"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"deactivate"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Deactivate the current user's account."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -206,11 +256,27 @@ pub mod change_password {
|
||||
}
|
||||
|
||||
fn request_path(_params: Self::PathParams) -> String {
|
||||
Self::router_path()
|
||||
Self::router_path().to_string()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/account/password".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/account/password"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"change_password"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Change the password of the current user's account."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -242,11 +308,27 @@ pub mod request_register_token {
|
||||
}
|
||||
|
||||
fn request_path(_params: Self::PathParams) -> String {
|
||||
Self::router_path()
|
||||
Self::router_path().to_string()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/register/email/requestToken".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/register/email/requestToken"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"request_register_token"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Request a register token with a 3rd party email."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,8 +30,24 @@ pub mod create_alias {
|
||||
format!("/_matrix/client/r0/directory/room/{}", params.room_alias)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/directory/room/:room_alias".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/directory/room/:room_alias"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"create_alias"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Add an alias to a room."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -56,8 +72,24 @@ pub mod delete_alias {
|
||||
format!("/_matrix/client/r0/directory/room/{}", params.room_alias)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/directory/room/:room_alias".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/directory/room/:room_alias"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"delete_alias"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Remove an alias from a room."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -91,8 +123,24 @@ pub mod get_alias {
|
||||
format!("/_matrix/client/r0/directory/room/{}", params.room_alias)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/directory/room/:room_alias".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/directory/room/:room_alias"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"get_alias"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Resolve a room alias to a room ID."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,8 +35,24 @@ pub mod set_room_account_data {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/user/:user_id/rooms/:room_id/account_data/:type".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/user/:user_id/rooms/:room_id/account_data/:type"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"set_room_account_data"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Associate account data with a room."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -74,8 +90,24 @@ pub mod set_global_account_data {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/user/:user_id/account_data/:type".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/user/:user_id/account_data/:type"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"set_global_account_data"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Sets global account data."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,11 +33,27 @@ pub mod create_contact {
|
||||
}
|
||||
|
||||
fn request_path(_params: Self::PathParams) -> String {
|
||||
Self::router_path()
|
||||
Self::router_path().to_string()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/account/3pid".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/account/3pid"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"create_contact"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Adds contact information to the user's account."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -79,18 +95,33 @@ pub mod get_contacts {
|
||||
}
|
||||
|
||||
fn request_path(_params: Self::PathParams) -> String {
|
||||
Self::router_path()
|
||||
Self::router_path().to_string()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/account/3pid/email/requestToken".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/account/3pid/email/requestToken"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"get_contacts"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Get a list of 3rd party contacts associated with the user's account."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// [POST /_matrix/client/r0/account/3pid/email/requestToken](https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-account-3pid-email-requesttoken)
|
||||
pub mod request_contact_verification_token {
|
||||
// TODO: according to the spec this takes no parameters
|
||||
/// This API endpoint's body parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct BodyParams {
|
||||
@ -116,11 +147,28 @@ pub mod request_contact_verification_token {
|
||||
}
|
||||
|
||||
fn request_path(_params: Self::PathParams) -> String {
|
||||
Self::router_path()
|
||||
Self::router_path().to_string()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/account/3pid/email/requestToken".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/account/3pid/email/requestToken"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"request_contact_verification_token"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Ask for a verification token for a given 3rd party ID."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
// Not sure why this don't require auth?
|
||||
false
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,8 +48,24 @@ pub mod get_context {
|
||||
format!("/_matrix/client/r0/rooms/{}/context/{}", params.room_id, params.event_id)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/context/:event_id".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/rooms/:room_id/context/:event_id"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"get_context"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Get the events immediately preceding and following a given event."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,11 +43,27 @@ pub mod get_public_rooms {
|
||||
}
|
||||
|
||||
fn request_path(_params: Self::PathParams) -> String {
|
||||
Self::router_path()
|
||||
Self::router_path().to_string()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/publicRooms".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/publicRooms"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"get_public_rooms"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Get the list of rooms in this homeserver's public directory."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -132,8 +132,24 @@ pub mod create_filter {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/user/:user_id/filter".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/user/:user_id/filter"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"create_filter"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Create a new filter for event retrieval."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -172,8 +188,26 @@ pub mod get_filter {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/user/:user_id/filter/:filter_id".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/user/:user_id/filter/:filter_id"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"get_filter"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Retrieve a previously created filter."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
// TODO: not sure why, as I guess you should not be able to retrieve
|
||||
// other users filters?
|
||||
false
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,8 +34,24 @@ pub mod get_content {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/media/r0/download/:server_name/:media_id".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/media/r0/download/:server_name/:media_id"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"get_media_content"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Retrieve content from the media store."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -64,11 +80,28 @@ pub mod create_content {
|
||||
}
|
||||
|
||||
fn request_path(_params: Self::PathParams) -> String {
|
||||
Self::router_path()
|
||||
Self::router_path().to_string()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/media/r0/upload".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/media/r0/upload"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"create_media_content"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Upload content to the media store."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
// TODO: How comes this does not require authentication?
|
||||
false
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -85,8 +118,10 @@ pub mod get_content_thumbnail {
|
||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
||||
pub enum Method {
|
||||
/// Crop the original to produce the requested image dimensions.
|
||||
#[serde(rename = "crop")]
|
||||
Crop,
|
||||
/// Maintain the original aspect ratio of the source image.
|
||||
#[serde(rename = "scale")]
|
||||
Scale,
|
||||
}
|
||||
|
||||
@ -130,8 +165,24 @@ pub mod get_content_thumbnail {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/media/r0/thumbnail/:server_name/:media_id".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/media/r0/thumbnail/:server_name/:media_id"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"get_content_thumbnail"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Get a thumbnail of content from the media store."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ pub struct ThirdPartySigned {
|
||||
pub mod invite_user {
|
||||
use ruma_identifiers::{UserId, RoomId};
|
||||
|
||||
/// The request type.
|
||||
/// The request body parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct BodyParams {
|
||||
pub user_id: UserId,
|
||||
@ -55,8 +55,24 @@ pub mod invite_user {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/invite".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/rooms/:room_id/invite"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"invite_user"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Invite a user to a room."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -116,8 +132,24 @@ pub mod join_room_by_id_or_alias {
|
||||
}
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id_or_alias/join".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/join/:room_id_or_alias"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"join_room_by_id_or_alias"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Join a room using its ID or one of its aliases."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -167,8 +199,24 @@ pub mod join_room_by_id {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/join".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/rooms/:room_id/join"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"join_room_by_id"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Join a room using its ID."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -204,8 +252,24 @@ pub mod forget_room {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/forget".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/rooms/:room_id/forget"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"forget_room"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Forget a room."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -241,8 +305,24 @@ pub mod leave_room {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/leave".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/rooms/:room_id/leave"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"leave_room"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Leave a room."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -286,8 +366,24 @@ pub mod kick_user {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/kick".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/rooms/:room_id/kick"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"kick_user"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Kick a user from a room."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -329,8 +425,24 @@ pub mod unban_user {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/unban".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/rooms/:room_id/unban"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"unban_user"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"unban a user from a room."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -374,8 +486,24 @@ pub mod ban_user {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/ban".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/rooms/:room_id/ban"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"ban_user"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Ban a user from a room."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,8 +40,24 @@ pub mod set_presence {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/presence/:user_id/status".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/presence/:user_id/status"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"set_presence"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Set presence status for this user."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -90,8 +106,24 @@ pub mod get_presence {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/presence/:user_id/status".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/presence/:user_id/status"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"get_presence"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Get presence status for this user."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -138,8 +170,24 @@ pub mod update_presence_subscriptions {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/presence/list/:user_id".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/presence/list/:user_id"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"update_presence_subscriptions"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Update the presence subscriptions of the user."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -176,8 +224,25 @@ pub mod get_subscribed_presences {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/presence/list/:user_id".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/presence/list/:user_id"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"get_subscribed_presences"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Get the precence status from the user's subscriptions."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
// TODO: not sure why this does not require authentication
|
||||
false
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,8 +38,24 @@ pub mod get_display_name {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/profile/:user_id/displayname".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/profile/:user_id/displayname"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"get_display_name"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Get the display name of a user."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -83,8 +99,24 @@ pub mod set_display_name {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/profile/:user_id/displayname".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/profile/:user_id/displayname"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"set_display_name"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Set the display name of the user."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -127,8 +159,24 @@ pub mod get_avatar_url {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/profile/:user_id/avatar_url".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/profile/:user_id/avatar_url"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"get_avatar_url"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Get the avatar URL of a user."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -171,8 +219,24 @@ pub mod set_avatar_url {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/profile/:user_id/avatar_url".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/profile/:user_id/avatar_url"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"set_avatar_url"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Set the avatar URL of the user."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -217,8 +281,24 @@ pub mod get_profile {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/profile/:user_id".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/profile/:user_id"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"get_profile"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Get all profile information of an user."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,8 +51,24 @@ pub mod create_receipt {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/receipt/:receipt_type/:event_id".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/rooms/:room_id/receipt/:receipt_type/:event_id"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"create_receipt"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Send a receipt event to a room."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,8 +49,24 @@ pub mod redact_event {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/redact/:event_id/:txn_id".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/rooms/:room_id/redact/:event_id/:txn_id"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"redact_event"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Redact an event, stripping all information not critical to the event graph integrity."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,11 +68,27 @@ pub mod create_room {
|
||||
}
|
||||
|
||||
fn request_path(_params: Self::PathParams) -> String {
|
||||
Self::router_path()
|
||||
Self::router_path().to_string()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/createRoom".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/createRoom"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"create_room"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Create a new room."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -222,11 +222,27 @@ pub mod search_events {
|
||||
}
|
||||
|
||||
fn request_path(_params: Self::PathParams) -> String {
|
||||
Self::router_path()
|
||||
Self::router_path().to_string()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/search".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/search"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"search"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Search events."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
//! Endpoints for sending events.
|
||||
|
||||
/// [PUT /_matrix/client/r0/rooms/{roomId}/state/{eventType}](https://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-state-eventtype)
|
||||
pub mod send_state_event {
|
||||
pub mod send_state_event_for_empty_key {
|
||||
use ruma_identifiers::{RoomId, EventId};
|
||||
use ruma_events::EventType;
|
||||
|
||||
@ -41,14 +41,30 @@ pub mod send_state_event {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/state/:event_type".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/rooms/:room_id/state/:event_type"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"send_state_event_for_empty_key"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Send a state event to a room associated with the empty state key."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// [PUT /_matrix/client/r0/rooms/{roomId}/state/{eventType}/{stateKey}](https://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-state-eventtype-statekey)
|
||||
pub mod send_state_event_by_state_key {
|
||||
pub mod send_state_event_for_key {
|
||||
use ruma_identifiers::{RoomId, EventId};
|
||||
use ruma_events::EventType;
|
||||
|
||||
@ -90,8 +106,24 @@ pub mod send_state_event_by_state_key {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/state/:event_type/:state_key".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/rooms/:room_id/state/:event_type/:state_key"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"send_state_event_for_key"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Send a state event to a room associated with a given state key."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -139,8 +171,24 @@ pub mod send_message_event {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/send/:event_type/:txn_id".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/rooms/:room_id/send/:event_type/:txn_id"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"send_message_event"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Send a message event to a room."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,8 +68,24 @@ pub mod get_user_info {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/admin/whois/:user_id".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/admin/whois/:user_id"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"get_user_info"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Get information about a particular user."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,37 @@ pub mod login {
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Endpoint;
|
||||
|
||||
// TODO: missing BodyParams
|
||||
/// Possible login mediums for 3rd party ID
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub enum LoginMedium {
|
||||
#[serde(rename = "email")]
|
||||
Email
|
||||
}
|
||||
|
||||
/// Possible kinds of login
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub enum LoginKind {
|
||||
#[serde(rename = "m.login.password")]
|
||||
Password
|
||||
}
|
||||
|
||||
/// The body parameters for this endpoint
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct BodyParams {
|
||||
/// Password of the user
|
||||
pub password: String,
|
||||
/// Medium of 3rd party login to use
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub medium: Option<LoginMedium>,
|
||||
/// Type of login to do
|
||||
#[serde(rename = "type")]
|
||||
pub kind: LoginKind,
|
||||
/// Localpart or full matrix user id of the user
|
||||
pub user: String,
|
||||
/// 3rd party identifier for the user
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub address: Option<String>
|
||||
}
|
||||
|
||||
/// This API endpoint's response.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
@ -29,11 +59,27 @@ pub mod login {
|
||||
}
|
||||
|
||||
fn request_path(_params: Self::PathParams) -> String {
|
||||
Self::router_path()
|
||||
Self::router_path().to_string()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/login".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/login"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"login"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Login to the homeserver."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -55,51 +101,27 @@ pub mod logout {
|
||||
}
|
||||
|
||||
fn request_path(_params: Self::PathParams) -> String {
|
||||
Self::router_path()
|
||||
Self::router_path().to_string()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/logout".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// [POST /_matrix/client/r0/tokenrefresh](https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-tokenrefresh)
|
||||
pub mod refresh_access_token {
|
||||
/// This API endpoint's body parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct BodyParams {
|
||||
pub refresh_token: String,
|
||||
}
|
||||
|
||||
/// Details about this API endpoint.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Endpoint;
|
||||
|
||||
/// This API endpoint's response.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Response {
|
||||
pub access_token: String,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub refresh_token: Option<String>,
|
||||
}
|
||||
|
||||
impl ::Endpoint for Endpoint {
|
||||
type BodyParams = BodyParams;
|
||||
type PathParams = ();
|
||||
type QueryParams = ();
|
||||
type Response = Response;
|
||||
|
||||
fn method() -> ::Method {
|
||||
::Method::Post
|
||||
}
|
||||
|
||||
fn request_path(_params: Self::PathParams) -> String {
|
||||
Self::router_path()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/tokenrefresh".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/logout"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"logout"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Log out of the homeserver."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
127
src/r0/sync.rs
127
src/r0/sync.rs
@ -32,14 +32,30 @@ pub mod get_state_events {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/state".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/rooms/:room_id/state"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"get_state_events"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Get state events for a room."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// [GET /_matrix/client/r0/rooms/{roomId}/state/{eventType}](https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-state-eventtype)
|
||||
pub mod get_state_event_by_event_type {
|
||||
pub mod get_state_events_for_empty_key {
|
||||
use ruma_identifiers::RoomId;
|
||||
|
||||
/// Details about this API endpoint.
|
||||
@ -71,14 +87,30 @@ pub mod get_state_event_by_event_type {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/state/:event_type".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/rooms/:room_id/state/:event_type"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"get_state_events_for_empty_key"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Get state events of a given type associated with the empty key."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// [GET /_matrix/client/r0/rooms/{roomId}/state/{eventType}/{stateKey}](https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-state-eventtype-state-key)
|
||||
pub mod get_state_event_by_state_key {
|
||||
pub mod get_state_events_for_key {
|
||||
use ruma_identifiers::RoomId;
|
||||
|
||||
/// Details about this API endpoint.
|
||||
@ -112,8 +144,24 @@ pub mod get_state_event_by_state_key {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/state/:event_type/:state_key".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/rooms/:room_id/state/:event_type/:state_key"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"get_state_events_for_key"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Get state events associated with a given key."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -156,8 +204,27 @@ pub mod get_member_events {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/members".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/rooms/:room_id/members"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"get_member_events"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Get membership events for a room."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
// TODO: not marked as requiring auth in the spec, but
|
||||
// will return a 403 error is user is not a member of the
|
||||
// room anyway...
|
||||
false
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -222,8 +289,24 @@ pub mod get_message_events {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/messages".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/rooms/:room_id/messages"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"get_message_events"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Get message events for a room."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -370,8 +453,24 @@ pub mod sync_events {
|
||||
"/_matrix/client/r0/sync".to_string()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/sync".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/sync"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"sync"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Get all new events from all rooms since the last sync or a given point of time."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,8 +36,24 @@ pub mod create_tag {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/user/:user_id/rooms/:room_id/tags/:tag".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/user/:user_id/rooms/:room_id/tags/:tag"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"create_tag"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Add a new tag to a room."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -82,8 +98,24 @@ pub mod get_tags {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/user/:user_id/rooms/:room_id/tags".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/user/:user_id/rooms/:room_id/tags"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"get_tags"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Get the tags associated with a room."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -123,8 +155,24 @@ pub mod delete_tag {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/user/:user_id/rooms/:room_id/tags/:tag".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/user/:user_id/rooms/:room_id/tags/:tag"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"delete_tag"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Remove a tag from a room."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
//! Endpoints for typing notifications.
|
||||
|
||||
/// [PUT /_matrix/client/r0/rooms/{roomId}/typing/{userId}](https://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-typing-userid)
|
||||
pub mod start_or_stop_typing {
|
||||
pub mod create_typing_event {
|
||||
use ruma_identifiers::{UserId, RoomId};
|
||||
|
||||
/// Details about this API endpoint.
|
||||
@ -41,8 +41,24 @@ pub mod start_or_stop_typing {
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/invite/:user_id".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/r0/rooms/:room_id/typing/:user_id"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"create_typing_event"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Send a typing event to a room."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,11 +26,27 @@ pub mod get_turn_server_info {
|
||||
}
|
||||
|
||||
fn request_path(_params: Self::PathParams) -> String {
|
||||
"/_matrix/client/r0/voip/turnServer".to_string()
|
||||
Self::router_path().to_string()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"_matrix/client/r0/voip/turnServer".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"_matrix/client/r0/voip/turnServer"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"turn_server_info"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Get credentials for the client to use when initiating VoIP calls."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,11 +24,27 @@ pub mod get_supported_versions {
|
||||
}
|
||||
|
||||
fn request_path(_params: Self::PathParams) -> String {
|
||||
Self::router_path()
|
||||
Self::router_path().to_string()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/versions".to_string()
|
||||
fn router_path() -> &'static str {
|
||||
"/_matrix/client/versions"
|
||||
}
|
||||
|
||||
fn name() -> &'static str {
|
||||
"api_version"
|
||||
}
|
||||
|
||||
fn description() -> &'static str {
|
||||
"Get the versions of the client-server API supported by this homeserver."
|
||||
}
|
||||
|
||||
fn requires_authentication() -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn rate_limited() -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user