Add colons to ruma_api! macro after each keyword

This commit is contained in:
Ragotzy.devin 2020-06-30 07:05:58 -04:00 committed by Jonas Platte
parent 87fb2c1e00
commit 5376a3fc6e
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
140 changed files with 441 additions and 432 deletions

View File

@ -14,7 +14,7 @@ pub mod some_endpoint {
use ruma_api::ruma_api; use ruma_api::ruma_api;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Does something.", description: "Does something.",
method: GET, // An `http::Method` constant. No imports required. method: GET, // An `http::Method` constant. No imports required.
name: "some_endpoint", name: "some_endpoint",
@ -23,7 +23,7 @@ pub mod some_endpoint {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
// With no attribute on the field, it will be put into the body of the request. // With no attribute on the field, it will be put into the body of the request.
pub foo: String, pub foo: String,
@ -41,7 +41,7 @@ pub mod some_endpoint {
pub baz: String, pub baz: String,
} }
response { response: {
// This value will be extracted from the "Content-Type" HTTP header. // This value will be extracted from the "Content-Type" HTTP header.
#[ruma_api(header = CONTENT_TYPE)] #[ruma_api(header = CONTENT_TYPE)]
pub content_type: String pub content_type: String
@ -49,6 +49,9 @@ pub mod some_endpoint {
// With no attribute on the field, it will be extracted from the body of the response. // With no attribute on the field, it will be extracted from the body of the response.
pub value: String, pub value: String,
} }
// An error can also be specified or defaults to `ruma_api::error::Void`.
error: ruma_api::Error
} }
} }
``` ```

View File

@ -564,6 +564,7 @@ pub struct RawMetadata {
impl Parse for RawMetadata { impl Parse for RawMetadata {
fn parse(input: ParseStream<'_>) -> syn::Result<Self> { fn parse(input: ParseStream<'_>) -> syn::Result<Self> {
let metadata_kw = input.parse::<kw::metadata>()?; let metadata_kw = input.parse::<kw::metadata>()?;
input.parse::<Token![:]>()?;
let field_values; let field_values;
braced!(field_values in input); braced!(field_values in input);
@ -585,6 +586,7 @@ pub struct RawRequest {
impl Parse for RawRequest { impl Parse for RawRequest {
fn parse(input: ParseStream<'_>) -> syn::Result<Self> { fn parse(input: ParseStream<'_>) -> syn::Result<Self> {
let request_kw = input.parse::<kw::request>()?; let request_kw = input.parse::<kw::request>()?;
input.parse::<Token![:]>()?;
let fields; let fields;
braced!(fields in input); braced!(fields in input);
@ -606,6 +608,7 @@ pub struct RawResponse {
impl Parse for RawResponse { impl Parse for RawResponse {
fn parse(input: ParseStream<'_>) -> syn::Result<Self> { fn parse(input: ParseStream<'_>) -> syn::Result<Self> {
let response_kw = input.parse::<kw::response>()?; let response_kw = input.parse::<kw::response>()?;
input.parse::<Token![:]>()?;
let fields; let fields;
braced!(fields in input); braced!(fields in input);

View File

@ -23,7 +23,7 @@ use http::Method;
/// ///
/// ```text /// ```text
/// ruma_api! { /// ruma_api! {
/// metadata { /// metadata: {
/// description: &'static str, /// description: &'static str,
/// method: http::Method, /// method: http::Method,
/// name: &'static str, /// name: &'static str,
@ -32,15 +32,18 @@ use http::Method;
/// requires_authentication: bool, /// requires_authentication: bool,
/// } /// }
/// ///
/// request { /// request: {
/// // Struct fields for each piece of data required /// // Struct fields for each piece of data required
/// // to make a request to this API endpoint. /// // to make a request to this API endpoint.
/// } /// }
/// ///
/// response { /// response: {
/// // Struct fields for each piece of data expected /// // Struct fields for each piece of data expected
/// // in the response from this API endpoint. /// // in the response from this API endpoint.
/// } /// }
///
/// // The error returned when a response fails, defaults to `Void`.
/// error: path::to::Error
/// } /// }
/// ``` /// ```
/// ///
@ -129,7 +132,7 @@ use http::Method;
/// use ruma_api_macros::ruma_api; /// use ruma_api_macros::ruma_api;
/// ///
/// ruma_api! { /// ruma_api! {
/// metadata { /// metadata: {
/// description: "Does something.", /// description: "Does something.",
/// method: POST, /// method: POST,
/// name: "some_endpoint", /// name: "some_endpoint",
@ -138,7 +141,7 @@ use http::Method;
/// requires_authentication: false, /// requires_authentication: false,
/// } /// }
/// ///
/// request { /// request: {
/// pub foo: String, /// pub foo: String,
/// ///
/// #[ruma_api(header = CONTENT_TYPE)] /// #[ruma_api(header = CONTENT_TYPE)]
@ -151,7 +154,7 @@ use http::Method;
/// pub baz: String, /// pub baz: String,
/// } /// }
/// ///
/// response { /// response: {
/// #[ruma_api(header = CONTENT_TYPE)] /// #[ruma_api(header = CONTENT_TYPE)]
/// pub content_type: String, /// pub content_type: String,
/// ///
@ -170,7 +173,7 @@ use http::Method;
/// } /// }
/// ///
/// ruma_api! { /// ruma_api! {
/// metadata { /// metadata: {
/// description: "Does something.", /// description: "Does something.",
/// method: PUT, /// method: PUT,
/// name: "newtype_body_endpoint", /// name: "newtype_body_endpoint",
@ -179,12 +182,12 @@ use http::Method;
/// requires_authentication: false, /// requires_authentication: false,
/// } /// }
/// ///
/// request { /// request: {
/// #[ruma_api(raw_body)] /// #[ruma_api(raw_body)]
/// pub file: Vec<u8>, /// pub file: Vec<u8>,
/// } /// }
/// ///
/// response { /// response: {
/// #[ruma_api(body)] /// #[ruma_api(body)]
/// pub my_custom_type: MyCustomType, /// pub my_custom_type: MyCustomType,
/// } /// }

View File

@ -2,7 +2,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::UserId; use ruma_identifiers::UserId;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Does something.", description: "Does something.",
method: POST, method: POST,
name: "my_endpoint", name: "my_endpoint",
@ -11,7 +11,7 @@ ruma_api! {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
pub hello: String, pub hello: String,
#[ruma_api(header = CONTENT_TYPE)] #[ruma_api(header = CONTENT_TYPE)]
pub world: String, pub world: String,
@ -25,7 +25,7 @@ ruma_api! {
pub baz: UserId, pub baz: UserId,
} }
response { response: {
pub hello: String, pub hello: String,
#[ruma_api(header = CONTENT_TYPE)] #[ruma_api(header = CONTENT_TYPE)]
pub world: String, pub world: String,

View File

@ -3,7 +3,7 @@ use std::convert::TryFrom;
use ruma_api::ruma_api; use ruma_api::ruma_api;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Does something.", description: "Does something.",
method: GET, method: GET,
name: "no_fields", name: "no_fields",
@ -12,8 +12,8 @@ ruma_api! {
requires_authentication: false, requires_authentication: false,
} }
request {} request: {}
response {} response: {}
} }
#[test] #[test]

View File

@ -3,7 +3,7 @@ pub mod some_endpoint {
use ruma_events::{tag::TagEvent, AnyRoomEvent, EventJson}; use ruma_events::{tag::TagEvent, AnyRoomEvent, EventJson};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Does something.", description: "Does something.",
method: POST, // An `http::Method` constant. No imports required. method: POST, // An `http::Method` constant. No imports required.
name: "some_endpoint", name: "some_endpoint",
@ -12,7 +12,7 @@ pub mod some_endpoint {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
// With no attribute on the field, it will be put into the body of the request. // With no attribute on the field, it will be put into the body of the request.
pub foo: String, pub foo: String,
@ -30,7 +30,7 @@ pub mod some_endpoint {
pub baz: String, pub baz: String,
} }
response { response: {
// This value will be extracted from the "Content-Type" HTTP header. // This value will be extracted from the "Content-Type" HTTP header.
#[ruma_api(header = CONTENT_TYPE)] #[ruma_api(header = CONTENT_TYPE)]
pub content_type: String, pub content_type: String,
@ -60,7 +60,7 @@ pub mod newtype_body_endpoint {
} }
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Does something.", description: "Does something.",
method: PUT, method: PUT,
name: "newtype_body_endpoint", name: "newtype_body_endpoint",
@ -69,12 +69,12 @@ pub mod newtype_body_endpoint {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
#[ruma_api(body)] #[ruma_api(body)]
pub list_of_custom_things: Vec<MyCustomType>, pub list_of_custom_things: Vec<MyCustomType>,
} }
response { response: {
#[ruma_api(body)] #[ruma_api(body)]
pub my_custom_thing: MyCustomType, pub my_custom_thing: MyCustomType,
} }
@ -90,7 +90,7 @@ pub mod newtype_raw_body_endpoint {
} }
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Does something.", description: "Does something.",
method: PUT, method: PUT,
name: "newtype_body_endpoint", name: "newtype_body_endpoint",
@ -99,12 +99,12 @@ pub mod newtype_raw_body_endpoint {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
#[ruma_api(raw_body)] #[ruma_api(raw_body)]
pub file: Vec<u8>, pub file: Vec<u8>,
} }
response { response: {
#[ruma_api(raw_body)] #[ruma_api(raw_body)]
pub file: Vec<u8>, pub file: Vec<u8>,
} }
@ -115,7 +115,7 @@ pub mod query_map_endpoint {
use ruma_api::ruma_api; use ruma_api::ruma_api;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Does something.", description: "Does something.",
method: GET, method: GET,
name: "newtype_body_endpoint", name: "newtype_body_endpoint",
@ -124,12 +124,12 @@ pub mod query_map_endpoint {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
#[ruma_api(query_map)] #[ruma_api(query_map)]
pub fields: Vec<(String, String)>, pub fields: Vec<(String, String)>,
} }
response { response: {
} }
} }
} }

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_events::{AnyEvent, EventJson}; use ruma_events::{AnyEvent, EventJson};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "This API is called by the homeserver when it wants to push an event (or batch of events) to the application service.", description: "This API is called by the homeserver when it wants to push an event (or batch of events) to the application service.",
method: PUT, method: PUT,
name: "push_events", name: "push_events",
@ -13,7 +13,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The transaction ID for this set of events. /// The transaction ID for this set of events.
/// ///
/// Homeservers generate these IDs and they are used to ensure idempotency of results. /// Homeservers generate these IDs and they are used to ensure idempotency of results.
@ -24,5 +24,5 @@ ruma_api! {
pub events: Vec<EventJson<AnyEvent>>, pub events: Vec<EventJson<AnyEvent>>,
} }
response {} response: {}
} }

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::RoomAliasId; use ruma_identifiers::RoomAliasId;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "This endpoint is invoked by the homeserver on an application service to query the existence of a given room alias.", description: "This endpoint is invoked by the homeserver on an application service to query the existence of a given room alias.",
method: GET, method: GET,
name: "query_room_alias", name: "query_room_alias",
@ -13,11 +13,11 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The room alias being queried. /// The room alias being queried.
#[ruma_api(path)] #[ruma_api(path)]
pub room_alias: RoomAliasId, pub room_alias: RoomAliasId,
} }
response {} response: {}
} }

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::UserId; use ruma_identifiers::UserId;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "This endpoint is invoked by the homeserver on an application service to query the existence of a given user ID.", description: "This endpoint is invoked by the homeserver on an application service to query the existence of a given user ID.",
method: GET, method: GET,
name: "query_user_id", name: "query_user_id",
@ -13,11 +13,11 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The user ID being queried. /// The user ID being queried.
#[ruma_api(path)] #[ruma_api(path)]
pub user_id: UserId, pub user_id: UserId,
} }
response {} response: {}
} }

