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;
ruma_api! {
metadata {
metadata: {
description: "Does something.",
method: GET, // An `http::Method` constant. No imports required.
name: "some_endpoint",
@ -23,7 +23,7 @@ pub mod some_endpoint {
requires_authentication: false,
}
request {
request: {
// With no attribute on the field, it will be put into the body of the request.
pub foo: String,
@ -41,7 +41,7 @@ pub mod some_endpoint {
pub baz: String,
}
response {
response: {
// This value will be extracted from the "Content-Type" HTTP header.
#[ruma_api(header = CONTENT_TYPE)]
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.
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 {
fn parse(input: ParseStream<'_>) -> syn::Result<Self> {
let metadata_kw = input.parse::<kw::metadata>()?;
input.parse::<Token![:]>()?;
let field_values;
braced!(field_values in input);
@ -585,6 +586,7 @@ pub struct RawRequest {
impl Parse for RawRequest {
fn parse(input: ParseStream<'_>) -> syn::Result<Self> {
let request_kw = input.parse::<kw::request>()?;
input.parse::<Token![:]>()?;
let fields;
braced!(fields in input);
@ -606,6 +608,7 @@ pub struct RawResponse {
impl Parse for RawResponse {
fn parse(input: ParseStream<'_>) -> syn::Result<Self> {
let response_kw = input.parse::<kw::response>()?;
input.parse::<Token![:]>()?;
let fields;
braced!(fields in input);

View File

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

View File

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

View File

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

View File

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

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_events::{AnyEvent, EventJson};
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.",
method: PUT,
name: "push_events",
@ -13,7 +13,7 @@ ruma_api! {
requires_authentication: true,
}
request {
request: {
/// The transaction ID for this set of events.
///
/// Homeservers generate these IDs and they are used to ensure idempotency of results.
@ -24,5 +24,5 @@ ruma_api! {
pub events: Vec<EventJson<AnyEvent>>,
}
response {}
response: {}
}

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::RoomAliasId;
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.",
method: GET,
name: "query_room_alias",
@ -13,11 +13,11 @@ ruma_api! {
requires_authentication: true,
}
request {
request: {
/// The room alias being queried.
#[ruma_api(path)]
pub room_alias: RoomAliasId,
}
response {}
response: {}
}

View File

@ -4,7 +4,7 @@ use ruma_api::ruma_api;
use ruma_identifiers::UserId;
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.",
method: GET,
name: "query_user_id",
@ -13,11 +13,11 @@ ruma_api! {
requires_authentication: true,
}
request {
request: {
/// The user ID being queried.
#[ruma_api(path)]
pub user_id: UserId,
}
response {}
response: {}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
use crate::r0::uiaa::{AuthData, UiaaResponse};
ruma_api! {
metadata {
metadata: {
description: "Register an account on this homeserver.",
method: POST,
name: "register",
@ -16,7 +16,7 @@ ruma_api! {
requires_authentication: false,
}
request {
request: {
/// The desired password for the account.
///
/// May be empty for accounts that should not be able to log in again
@ -65,7 +65,7 @@ ruma_api! {
pub inhibit_login: bool,
}
response {
response: {
/// An access token for the account.
///
/// 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;
ruma_api! {
metadata {
metadata: {
description: "Request a 3PID management token with a 3rd party email.",
method: POST,
name: "request_3pid_association_token_via_email",
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: false,
}
request {
request: {
/// Client-generated secret string used to protect this session.
pub client_secret: String,
@ -35,7 +35,7 @@ ruma_api! {
pub identity_server_info: Option<IdentityServerInfo>,
}
response {
response: {
/// The session identifier given by the identity server.
pub sid: String,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@ use ruma_api::ruma_api;
use serde_json::value::RawValue as RawJsonValue;
ruma_api! {
metadata {
metadata: {
description: "Get a preview for a URL.",
name: "get_media_preview",
method: GET,
@ -15,7 +15,7 @@ ruma_api! {
requires_authentication: true,
}
request {
request: {
/// URL to get a preview of.
#[ruma_api(query)]
pub url: String,
@ -26,7 +26,7 @@ ruma_api! {
pub ts: SystemTime,
}
response {
response: {
/// OpenGraph-like data for the URL.
///
/// 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};
ruma_api! {
metadata {
metadata: {
description: "Ban a user from a room.",
method: POST,
name: "ban_user",
@ -13,7 +13,7 @@ ruma_api! {
requires_authentication: true,
}
request {
request: {
/// The room to kick the user from.
#[ruma_api(path)]
pub room_id: RoomId,
@ -26,7 +26,7 @@ ruma_api! {
pub reason: Option<String>,
}
response {}
response: {}
error: crate::Error
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,7 +7,7 @@ use ruma_identifiers::{RoomId, UserId};
use serde::{Deserialize, Serialize};
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.",
method: GET,
name: "joined_members",
@ -16,13 +16,13 @@ ruma_api! {
requires_authentication: true,
}
request {
request: {
/// The room to get the members of.
#[ruma_api(path)]
pub room_id: RoomId,
}
response {
response: {
/// A list of the rooms the user is in, i.e.
/// the ID of each room in which the user has joined membership.
pub joined: BTreeMap<UserId, RoomMember>,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize};
use super::Action;
ruma_api! {
metadata {
metadata: {
description: "Paginate through the list of events that the user has been, or would have been notified about.",
method: GET,
name: "get_notifications",
@ -20,7 +20,7 @@ ruma_api! {
requires_authentication: true,
}
request {
request: {
/// Pagination token given to retrieve the next set of events.
#[ruma_api(query)]
#[serde(skip_serializing_if = "Option::is_none")]
@ -38,7 +38,7 @@ ruma_api! {
pub only: Option<String>
}
response {
response: {
/// 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.
#[serde(skip_serializing_if = "Option::is_none")]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@ use ruma_api::ruma_api;
use super::{Action, RuleKind};
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.",
method: PUT,
name: "set_pushrule_actions",
@ -14,7 +14,7 @@ ruma_api! {
requires_authentication: true,
}
request {
request: {
/// The scope to fetch a rule from. 'global' to specify global rules.
#[ruma_api(path)]
pub scope: String,
@ -31,7 +31,7 @@ ruma_api! {
pub actions: Vec<Action>
}
response {}
response: {}
error: crate::Error
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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