View File

@ -7,7 +7,7 @@ use ruma_api::ruma_api;
use super::Location; use super::Location;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Fetches third party locations for a protocol.", description: "Fetches third party locations for a protocol.",
method: GET, method: GET,
name: "get_location_for_protocol", name: "get_location_for_protocol",
@ -16,7 +16,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The protocol used to communicate to the third party network. /// The protocol used to communicate to the third party network.
#[ruma_api(path)] #[ruma_api(path)]
pub protocol: String, pub protocol: String,
@ -26,7 +26,7 @@ ruma_api! {
pub fields: BTreeMap<String, String>, pub fields: BTreeMap<String, String>,
} }
response { response: {
/// List of matched third party locations. /// List of matched third party locations.
#[ruma_api(body)] #[ruma_api(body)]
pub locations: Vec<Location>, pub locations: Vec<Location>,

View File

@ -6,7 +6,7 @@ use ruma_identifiers::RoomAliasId;
use super::Location; use super::Location;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Retrieve an array of third party network locations from a Matrix room alias.", description: "Retrieve an array of third party network locations from a Matrix room alias.",
method: GET, method: GET,
name: "get_location_for_room_alias", name: "get_location_for_room_alias",
@ -15,13 +15,13 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The Matrix room alias to look up. /// The Matrix room alias to look up.
#[ruma_api(query)] #[ruma_api(query)]
pub alias: RoomAliasId, pub alias: RoomAliasId,
} }
response { response: {
/// List of matched third party locations. /// List of matched third party locations.
#[ruma_api(body)] #[ruma_api(body)]
pub locations: Vec<Location>, pub locations: Vec<Location>,

View File

@ -5,7 +5,7 @@ use ruma_api::ruma_api;
use super::Protocol; use super::Protocol;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Fetches the metadata from the homeserver about a particular third party protocol.", description: "Fetches the metadata from the homeserver about a particular third party protocol.",
method: GET, method: GET,
name: "get_protocol", name: "get_protocol",
@ -14,13 +14,13 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The name of the protocol. /// The name of the protocol.
#[ruma_api(path)] #[ruma_api(path)]
pub protocol: String, pub protocol: String,
} }
response { response: {
/// Metadata about the protocol. /// Metadata about the protocol.
#[ruma_api(body)] #[ruma_api(body)]
pub protocol: Protocol, pub protocol: Protocol,

View File

@ -7,7 +7,7 @@ use ruma_api::ruma_api;
use super::User; use super::User;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Fetches third party users for a protocol.", description: "Fetches third party users for a protocol.",
method: GET, method: GET,
name: "get_user_for_protocol", name: "get_user_for_protocol",
@ -16,7 +16,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The protocol used to communicate to the third party network. /// The protocol used to communicate to the third party network.
#[ruma_api(path)] #[ruma_api(path)]
pub protocol: String, pub protocol: String,
@ -26,7 +26,7 @@ ruma_api! {
pub fields: BTreeMap<String, String>, pub fields: BTreeMap<String, String>,
} }
response { response: {
/// List of matched third party users. /// List of matched third party users.
#[ruma_api(body)] #[ruma_api(body)]
pub users: Vec<User>, pub users: Vec<User>,

View File

@ -6,7 +6,7 @@ use ruma_identifiers::UserId;
use super::User; use super::User;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Retrieve an array of third party users from a Matrix User ID.", description: "Retrieve an array of third party users from a Matrix User ID.",
method: GET, method: GET,
name: "get_user_for_user_id", name: "get_user_for_user_id",
@ -15,13 +15,13 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The Matrix User ID to look up. /// The Matrix User ID to look up.
#[ruma_api(query)] #[ruma_api(query)]
pub userid: UserId, pub userid: UserId,
} }
response { response: {
/// List of matched third party users. /// List of matched third party users.
#[ruma_api(body)] #[ruma_api(body)]
pub users: Vec<User>, pub users: Vec<User>,

View File

@ -5,7 +5,7 @@ use ruma_api::ruma_api;
use crate::r0::uiaa::{AuthData, UiaaResponse}; use crate::r0::uiaa::{AuthData, UiaaResponse};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Add contact information to a user's account", description: "Add contact information to a user's account",
method: POST, method: POST,
name: "add_3pid", name: "add_3pid",
@ -14,7 +14,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// Additional information for the User-Interactive Authentication API. /// Additional information for the User-Interactive Authentication API.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub auth: Option<AuthData>, pub auth: Option<AuthData>,
@ -26,7 +26,7 @@ ruma_api! {
pub sid: String, pub sid: String,
} }
response {} response: {}
error: UiaaResponse error: UiaaResponse
} }

View File

@ -5,7 +5,7 @@ use ruma_api::ruma_api;
use super::IdentityServerInfo; use super::IdentityServerInfo;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Bind a 3PID to a user's account on an identity server", description: "Bind a 3PID to a user's account on an identity server",
method: POST, method: POST,
name: "bind_3pid", name: "bind_3pid",
@ -14,7 +14,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// Client-generated secret string used to protect this session. /// Client-generated secret string used to protect this session.
pub client_secret: String, pub client_secret: String,
@ -27,7 +27,7 @@ ruma_api! {
pub sid: String, pub sid: String,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -5,7 +5,7 @@ use ruma_api::ruma_api;
use crate::r0::uiaa::{AuthData, UiaaResponse}; use crate::r0::uiaa::{AuthData, UiaaResponse};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Change the password of the current user's account.", description: "Change the password of the current user's account.",
method: POST, method: POST,
name: "change_password", name: "change_password",
@ -14,7 +14,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The new password for the account. /// The new password for the account.
pub new_password: String, pub new_password: String,
@ -22,7 +22,7 @@ ruma_api! {
pub auth: Option<AuthData>, pub auth: Option<AuthData>,
} }
response {} response: {}
error: UiaaResponse error: UiaaResponse
} }

View File

@ -7,7 +7,7 @@ use crate::r0::uiaa::{AuthData, UiaaResponse};
use super::ThirdPartyIdRemovalStatus; use super::ThirdPartyIdRemovalStatus;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Deactivate the current user's account.", description: "Deactivate the current user's account.",
method: POST, method: POST,
name: "deactivate", name: "deactivate",
@ -16,7 +16,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// Additional authentication information for the user-interactive authentication API. /// Additional authentication information for the user-interactive authentication API.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub auth: Option<AuthData>, pub auth: Option<AuthData>,
@ -27,7 +27,7 @@ ruma_api! {
pub id_server: Option<String>, pub id_server: Option<String>,
} }
response { response: {
/// Result of unbind operation. /// Result of unbind operation.
pub id_server_unbind_result: ThirdPartyIdRemovalStatus, pub id_server_unbind_result: ThirdPartyIdRemovalStatus,
} }

View File

@ -6,7 +6,7 @@ use super::ThirdPartyIdRemovalStatus;
use crate::r0::thirdparty::Medium; use crate::r0::thirdparty::Medium;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Delete a 3PID from a user's account on an identity server.", description: "Delete a 3PID from a user's account on an identity server.",
method: POST, method: POST,
name: "delete_3pid", name: "delete_3pid",
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// Identity server to delete from. /// Identity server to delete from.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub id_server: Option<String>, pub id_server: Option<String>,
@ -27,7 +27,7 @@ ruma_api! {
pub address: String, pub address: String,
} }
response { response: {
/// Result of unbind operation. /// Result of unbind operation.
pub id_server_unbind_result: ThirdPartyIdRemovalStatus, pub id_server_unbind_result: ThirdPartyIdRemovalStatus,
} }

View File

@ -3,7 +3,7 @@
use ruma_api::ruma_api; use ruma_api::ruma_api;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Checks to see if a username is available, and valid, for the server.", description: "Checks to see if a username is available, and valid, for the server.",
method: GET, method: GET,
name: "get_username_availability", name: "get_username_availability",
@ -12,13 +12,13 @@ ruma_api! {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
/// The username to check the availability of. /// The username to check the availability of.
#[ruma_api(query)] #[ruma_api(query)]
pub username: String, pub username: String,
} }
response { response: {
/// A flag to indicate that the username is available. /// A flag to indicate that the username is available.
/// This should always be true when the server replies with 200 OK. /// This should always be true when the server replies with 200 OK.
pub available: bool pub available: bool

View File

@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
use crate::r0::uiaa::{AuthData, UiaaResponse}; use crate::r0::uiaa::{AuthData, UiaaResponse};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Register an account on this homeserver.", description: "Register an account on this homeserver.",
method: POST, method: POST,
name: "register", name: "register",
@ -16,7 +16,7 @@ ruma_api! {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
/// The desired password for the account. /// The desired password for the account.
/// ///
/// May be empty for accounts that should not be able to log in again /// May be empty for accounts that should not be able to log in again
@ -65,7 +65,7 @@ ruma_api! {
pub inhibit_login: bool, pub inhibit_login: bool,
} }
response { response: {
/// An access token for the account. /// An access token for the account.
/// ///
/// This access token can then be used to authorize other requests. /// This access token can then be used to authorize other requests.

View File

@ -6,7 +6,7 @@ use ruma_api::ruma_api;
use super::IdentityServerInfo; use super::IdentityServerInfo;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Request a 3PID management token with a 3rd party email.", description: "Request a 3PID management token with a 3rd party email.",
method: POST, method: POST,
name: "request_3pid_association_token_via_email", name: "request_3pid_association_token_via_email",
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
/// Client-generated secret string used to protect this session. /// Client-generated secret string used to protect this session.
pub client_secret: String, pub client_secret: String,
@ -35,7 +35,7 @@ ruma_api! {
pub identity_server_info: Option<IdentityServerInfo>, pub identity_server_info: Option<IdentityServerInfo>,
} }
response { response: {
/// The session identifier given by the identity server. /// The session identifier given by the identity server.
pub sid: String, pub sid: String,

View File

@ -6,7 +6,7 @@ use ruma_api::ruma_api;
use super::IdentityServerInfo; use super::IdentityServerInfo;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Request a 3PID management token with a phone number.", description: "Request a 3PID management token with a phone number.",
method: POST, method: POST,
name: "request_3pid_association_token_via_msisdn", name: "request_3pid_association_token_via_msisdn",
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
/// Client-generated secret string used to protect this session. /// Client-generated secret string used to protect this session.
pub client_secret: String, pub client_secret: String,
@ -38,7 +38,7 @@ ruma_api! {
pub identity_server_info: Option<IdentityServerInfo>, pub identity_server_info: Option<IdentityServerInfo>,
} }
response { response: {
/// The session identifier given by the identity server. /// The session identifier given by the identity server.
pub sid: String, pub sid: String,

View File

@ -7,7 +7,7 @@ use ruma_identifiers::UserId;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Request an OpenID 1.0 token to verify identity with a third party.", description: "Request an OpenID 1.0 token to verify identity with a third party.",
name: "request_openid_token", name: "request_openid_token",
method: POST, method: POST,
@ -16,13 +16,13 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// User ID of authenticated user. /// User ID of authenticated user.
#[ruma_api(path)] #[ruma_api(path)]
pub user_id: UserId, pub user_id: UserId,
} }
response { response: {
/// Access token for verifying user's identity. /// Access token for verifying user's identity.
pub access_token: String, pub access_token: String,

View File

@ -6,7 +6,7 @@ use ruma_api::ruma_api;
use super::IdentityServerInfo; use super::IdentityServerInfo;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Request that a password change token is sent to the given email address.", description: "Request that a password change token is sent to the given email address.",
method: POST, method: POST,
name: "request_password_change_token_via_email", name: "request_password_change_token_via_email",
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
/// Client-generated secret string used to protect this session. /// Client-generated secret string used to protect this session.
pub client_secret: String, pub client_secret: String,
@ -35,7 +35,7 @@ ruma_api! {
pub identity_server_info: Option<IdentityServerInfo>, pub identity_server_info: Option<IdentityServerInfo>,
} }
response { response: {
/// The session identifier given by the identity server. /// The session identifier given by the identity server.
pub sid: String, pub sid: String,

View File

@ -4,7 +4,7 @@ use js_int::UInt;
use ruma_api::ruma_api; use ruma_api::ruma_api;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Request that a password change token is sent to the given phone number.", description: "Request that a password change token is sent to the given phone number.",
method: POST, method: POST,
name: "request_password_change_token_via_msisdn", name: "request_password_change_token_via_msisdn",
@ -13,7 +13,7 @@ ruma_api! {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
/// Client-generated secret string used to protect this session. /// Client-generated secret string used to protect this session.
pub client_secret: String, pub client_secret: String,
@ -31,7 +31,7 @@ ruma_api! {
pub next_link: Option<String>, pub next_link: Option<String>,
} }
response { response: {
/// The session identifier given by the identity server. /// The session identifier given by the identity server.
pub sid: String, pub sid: String,

View File

@ -6,7 +6,7 @@ use ruma_api::ruma_api;
use super::IdentityServerInfo; use super::IdentityServerInfo;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Request a registration token with a 3rd party email.", description: "Request a registration token with a 3rd party email.",
method: POST, method: POST,
name: "request_registration_token_via_email", name: "request_registration_token_via_email",
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
/// Client-generated secret string used to protect this session. /// Client-generated secret string used to protect this session.
pub client_secret: String, pub client_secret: String,
@ -35,7 +35,7 @@ ruma_api! {
pub identity_server_info: Option<IdentityServerInfo>, pub identity_server_info: Option<IdentityServerInfo>,
} }
response { response: {
/// The session identifier given by the identity server. /// The session identifier given by the identity server.
pub sid: String, pub sid: String,

View File

@ -6,7 +6,7 @@ use ruma_api::ruma_api;
use super::IdentityServerInfo; use super::IdentityServerInfo;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Request a registration token with a phone number.", description: "Request a registration token with a phone number.",
method: POST, method: POST,
name: "request_registration_token_via_msisdn", name: "request_registration_token_via_msisdn",
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
/// Client-generated secret string used to protect this session. /// Client-generated secret string used to protect this session.
pub client_secret: String, pub client_secret: String,
@ -38,7 +38,7 @@ ruma_api! {
pub identity_server_info: Option<IdentityServerInfo>, pub identity_server_info: Option<IdentityServerInfo>,
} }
response { response: {
/// The session identifier given by the identity server. /// The session identifier given by the identity server.
pub sid: String, pub sid: String,

View File

@ -6,7 +6,7 @@ use super::ThirdPartyIdRemovalStatus;
use crate::r0::thirdparty::Medium; use crate::r0::thirdparty::Medium;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Unbind a 3PID from a user's account on an identity server.", description: "Unbind a 3PID from a user's account on an identity server.",
method: POST, method: POST,
name: "unbind_3pid", name: "unbind_3pid",
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// Identity server to unbind from. /// Identity server to unbind from.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub id_server: Option<String>, pub id_server: Option<String>,
@ -27,7 +27,7 @@ ruma_api! {
pub address: String, pub address: String,
} }
response { response: {
/// Result of unbind operation. /// Result of unbind operation.
pub id_server_unbind_result: ThirdPartyIdRemovalStatus, pub id_server_unbind_result: ThirdPartyIdRemovalStatus,
} }

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::UserId; use ruma_identifiers::UserId;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Get information about the owner of a given access token.", description: "Get information about the owner of a given access token.",
method: GET, method: GET,
name: "whoami", name: "whoami",
@ -13,9 +13,9 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request {} request: {}
response { response: {
/// The id of the user that owns the access token. /// The id of the user that owns the access token.
pub user_id: UserId, pub user_id: UserId,
} }

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::{RoomAliasId, RoomId}; use ruma_identifiers::{RoomAliasId, RoomId};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Add an alias to a room.", description: "Add an alias to a room.",
method: PUT, method: PUT,
name: "create_alias", name: "create_alias",
@ -13,7 +13,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The room alias to set. /// The room alias to set.
#[ruma_api(path)] #[ruma_api(path)]
pub room_alias: RoomAliasId, pub room_alias: RoomAliasId,
@ -22,7 +22,7 @@ ruma_api! {
pub room_id: RoomId, pub room_id: RoomId,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::RoomAliasId; use ruma_identifiers::RoomAliasId;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Remove an alias from a room.", description: "Remove an alias from a room.",
method: DELETE, method: DELETE,
name: "delete_alias", name: "delete_alias",
@ -13,13 +13,13 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The room alias to remove. /// The room alias to remove.
#[ruma_api(path)] #[ruma_api(path)]
pub room_alias: RoomAliasId, pub room_alias: RoomAliasId,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::{RoomAliasId, RoomId}; use ruma_identifiers::{RoomAliasId, RoomId};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Resolve a room alias to a room ID.", description: "Resolve a room alias to a room ID.",
method: GET, method: GET,
name: "get_alias", name: "get_alias",
@ -13,13 +13,13 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The room alias. /// The room alias.
#[ruma_api(path)] #[ruma_api(path)]
pub room_alias: RoomAliasId, pub room_alias: RoomAliasId,
} }
response { response: {
/// The room ID for this room alias. /// The room ID for this room alias.
pub room_id: RoomId, pub room_id: RoomId,

View File

@ -6,7 +6,7 @@ use ruma_identifiers::RoomId;
use crate::r0::room::Visibility; use crate::r0::room::Visibility;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Updates the visibility of a given room on the application service's room directory.", description: "Updates the visibility of a given room on the application service's room directory.",
method: PUT, method: PUT,
name: "set_room_visibility", name: "set_room_visibility",
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The protocol (network) ID to update the room list for. /// The protocol (network) ID to update the room list for.
#[ruma_api(path)] #[ruma_api(path)]
pub network_id: String, pub network_id: String,
@ -28,7 +28,7 @@ ruma_api! {
pub visibility: Visibility, pub visibility: Visibility,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -7,7 +7,7 @@ use serde_json::Value as JsonValue;
use std::collections::BTreeMap; use std::collections::BTreeMap;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Gets information about the server's supported feature set and other relevant capabilities.", description: "Gets information about the server's supported feature set and other relevant capabilities.",
method: GET, method: GET,
name: "get_capabilities", name: "get_capabilities",
@ -16,9 +16,9 @@ ruma_api! {
requires_authentication: true requires_authentication: true
} }
request {} request: {}
response { response: {
/// The capabilities the server supports /// The capabilities the server supports
pub capabilities: Capabilities, pub capabilities: Capabilities,
} }

View File

@ -5,7 +5,7 @@ use ruma_events::{AnyBasicEvent, EventJson};
use ruma_identifiers::UserId; use ruma_identifiers::UserId;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Gets global account data for a user.", description: "Gets global account data for a user.",
name: "get_global_account_data", name: "get_global_account_data",
method: GET, method: GET,
@ -14,7 +14,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// User ID of user for whom to retrieve data. /// User ID of user for whom to retrieve data.
#[ruma_api(path)] #[ruma_api(path)]
pub user_id: UserId, pub user_id: UserId,
@ -24,7 +24,7 @@ ruma_api! {
pub event_type: String, pub event_type: String,
} }
response { response: {
/// Account data content for the given type. /// Account data content for the given type.
#[ruma_api(body)] #[ruma_api(body)]
pub account_data: EventJson<AnyBasicEvent>, pub account_data: EventJson<AnyBasicEvent>,

View File

@ -5,7 +5,7 @@ use ruma_events::{AnyBasicEvent, EventJson};
use ruma_identifiers::{RoomId, UserId}; use ruma_identifiers::{RoomId, UserId};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Gets account data room for a user for a given room", description: "Gets account data room for a user for a given room",
name: "get_room_account_data", name: "get_room_account_data",
method: GET, method: GET,
@ -14,7 +14,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// User ID of user for whom to retrieve data. /// User ID of user for whom to retrieve data.
#[ruma_api(path)] #[ruma_api(path)]
pub user_id: UserId, pub user_id: UserId,
@ -28,7 +28,7 @@ ruma_api! {
pub event_type: String, pub event_type: String,
} }
response { response: {
/// Account data content for the given type. /// Account data content for the given type.
#[ruma_api(body)] #[ruma_api(body)]
pub account_data: EventJson<AnyBasicEvent>, pub account_data: EventJson<AnyBasicEvent>,

View File

@ -5,7 +5,7 @@ use ruma_identifiers::UserId;
use serde_json::value::RawValue as RawJsonValue; use serde_json::value::RawValue as RawJsonValue;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Sets global account data.", description: "Sets global account data.",
method: PUT, method: PUT,
name: "set_global_account_data", name: "set_global_account_data",
@ -14,7 +14,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// Arbitrary JSON to store as config data. /// Arbitrary JSON to store as config data.
/// ///
/// To create a `Box<RawJsonValue>`, use `serde_json::value::to_raw_value`. /// To create a `Box<RawJsonValue>`, use `serde_json::value::to_raw_value`.
@ -34,7 +34,7 @@ ruma_api! {
pub user_id: UserId, pub user_id: UserId,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -5,7 +5,7 @@ use ruma_identifiers::{RoomId, UserId};
use serde_json::value::RawValue as RawJsonValue; use serde_json::value::RawValue as RawJsonValue;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Associate account data with a room.", description: "Associate account data with a room.",
method: PUT, method: PUT,
name: "set_room_account_data", name: "set_room_account_data",
@ -14,7 +14,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// Arbitrary JSON to store as config data. /// Arbitrary JSON to store as config data.
/// ///
/// To create a `Box<RawJsonValue>`, use `serde_json::value::to_raw_value`. /// To create a `Box<RawJsonValue>`, use `serde_json::value::to_raw_value`.
@ -38,7 +38,7 @@ ruma_api! {
pub user_id: UserId, pub user_id: UserId,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize};
use crate::r0::thirdparty::Medium; use crate::r0::thirdparty::Medium;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Get a list of 3rd party contacts associated with the user's account.", description: "Get a list of 3rd party contacts associated with the user's account.",
method: GET, method: GET,
name: "get_contacts", name: "get_contacts",
@ -17,9 +17,9 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request {} request: {}
response { response: {
/// A list of third party identifiers the homeserver has associated with the user's /// A list of third party identifiers the homeserver has associated with the user's
/// account. /// account.
#[serde(default, skip_serializing_if = "Vec::is_empty")] #[serde(default, skip_serializing_if = "Vec::is_empty")]

View File

@ -4,7 +4,7 @@ use js_int::UInt;
use ruma_api::ruma_api; use ruma_api::ruma_api;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Ask for a verification token for a given 3rd party ID.", description: "Ask for a verification token for a given 3rd party ID.",
method: POST, method: POST,
name: "request_contact_verification_token", name: "request_contact_verification_token",
@ -13,7 +13,7 @@ ruma_api! {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
/// Client-generated secret string used to protect this session. /// Client-generated secret string used to protect this session.
pub client_secret: String, pub client_secret: String,
@ -41,7 +41,7 @@ ruma_api! {
pub id_access_token: Option<String>, pub id_access_token: Option<String>,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -8,7 +8,7 @@ use ruma_identifiers::{EventId, RoomId};
use crate::r0::filter::RoomEventFilter; use crate::r0::filter::RoomEventFilter;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Get the events immediately preceding and following a given event.", description: "Get the events immediately preceding and following a given event.",
method: GET, method: GET,
path: "/_matrix/client/r0/rooms/:room_id/context/:event_id", path: "/_matrix/client/r0/rooms/:room_id/context/:event_id",
@ -17,7 +17,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The room to get events from. /// The room to get events from.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: RoomId,
@ -43,7 +43,7 @@ ruma_api! {
pub filter: Option<RoomEventFilter>, pub filter: Option<RoomEventFilter>,
} }
response { response: {
/// A token that can be used to paginate backwards with. /// A token that can be used to paginate backwards with.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub start: Option<String>, pub start: Option<String>,

View File

@ -6,7 +6,7 @@ use ruma_identifiers::DeviceId;
use crate::r0::uiaa::{AuthData, UiaaResponse}; use crate::r0::uiaa::{AuthData, UiaaResponse};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Delete a device for authenticated user.", description: "Delete a device for authenticated user.",
method: DELETE, method: DELETE,
name: "delete_device", name: "delete_device",
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The device to delete. /// The device to delete.
#[ruma_api(path)] #[ruma_api(path)]
pub device_id: DeviceId, pub device_id: DeviceId,
@ -25,7 +25,7 @@ ruma_api! {
pub auth: Option<AuthData>, pub auth: Option<AuthData>,
} }
response {} response: {}
error: UiaaResponse error: UiaaResponse
} }

View File

@ -6,7 +6,7 @@ use ruma_identifiers::DeviceId;
use crate::r0::uiaa::{AuthData, UiaaResponse}; use crate::r0::uiaa::{AuthData, UiaaResponse};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Delete specified devices.", description: "Delete specified devices.",
method: POST, method: POST,
path: "/_matrix/client/r0/delete_devices", path: "/_matrix/client/r0/delete_devices",
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// List of devices to delete. /// List of devices to delete.
pub devices: Vec<DeviceId>, pub devices: Vec<DeviceId>,
@ -24,7 +24,7 @@ ruma_api! {
pub auth: Option<AuthData>, pub auth: Option<AuthData>,
} }
response {} response: {}
error: UiaaResponse error: UiaaResponse
} }

View File

@ -5,7 +5,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::DeviceId; use ruma_identifiers::DeviceId;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Get a device for authenticated user.", description: "Get a device for authenticated user.",
method: GET, method: GET,
name: "get_device", name: "get_device",
@ -14,13 +14,13 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The device to retrieve. /// The device to retrieve.
#[ruma_api(path)] #[ruma_api(path)]
pub device_id: DeviceId, pub device_id: DeviceId,
} }
response { response: {
/// Information about the device. /// Information about the device.
#[ruma_api(body)] #[ruma_api(body)]
pub device: Device, pub device: Device,

View File

@ -4,7 +4,7 @@ use super::Device;
use ruma_api::ruma_api; use ruma_api::ruma_api;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Get registered devices for authenticated user.", description: "Get registered devices for authenticated user.",
method: GET, method: GET,
name: "get_devices", name: "get_devices",
@ -13,9 +13,9 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request {} request: {}
response { response: {
/// A list of all registered devices for this user /// A list of all registered devices for this user
pub devices: Vec<Device>, pub devices: Vec<Device>,
} }

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::DeviceId; use ruma_identifiers::DeviceId;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Update metadata for a device.", description: "Update metadata for a device.",
method: PUT, method: PUT,
name: "update_device", name: "update_device",
@ -13,7 +13,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The device to update. /// The device to update.
#[ruma_api(path)] #[ruma_api(path)]
pub device_id: DeviceId, pub device_id: DeviceId,
@ -24,7 +24,7 @@ ruma_api! {
pub display_name: Option<String>, pub display_name: Option<String>,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -6,7 +6,7 @@ use ruma_api::ruma_api;
use super::PublicRoomsChunk; use super::PublicRoomsChunk;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Get the list of rooms in this homeserver's public directory.", description: "Get the list of rooms in this homeserver's public directory.",
method: GET, method: GET,
name: "get_public_rooms", name: "get_public_rooms",
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
/// Limit for the number of results to return. /// Limit for the number of results to return.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
#[ruma_api(query)] #[ruma_api(query)]
@ -34,7 +34,7 @@ ruma_api! {
pub server: Option<String>, pub server: Option<String>,
} }
response { response: {
/// A paginated chunk of public rooms. /// A paginated chunk of public rooms.
pub chunk: Vec<PublicRoomsChunk>, pub chunk: Vec<PublicRoomsChunk>,

View File

@ -15,7 +15,7 @@ use serde_json::Value as JsonValue;
use super::PublicRoomsChunk; use super::PublicRoomsChunk;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Get the list of rooms in this homeserver's public directory.", description: "Get the list of rooms in this homeserver's public directory.",
method: POST, method: POST,
name: "get_public_rooms_filtered", name: "get_public_rooms_filtered",
@ -24,7 +24,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The server to fetch the public room lists from. /// The server to fetch the public room lists from.
/// ///
/// `None` means the server this request is sent to. /// `None` means the server this request is sent to.
@ -49,7 +49,7 @@ ruma_api! {
pub room_network: RoomNetwork, pub room_network: RoomNetwork,
} }
response { response: {
/// A paginated chunk of public rooms. /// A paginated chunk of public rooms.
pub chunk: Vec<PublicRoomsChunk>, pub chunk: Vec<PublicRoomsChunk>,

View File

@ -6,7 +6,7 @@ use ruma_identifiers::RoomId;
use crate::r0::room::Visibility; use crate::r0::room::Visibility;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Get the visibility of a public room on a directory.", description: "Get the visibility of a public room on a directory.",
name: "get_room_visibility", name: "get_room_visibility",
method: GET, method: GET,
@ -15,13 +15,13 @@ ruma_api! {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
/// The ID of the room of which to request the visibility. /// The ID of the room of which to request the visibility.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: RoomId,
} }
response { response: {
/// Visibility of the room. /// Visibility of the room.
pub visibility: Visibility, pub visibility: Visibility,
} }

View File

@ -6,7 +6,7 @@ use ruma_identifiers::RoomId;
use crate::r0::room::Visibility; use crate::r0::room::Visibility;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Set the visibility of a public room on a directory.", description: "Set the visibility of a public room on a directory.",
name: "set_room_visibility", name: "set_room_visibility",
method: PUT, method: PUT,
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The ID of the room of which to set the visibility. /// The ID of the room of which to set the visibility.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: RoomId,
@ -24,7 +24,7 @@ ruma_api! {
pub visibility: Visibility, pub visibility: Visibility,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -6,7 +6,7 @@ use ruma_identifiers::UserId;
use super::FilterDefinition; use super::FilterDefinition;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Create a new filter for event retrieval.", description: "Create a new filter for event retrieval.",
method: POST, method: POST,
name: "create_filter", name: "create_filter",
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The ID of the user uploading the filter. /// The ID of the user uploading the filter.
/// ///
/// The access token must be authorized to make requests for this user ID. /// The access token must be authorized to make requests for this user ID.
@ -27,7 +27,7 @@ ruma_api! {
pub filter: FilterDefinition, pub filter: FilterDefinition,
} }
response { response: {
/// The ID of the filter that was created. /// The ID of the filter that was created.
pub filter_id: String, pub filter_id: String,
} }

View File

@ -6,7 +6,7 @@ use ruma_identifiers::UserId;
use super::FilterDefinition; use super::FilterDefinition;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Retrieve a previously created filter.", description: "Retrieve a previously created filter.",
method: GET, method: GET,
name: "get_filter", name: "get_filter",
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The user ID to download a filter for. /// The user ID to download a filter for.
#[ruma_api(path)] #[ruma_api(path)]
pub user_id: UserId, pub user_id: UserId,
@ -25,7 +25,7 @@ ruma_api! {
pub filter_id: String, pub filter_id: String,
} }
response { response: {
/// The filter definition. /// The filter definition.
#[ruma_api(body)] #[ruma_api(body)]
pub filter: FilterDefinition, pub filter: FilterDefinition,

View File

@ -11,7 +11,7 @@ use serde_json::Value as JsonValue;
use super::{AlgorithmAndDeviceId, KeyAlgorithm, OneTimeKey}; use super::{AlgorithmAndDeviceId, KeyAlgorithm, OneTimeKey};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Claims one-time keys for use in pre-key messages.", description: "Claims one-time keys for use in pre-key messages.",
method: POST, method: POST,
name: "claim_keys", name: "claim_keys",
@ -20,7 +20,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The time (in milliseconds) to wait when downloading keys from remote servers. /// The time (in milliseconds) to wait when downloading keys from remote servers.
/// 10 seconds is the recommended default. /// 10 seconds is the recommended default.
#[serde( #[serde(
@ -34,7 +34,7 @@ ruma_api! {
pub one_time_keys: BTreeMap<UserId, BTreeMap<DeviceId, KeyAlgorithm>>, pub one_time_keys: BTreeMap<UserId, BTreeMap<DeviceId, KeyAlgorithm>>,
} }
response { response: {
/// If any remote homeservers could not be reached, they are recorded here. /// If any remote homeservers could not be reached, they are recorded here.
/// The names of the properties are the names of the unreachable servers. /// The names of the properties are the names of the unreachable servers.
pub failures: BTreeMap<String, JsonValue>, pub failures: BTreeMap<String, JsonValue>,

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::UserId; use ruma_identifiers::UserId;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Gets a list of users who have updated their device identity keys since a previous sync token.", description: "Gets a list of users who have updated their device identity keys since a previous sync token.",
method: GET, method: GET,
name: "get_key_changes", name: "get_key_changes",
@ -13,7 +13,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The desired start point of the list. /// The desired start point of the list.
/// Should be the next_batch field from a response to an earlier call to /sync. /// Should be the next_batch field from a response to an earlier call to /sync.
#[ruma_api(query)] #[ruma_api(query)]
@ -25,7 +25,7 @@ ruma_api! {
pub to: String, pub to: String,
} }
response { response: {
/// The Matrix User IDs of all users who updated their device identity keys. /// The Matrix User IDs of all users who updated their device identity keys.
pub changed: Vec<UserId>, pub changed: Vec<UserId>,

View File

@ -9,7 +9,7 @@ use serde_json::Value as JsonValue;
use super::DeviceKeys; use super::DeviceKeys;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Returns the current devices and identity keys for the given users.", description: "Returns the current devices and identity keys for the given users.",
method: POST, method: POST,
name: "get_keys", name: "get_keys",
@ -18,7 +18,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The time (in milliseconds) to wait when downloading keys from remote /// The time (in milliseconds) to wait when downloading keys from remote
/// servers. 10 seconds is the recommended default. /// servers. 10 seconds is the recommended default.
#[serde( #[serde(
@ -41,7 +41,7 @@ ruma_api! {
pub token: Option<String>, pub token: Option<String>,
} }
response { response: {
/// If any remote homeservers could not be reached, they are recorded /// If any remote homeservers could not be reached, they are recorded
/// here. The names of the properties are the names of the unreachable /// here. The names of the properties are the names of the unreachable
/// servers. /// servers.

View File

@ -8,7 +8,7 @@ use ruma_api::ruma_api;
use super::{AlgorithmAndDeviceId, DeviceKeys, KeyAlgorithm, OneTimeKey}; use super::{AlgorithmAndDeviceId, DeviceKeys, KeyAlgorithm, OneTimeKey};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Publishes end-to-end encryption keys for the device.", description: "Publishes end-to-end encryption keys for the device.",
method: POST, method: POST,
name: "upload_keys", name: "upload_keys",
@ -17,7 +17,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// Identity keys for the device. May be absent if no new identity keys are required. /// Identity keys for the device. May be absent if no new identity keys are required.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub device_keys: Option<DeviceKeys>, pub device_keys: Option<DeviceKeys>,
@ -27,7 +27,7 @@ ruma_api! {
pub one_time_keys: Option<BTreeMap<AlgorithmAndDeviceId, OneTimeKey>>, pub one_time_keys: Option<BTreeMap<AlgorithmAndDeviceId, OneTimeKey>>,
} }
response { response: {
/// For each key algorithm, the number of unclaimed one-time keys of that /// For each key algorithm, the number of unclaimed one-time keys of that
/// type currently held on the server for this device. /// type currently held on the server for this device.
pub one_time_key_counts: BTreeMap<KeyAlgorithm, UInt> pub one_time_key_counts: BTreeMap<KeyAlgorithm, UInt>

View File

@ -3,7 +3,7 @@
use ruma_api::ruma_api; use ruma_api::ruma_api;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Upload content to the media store.", description: "Upload content to the media store.",
method: POST, method: POST,
name: "create_media_content", name: "create_media_content",
@ -12,7 +12,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The name of the file being uploaded. /// The name of the file being uploaded.
#[ruma_api(query)] #[ruma_api(query)]
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -28,7 +28,7 @@ ruma_api! {
pub file: Vec<u8>, pub file: Vec<u8>,
} }
response { response: {
/// The MXC URI for the uploaded content. /// The MXC URI for the uploaded content.
pub content_uri: String, pub content_uri: String,
} }

View File

@ -3,7 +3,7 @@
use ruma_api::ruma_api; use ruma_api::ruma_api;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Retrieve content from the media store.", description: "Retrieve content from the media store.",
method: GET, method: GET,
name: "get_media_content", name: "get_media_content",
@ -12,7 +12,7 @@ ruma_api! {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
/// The media ID from the mxc:// URI (the path component). /// The media ID from the mxc:// URI (the path component).
#[ruma_api(path)] #[ruma_api(path)]
pub media_id: String, pub media_id: String,
@ -27,7 +27,7 @@ ruma_api! {
pub allow_remote: Option<bool>, pub allow_remote: Option<bool>,
} }
response { response: {
/// The content that was previously uploaded. /// The content that was previously uploaded.
#[ruma_api(raw_body)] #[ruma_api(raw_body)]
pub file: Vec<u8>, pub file: Vec<u8>,

View File

@ -3,7 +3,7 @@
use ruma_api::ruma_api; use ruma_api::ruma_api;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Retrieve content from the media store, specifying a filename to return.", description: "Retrieve content from the media store, specifying a filename to return.",
method: GET, method: GET,
name: "get_media_content_as_filename", name: "get_media_content_as_filename",
@ -12,7 +12,7 @@ ruma_api! {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
/// The media ID from the mxc:// URI (the path component). /// The media ID from the mxc:// URI (the path component).
#[ruma_api(path)] #[ruma_api(path)]
pub media_id: String, pub media_id: String,
@ -31,7 +31,7 @@ ruma_api! {
pub allow_remote: Option<bool>, pub allow_remote: Option<bool>,
} }
response { response: {
/// The content that was previously uploaded. /// The content that was previously uploaded.
#[ruma_api(raw_body)] #[ruma_api(raw_body)]
pub file: Vec<u8>, pub file: Vec<u8>,

View File

@ -16,7 +16,7 @@ pub enum Method {
} }
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Get a thumbnail of content from the media store.", description: "Get a thumbnail of content from the media store.",
method: GET, method: GET,
name: "get_content_thumbnail", name: "get_content_thumbnail",
@ -25,7 +25,7 @@ ruma_api! {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
/// Whether to fetch media deemed remote. /// Whether to fetch media deemed remote.
/// ///
/// Used to prevent routing loops. Defaults to `true`. /// Used to prevent routing loops. Defaults to `true`.
@ -57,7 +57,7 @@ ruma_api! {
pub width: UInt, pub width: UInt,
} }
response { response: {
/// The content type of the thumbnail. /// The content type of the thumbnail.
#[ruma_api(header = CONTENT_TYPE)] #[ruma_api(header = CONTENT_TYPE)]
pub content_type: String, pub content_type: String,

View File

@ -4,7 +4,7 @@ use js_int::UInt;
use ruma_api::ruma_api; use ruma_api::ruma_api;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Gets the config for the media repository.", description: "Gets the config for the media repository.",
method: GET, method: GET,
path: "/_matrix/media/r0/config", path: "/_matrix/media/r0/config",
@ -13,9 +13,9 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request {} request: {}
response { response: {
/// Maximum size of upload in bytes. /// Maximum size of upload in bytes.
#[serde(rename = "m.upload.size")] #[serde(rename = "m.upload.size")]
pub upload_size: UInt, pub upload_size: UInt,

View File

@ -6,7 +6,7 @@ use ruma_api::ruma_api;
use serde_json::value::RawValue as RawJsonValue; use serde_json::value::RawValue as RawJsonValue;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Get a preview for a URL.", description: "Get a preview for a URL.",
name: "get_media_preview", name: "get_media_preview",
method: GET, method: GET,
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// URL to get a preview of. /// URL to get a preview of.
#[ruma_api(query)] #[ruma_api(query)]
pub url: String, pub url: String,
@ -26,7 +26,7 @@ ruma_api! {
pub ts: SystemTime, pub ts: SystemTime,
} }
response { response: {
/// OpenGraph-like data for the URL. /// OpenGraph-like data for the URL.
/// ///
/// Differences from OpenGraph: the image size in bytes is added to the `matrix:image:size` /// Differences from OpenGraph: the image size in bytes is added to the `matrix:image:size`

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::{RoomId, UserId}; use ruma_identifiers::{RoomId, UserId};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Ban a user from a room.", description: "Ban a user from a room.",
method: POST, method: POST,
name: "ban_user", name: "ban_user",
@ -13,7 +13,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The room to kick the user from. /// The room to kick the user from.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: RoomId,
@ -26,7 +26,7 @@ ruma_api! {
pub reason: Option<String>, pub reason: Option<String>,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::RoomId; use ruma_identifiers::RoomId;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Forget a room.", description: "Forget a room.",
method: POST, method: POST,
name: "forget_room", name: "forget_room",
@ -13,13 +13,13 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The room to forget. /// The room to forget.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: RoomId,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -6,7 +6,7 @@ use ruma_identifiers::RoomId;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Get membership events for a room.", description: "Get membership events for a room.",
method: GET, method: GET,
name: "get_member_events", name: "get_member_events",
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The room to get the member events for. /// The room to get the member events for.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: RoomId,
@ -40,7 +40,7 @@ ruma_api! {
pub not_membership: Option<MembershipEventFilter>, pub not_membership: Option<MembershipEventFilter>,
} }
response { response: {
/// A list of member events. /// A list of member events.
pub chunk: Vec<EventJson<MemberEvent>> pub chunk: Vec<EventJson<MemberEvent>>
} }

View File

@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
use super::Invite3pid; use super::Invite3pid;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Invite a user to a room.", description: "Invite a user to a room.",
method: POST, method: POST,
name: "invite_user", name: "invite_user",
@ -22,7 +22,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The room where the user should be invited. /// The room where the user should be invited.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: RoomId,
@ -32,7 +32,7 @@ ruma_api! {
pub recipient: InvitationRecipient, pub recipient: InvitationRecipient,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -6,7 +6,7 @@ use ruma_identifiers::RoomId;
use super::ThirdPartySigned; use super::ThirdPartySigned;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Join a room using its ID.", description: "Join a room using its ID.",
method: POST, method: POST,
name: "join_room_by_id", name: "join_room_by_id",
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The room where the user should be invited. /// The room where the user should be invited.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: RoomId,
@ -26,7 +26,7 @@ ruma_api! {
pub third_party_signed: Option<ThirdPartySigned>, pub third_party_signed: Option<ThirdPartySigned>,
} }
response { response: {
/// The room that the user joined. /// The room that the user joined.
pub room_id: RoomId, pub room_id: RoomId,
} }

View File

@ -6,7 +6,7 @@ use ruma_identifiers::{RoomId, RoomIdOrAliasId};
use super::ThirdPartySigned; use super::ThirdPartySigned;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Join a room using its ID or one of its aliases.", description: "Join a room using its ID or one of its aliases.",
method: POST, method: POST,
name: "join_room_by_id_or_alias", name: "join_room_by_id_or_alias",
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The room where the user should be invited. /// The room where the user should be invited.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id_or_alias: RoomIdOrAliasId, pub room_id_or_alias: RoomIdOrAliasId,
@ -32,7 +32,7 @@ ruma_api! {
pub third_party_signed: Option<ThirdPartySigned>, pub third_party_signed: Option<ThirdPartySigned>,
} }
response { response: {
/// The room that the user joined. /// The room that the user joined.
pub room_id: RoomId, pub room_id: RoomId,
} }

View File

@ -7,7 +7,7 @@ use ruma_identifiers::{RoomId, UserId};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Get a map of user ids to member info objects for members of the room. Primarily for use in Application Services.", description: "Get a map of user ids to member info objects for members of the room. Primarily for use in Application Services.",
method: GET, method: GET,
name: "joined_members", name: "joined_members",
@ -16,13 +16,13 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The room to get the members of. /// The room to get the members of.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: RoomId,
} }
response { response: {
/// A list of the rooms the user is in, i.e. /// A list of the rooms the user is in, i.e.
/// the ID of each room in which the user has joined membership. /// the ID of each room in which the user has joined membership.
pub joined: BTreeMap<UserId, RoomMember>, pub joined: BTreeMap<UserId, RoomMember>,

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::RoomId; use ruma_identifiers::RoomId;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Get a list of the user's current rooms.", description: "Get a list of the user's current rooms.",
method: GET, method: GET,
name: "joined_rooms", name: "joined_rooms",
@ -13,9 +13,9 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request {} request: {}
response { response: {
/// A list of the rooms the user is in, i.e. the ID of each room in /// A list of the rooms the user is in, i.e. the ID of each room in
/// which the user has joined membership. /// which the user has joined membership.
pub joined_rooms: Vec<RoomId>, pub joined_rooms: Vec<RoomId>,

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::{RoomId, UserId}; use ruma_identifiers::{RoomId, UserId};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Kick a user from a room.", description: "Kick a user from a room.",
method: POST, method: POST,
name: "kick_user", name: "kick_user",
@ -13,7 +13,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The room to kick the user from. /// The room to kick the user from.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: RoomId,
@ -26,7 +26,7 @@ ruma_api! {
pub reason: Option<String>, pub reason: Option<String>,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::RoomId; use ruma_identifiers::RoomId;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Leave a room.", description: "Leave a room.",
method: POST, method: POST,
name: "leave_room", name: "leave_room",
@ -13,13 +13,13 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The room to leave. /// The room to leave.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: RoomId,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::{RoomId, UserId}; use ruma_identifiers::{RoomId, UserId};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Unban a user from a room.", description: "Unban a user from a room.",
method: POST, method: POST,
name: "unban_user", name: "unban_user",
@ -13,7 +13,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The room to unban the user from. /// The room to unban the user from.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: RoomId,
@ -22,7 +22,7 @@ ruma_api! {
pub user_id: UserId, pub user_id: UserId,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -6,7 +6,7 @@ use ruma_identifiers::{EventId, RoomId};
use serde_json::value::RawValue as RawJsonValue; use serde_json::value::RawValue as RawJsonValue;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Send a message event to a room.", description: "Send a message event to a room.",
method: PUT, method: PUT,
name: "create_message_event", name: "create_message_event",
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The room to send the event to. /// The room to send the event to.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: RoomId,
@ -39,7 +39,7 @@ ruma_api! {
pub data: Box<RawJsonValue>, pub data: Box<RawJsonValue>,
} }
response { response: {
/// A unique identifier for the event. /// A unique identifier for the event.
pub event_id: EventId, pub event_id: EventId,
} }

View File

@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize};
use crate::r0::filter::RoomEventFilter; use crate::r0::filter::RoomEventFilter;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Get message events for a room.", description: "Get message events for a room.",
method: GET, method: GET,
name: "get_message_events", name: "get_message_events",
@ -18,7 +18,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The room to get events from. /// The room to get events from.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: RoomId,
@ -61,7 +61,7 @@ ruma_api! {
pub filter: Option<RoomEventFilter>, pub filter: Option<RoomEventFilter>,
} }
response { response: {
/// The token the pagination starts from. /// The token the pagination starts from.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub start: Option<String>, pub start: Option<String>,

View File

@ -7,7 +7,7 @@ use ruma_events::presence::PresenceState;
use ruma_identifiers::UserId; use ruma_identifiers::UserId;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Get presence status for this user.", description: "Get presence status for this user.",
method: GET, method: GET,
name: "get_presence", name: "get_presence",
@ -16,13 +16,13 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The user whose presence state will be retrieved. /// The user whose presence state will be retrieved.
#[ruma_api(path)] #[ruma_api(path)]
pub user_id: UserId, pub user_id: UserId,
} }
response { response: {
/// The state message for this user if one was set. /// The state message for this user if one was set.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub status_msg: Option<String>, pub status_msg: Option<String>,

View File

@ -5,7 +5,7 @@ use ruma_events::presence::PresenceState;
use ruma_identifiers::UserId; use ruma_identifiers::UserId;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Set presence status for this user.", description: "Set presence status for this user.",
method: PUT, method: PUT,
name: "set_presence", name: "set_presence",
@ -14,7 +14,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The user whose presence state will be updated. /// The user whose presence state will be updated.
#[ruma_api(path)] #[ruma_api(path)]
pub user_id: UserId, pub user_id: UserId,
@ -27,7 +27,7 @@ ruma_api! {
pub status_msg: Option<String>, pub status_msg: Option<String>,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::UserId; use ruma_identifiers::UserId;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Get the avatar URL of a user.", description: "Get the avatar URL of a user.",
method: GET, method: GET,
name: "get_avatar_url", name: "get_avatar_url",
@ -13,13 +13,13 @@ ruma_api! {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
/// The user whose avatar URL will be retrieved. /// The user whose avatar URL will be retrieved.
#[ruma_api(path)] #[ruma_api(path)]
pub user_id: UserId pub user_id: UserId
} }
response { response: {
/// The user's avatar URL, if set. /// The user's avatar URL, if set.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub avatar_url: Option<String> pub avatar_url: Option<String>

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::UserId; use ruma_identifiers::UserId;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Get the display name of a user.", description: "Get the display name of a user.",
method: GET, method: GET,
name: "get_display_name", name: "get_display_name",
@ -13,13 +13,13 @@ ruma_api! {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
/// The user whose display name will be retrieved. /// The user whose display name will be retrieved.
#[ruma_api(path)] #[ruma_api(path)]
pub user_id: UserId pub user_id: UserId
} }
response { response: {
/// The user's display name, if set. /// The user's display name, if set.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub displayname: Option<String> pub displayname: Option<String>

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::UserId; use ruma_identifiers::UserId;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Get all profile information of an user.", description: "Get all profile information of an user.",
method: GET, method: GET,
name: "get_profile", name: "get_profile",
@ -13,13 +13,13 @@ ruma_api! {
requires_authentication: false, requires_authentication: false,
} }
request { request: {
/// The user whose profile will be retrieved. /// The user whose profile will be retrieved.
#[ruma_api(path)] #[ruma_api(path)]
pub user_id: UserId, pub user_id: UserId,
} }
response { response: {
/// The user's avatar URL, if set. /// The user's avatar URL, if set.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub avatar_url: Option<String>, pub avatar_url: Option<String>,

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::UserId; use ruma_identifiers::UserId;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Set the avatar URL of the user.", description: "Set the avatar URL of the user.",
method: PUT, method: PUT,
name: "set_avatar_url", name: "set_avatar_url",
@ -13,7 +13,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The user whose avatar URL will be set. /// The user whose avatar URL will be set.
#[ruma_api(path)] #[ruma_api(path)]
pub user_id: UserId, pub user_id: UserId,
@ -24,7 +24,7 @@ ruma_api! {
pub avatar_url: Option<String>, pub avatar_url: Option<String>,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::UserId; use ruma_identifiers::UserId;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Set the display name of the user.", description: "Set the display name of the user.",
method: PUT, method: PUT,
name: "set_display_name", name: "set_display_name",
@ -13,7 +13,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The user whose display name will be set. /// The user whose display name will be set.
#[ruma_api(path)] #[ruma_api(path)]
pub user_id: UserId, pub user_id: UserId,
@ -23,7 +23,7 @@ ruma_api! {
pub displayname: Option<String>, pub displayname: Option<String>,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -5,7 +5,7 @@ use ruma_api::ruma_api;
use super::RuleKind; use super::RuleKind;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "This endpoint removes the push rule defined in the path.", description: "This endpoint removes the push rule defined in the path.",
method: DELETE, method: DELETE,
name: "delete_pushrule", name: "delete_pushrule",
@ -14,7 +14,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The scope to delete from. 'global' to specify global rules. /// The scope to delete from. 'global' to specify global rules.
#[ruma_api(path)] #[ruma_api(path)]
pub scope: String, pub scope: String,
@ -28,7 +28,7 @@ ruma_api! {
pub rule_id: String, pub rule_id: String,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize};
use super::Action; use super::Action;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Paginate through the list of events that the user has been, or would have been notified about.", description: "Paginate through the list of events that the user has been, or would have been notified about.",
method: GET, method: GET,
name: "get_notifications", name: "get_notifications",
@ -20,7 +20,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// Pagination token given to retrieve the next set of events. /// Pagination token given to retrieve the next set of events.
#[ruma_api(query)] #[ruma_api(query)]
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -38,7 +38,7 @@ ruma_api! {
pub only: Option<String> pub only: Option<String>
} }
response { response: {
/// The token to supply in the from param of the next /notifications request in order /// The token to supply in the from param of the next /notifications request in order
/// to request more events. If this is absent, there are no more results. /// to request more events. If this is absent, there are no more results.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]

View File

@ -5,7 +5,7 @@ use ruma_api::ruma_api;
use super::Pusher; use super::Pusher;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Gets all currently active pushers for the authenticated user.", description: "Gets all currently active pushers for the authenticated user.",
method: GET, method: GET,
name: "get_pushers", name: "get_pushers",
@ -14,9 +14,9 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request {} request: {}
response { response: {
/// An array containing the current pushers for the user. /// An array containing the current pushers for the user.
pub pushers: Vec<Pusher> pub pushers: Vec<Pusher>
} }

View File

@ -5,7 +5,7 @@ use ruma_api::ruma_api;
use super::{PushRule, RuleKind}; use super::{PushRule, RuleKind};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Retrieve a single specified push rule.", description: "Retrieve a single specified push rule.",
method: GET, method: GET,
name: "get_pushrule", name: "get_pushrule",
@ -14,7 +14,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The scope to fetch rules from. 'global' to specify global rules. /// The scope to fetch rules from. 'global' to specify global rules.
#[ruma_api(path)] #[ruma_api(path)]
pub scope: String, pub scope: String,
@ -28,7 +28,7 @@ ruma_api! {
pub rule_id: String, pub rule_id: String,
} }
response { response: {
/// The specific push rule. /// The specific push rule.
#[ruma_api(body)] #[ruma_api(body)]
pub rule: PushRule pub rule: PushRule

View File

@ -5,7 +5,7 @@ use ruma_api::ruma_api;
use super::{Action, RuleKind}; use super::{Action, RuleKind};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "This endpoint get the actions for the specified push rule.", description: "This endpoint get the actions for the specified push rule.",
method: GET, method: GET,
name: "get_pushrule_actions", name: "get_pushrule_actions",
@ -14,7 +14,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The scope to fetch a rule from. 'global' to specify global rules. /// The scope to fetch a rule from. 'global' to specify global rules.
#[ruma_api(path)] #[ruma_api(path)]
pub scope: String, pub scope: String,
@ -28,7 +28,7 @@ ruma_api! {
pub rule_id: String, pub rule_id: String,
} }
response { response: {
/// The actions to perform for this rule. /// The actions to perform for this rule.
pub actions: Vec<Action> pub actions: Vec<Action>
} }

View File

@ -5,7 +5,7 @@ use ruma_api::ruma_api;
use super::RuleKind; use super::RuleKind;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "This endpoint gets whether the specified push rule is enabled.", description: "This endpoint gets whether the specified push rule is enabled.",
method: GET, method: GET,
name: "get_pushrule_enabled", name: "get_pushrule_enabled",
@ -14,7 +14,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The scope to fetch a rule from. 'global' to specify global rules. /// The scope to fetch a rule from. 'global' to specify global rules.
#[ruma_api(path)] #[ruma_api(path)]
pub scope: String, pub scope: String,
@ -28,7 +28,7 @@ ruma_api! {
pub rule_id: String, pub rule_id: String,
} }
response { response: {
/// Whether the push rule is enabled or not. /// Whether the push rule is enabled or not.
pub enabled: bool pub enabled: bool
} }

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_common::push::Ruleset; use ruma_common::push::Ruleset;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Retrieve all push rulesets for this user.", description: "Retrieve all push rulesets for this user.",
method: GET, method: GET,
name: "get_pushrules_all", name: "get_pushrules_all",
@ -13,9 +13,9 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request {} request: {}
response { response: {
/// The global ruleset /// The global ruleset
pub global: Ruleset, pub global: Ruleset,
} }

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_common::push::Ruleset; use ruma_common::push::Ruleset;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Retrieve all push rulesets in the global scope for this user.", description: "Retrieve all push rulesets in the global scope for this user.",
method: GET, method: GET,
name: "get_pushrules_global_scope", name: "get_pushrules_global_scope",
@ -13,9 +13,9 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request {} request: {}
response { response: {
/// The global ruleset. /// The global ruleset.
#[ruma_api(body)] #[ruma_api(body)]
pub global: Ruleset, pub global: Ruleset,

View File

@ -5,7 +5,7 @@ use ruma_api::ruma_api;
use super::Pusher; use super::Pusher;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "This endpoint allows the creation, modification and deletion of pushers for this user ID.", description: "This endpoint allows the creation, modification and deletion of pushers for this user ID.",
method: POST, method: POST,
name: "set_pusher", name: "set_pusher",
@ -14,7 +14,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The pusher to configure /// The pusher to configure
#[serde(flatten)] #[serde(flatten)]
pub pusher: Pusher, pub pusher: Pusher,
@ -26,7 +26,7 @@ ruma_api! {
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -5,7 +5,7 @@ use ruma_api::ruma_api;
use super::{Action, PushCondition, RuleKind}; use super::{Action, PushCondition, RuleKind};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "This endpoint allows the creation, modification and deletion of pushers for this user ID.", description: "This endpoint allows the creation, modification and deletion of pushers for this user ID.",
method: PUT, method: PUT,
name: "set_pushrule", name: "set_pushrule",
@ -14,7 +14,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The scope to set the rule in. 'global' to specify global rules. /// The scope to set the rule in. 'global' to specify global rules.
#[ruma_api(path)] #[ruma_api(path)]
pub scope: String, pub scope: String,
@ -48,7 +48,7 @@ ruma_api! {
pub pattern: Option<String>, pub pattern: Option<String>,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -5,7 +5,7 @@ use ruma_api::ruma_api;
use super::{Action, RuleKind}; use super::{Action, RuleKind};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "This endpoint allows clients to change the actions of a push rule. This can be used to change the actions of builtin rules.", description: "This endpoint allows clients to change the actions of a push rule. This can be used to change the actions of builtin rules.",
method: PUT, method: PUT,
name: "set_pushrule_actions", name: "set_pushrule_actions",
@ -14,7 +14,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The scope to fetch a rule from. 'global' to specify global rules. /// The scope to fetch a rule from. 'global' to specify global rules.
#[ruma_api(path)] #[ruma_api(path)]
pub scope: String, pub scope: String,
@ -31,7 +31,7 @@ ruma_api! {
pub actions: Vec<Action> pub actions: Vec<Action>
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -5,7 +5,7 @@ use ruma_api::ruma_api;
use super::RuleKind; use super::RuleKind;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "This endpoint allows clients to enable or disable the specified push rule.", description: "This endpoint allows clients to enable or disable the specified push rule.",
method: PUT, method: PUT,
name: "set_pushrule_enabled", name: "set_pushrule_enabled",
@ -14,7 +14,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The scope to fetch a rule from. 'global' to specify global rules. /// The scope to fetch a rule from. 'global' to specify global rules.
#[ruma_api(path)] #[ruma_api(path)]
pub scope: String, pub scope: String,
@ -31,7 +31,7 @@ ruma_api! {
pub enabled: bool pub enabled: bool
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::{EventId, RoomId}; use ruma_identifiers::{EventId, RoomId};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Sets the position of the read marker for a given room, and optionally the read receipt's location.", description: "Sets the position of the read marker for a given room, and optionally the read receipt's location.",
method: POST, method: POST,
name: "set_read_marker", name: "set_read_marker",
@ -13,7 +13,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The room ID to set the read marker in for the user. /// The room ID to set the read marker in for the user.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: RoomId,
@ -31,7 +31,7 @@ ruma_api! {
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -7,7 +7,7 @@ use ruma_identifiers::{EventId, RoomId};
use strum::{Display, EnumString}; use strum::{Display, EnumString};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Send a receipt event to a room.", description: "Send a receipt event to a room.",
method: POST, method: POST,
name: "create_receipt", name: "create_receipt",
@ -16,7 +16,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The room in which to send the event. /// The room in which to send the event.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: RoomId,
@ -30,7 +30,7 @@ ruma_api! {
pub event_id: EventId, pub event_id: EventId,
} }
response {} response: {}
error: crate::Error error: crate::Error
} }

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::{EventId, RoomId}; use ruma_identifiers::{EventId, RoomId};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Redact an event, stripping all information not critical to the event graph integrity.", description: "Redact an event, stripping all information not critical to the event graph integrity.",
method: PUT, method: PUT,
name: "redact_event", name: "redact_event",
@ -13,7 +13,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The ID of the room of the event to redact. /// The ID of the room of the event to redact.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: RoomId,
@ -33,7 +33,7 @@ ruma_api! {
pub reason: Option<String>, pub reason: Option<String>,
} }
response { response: {
/// The ID of the redacted event. /// The ID of the redacted event.
pub event_id: EventId, pub event_id: EventId,
} }

View File

@ -16,7 +16,7 @@ use super::Visibility;
use crate::r0::membership::Invite3pid; use crate::r0::membership::Invite3pid;
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Create a new room.", description: "Create a new room.",
method: POST, method: POST,
name: "create_room", name: "create_room",
@ -25,7 +25,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// Extra keys to be added to the content of the `m.room.create`. /// Extra keys to be added to the content of the `m.room.create`.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub creation_content: Option<CreationContent>, pub creation_content: Option<CreationContent>,
@ -84,7 +84,7 @@ ruma_api! {
pub visibility: Option<Visibility>, pub visibility: Option<Visibility>,
} }
response { response: {
/// The created room's ID. /// The created room's ID.
pub room_id: RoomId, pub room_id: RoomId,
} }

View File

@ -5,7 +5,7 @@ use ruma_events::{AnyRoomEvent, EventJson};
use ruma_identifiers::{EventId, RoomId}; use ruma_identifiers::{EventId, RoomId};
ruma_api! { ruma_api! {
metadata { metadata: {
description: "Get a single event based on roomId/eventId", description: "Get a single event based on roomId/eventId",
method: GET, method: GET,
name: "get_room_event", name: "get_room_event",
@ -14,7 +14,7 @@ ruma_api! {
requires_authentication: true, requires_authentication: true,
} }
request { request: {
/// The ID of the room the event is in. /// The ID of the room the event is in.
#[ruma_api(path)] #[ruma_api(path)]
pub room_id: RoomId, pub room_id: RoomId,
@ -24,7 +24,7 @@ ruma_api! {
pub event_id: EventId, pub event_id: EventId,
} }
response { response: {
/// Arbitrary JSON of the event body. Returns both room and state events. /// Arbitrary JSON of the event body. Returns both room and state events.
#[ruma_api(body)] #[ruma_api(body)]
pub event: EventJson<AnyRoomEvent>, pub event: EventJson<AnyRoomEvent>,

Some files were not shown because too many files have changed in this diff Show More