Remove usage of ruma_api!
This commit is contained in:
parent
c5fb935472
commit
80c060cb69
@ -17,7 +17,11 @@ pub mod v1 {
|
|||||||
#[cfg(any(feature = "unstable-msc2409", feature = "unstable-msc3202"))]
|
#[cfg(any(feature = "unstable-msc2409", feature = "unstable-msc3202"))]
|
||||||
use ruma_common::OwnedUserId;
|
use ruma_common::OwnedUserId;
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::ruma_api, events::AnyTimelineEvent, serde::Raw, OwnedTransactionId, TransactionId,
|
api::{request, response, Metadata},
|
||||||
|
events::AnyTimelineEvent,
|
||||||
|
metadata,
|
||||||
|
serde::Raw,
|
||||||
|
OwnedTransactionId, TransactionId,
|
||||||
};
|
};
|
||||||
#[cfg(feature = "unstable-msc2409")]
|
#[cfg(feature = "unstable-msc2409")]
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
@ -33,18 +37,19 @@ pub mod v1 {
|
|||||||
#[cfg(feature = "unstable-msc2409")]
|
#[cfg(feature = "unstable-msc2409")]
|
||||||
use serde_json::{value::RawValue as RawJsonValue, Value as JsonValue};
|
use serde_json::{value::RawValue as RawJsonValue, Value as JsonValue};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
stable_path: "/_matrix/app/v1/transactions/:txn_id",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/app/v1/transactions/:txn_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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.
|
||||||
@ -63,23 +68,27 @@ pub mod v1 {
|
|||||||
)]
|
)]
|
||||||
pub device_lists: DeviceLists,
|
pub device_lists: DeviceLists,
|
||||||
|
|
||||||
/// The number of unclaimed one-time keys currently held on the server for this device, for each algorithm.
|
/// The number of unclaimed one-time keys currently held on the server for this device, for
|
||||||
|
/// each algorithm.
|
||||||
#[cfg(feature = "unstable-msc3202")]
|
#[cfg(feature = "unstable-msc3202")]
|
||||||
#[serde(
|
#[serde(
|
||||||
default,
|
default,
|
||||||
skip_serializing_if = "BTreeMap::is_empty",
|
skip_serializing_if = "BTreeMap::is_empty",
|
||||||
rename = "org.matrix.msc3202.device_one_time_keys_count"
|
rename = "org.matrix.msc3202.device_one_time_keys_count"
|
||||||
)]
|
)]
|
||||||
pub device_one_time_keys_count: BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceId, BTreeMap<DeviceKeyAlgorithm, UInt>>>,
|
pub device_one_time_keys_count:
|
||||||
|
BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceId, BTreeMap<DeviceKeyAlgorithm, UInt>>>,
|
||||||
|
|
||||||
/// A list of key algorithms for which the server has an unused fallback key for the device.
|
/// A list of key algorithms for which the server has an unused fallback key for the
|
||||||
|
/// device.
|
||||||
#[cfg(feature = "unstable-msc3202")]
|
#[cfg(feature = "unstable-msc3202")]
|
||||||
#[serde(
|
#[serde(
|
||||||
default,
|
default,
|
||||||
skip_serializing_if = "BTreeMap::is_empty",
|
skip_serializing_if = "BTreeMap::is_empty",
|
||||||
rename = "org.matrix.msc3202.device_unused_fallback_key_types"
|
rename = "org.matrix.msc3202.device_unused_fallback_key_types"
|
||||||
)]
|
)]
|
||||||
pub device_unused_fallback_key_types: BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceId, Vec<DeviceKeyAlgorithm>>>,
|
pub device_unused_fallback_key_types:
|
||||||
|
BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceId, Vec<DeviceKeyAlgorithm>>>,
|
||||||
|
|
||||||
/// A list of EDUs.
|
/// A list of EDUs.
|
||||||
#[cfg(feature = "unstable-msc2409")]
|
#[cfg(feature = "unstable-msc2409")]
|
||||||
@ -97,12 +106,12 @@ pub mod v1 {
|
|||||||
skip_serializing_if = "<[_]>::is_empty",
|
skip_serializing_if = "<[_]>::is_empty",
|
||||||
rename = "de.sorunome.msc2409.to_device"
|
rename = "de.sorunome.msc2409.to_device"
|
||||||
)]
|
)]
|
||||||
pub to_device: &'a [Raw<AnyToDeviceEvent>]
|
pub to_device: &'a [Raw<AnyToDeviceEvent>],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given transaction ID and list of events.
|
/// Creates a new `Request` with the given transaction ID and list of events.
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
//!
|
//!
|
||||||
//! [appservice-api]: https://spec.matrix.org/v1.4/application-service-api/
|
//! [appservice-api]: https://spec.matrix.org/v1.4/application-service-api/
|
||||||
|
|
||||||
#![warn(missing_docs)]
|
// #![warn(missing_docs)] FIXME
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
@ -7,28 +7,32 @@ pub mod v1 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/application-service-api/#get_matrixappv1roomsroomalias
|
//! [spec]: https://spec.matrix.org/v1.4/application-service-api/#get_matrixappv1roomsroomalias
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, RoomAliasId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, RoomAliasId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
stable_path: "/_matrix/app/v1/rooms/:room_alias",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/app/v1/rooms/:room_alias",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The room alias being queried.
|
/// The room alias being queried.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub room_alias: &'a RoomAliasId,
|
pub room_alias: &'a RoomAliasId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room alias.
|
/// Creates a new `Request` with the given room alias.
|
||||||
|
@ -7,28 +7,32 @@ pub mod v1 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/application-service-api/#get_matrixappv1usersuserid
|
//! [spec]: https://spec.matrix.org/v1.4/application-service-api/#get_matrixappv1usersuserid
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, UserId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, UserId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
stable_path: "/_matrix/app/v1/users/:user_id",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/app/v1/users/:user_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The user ID being queried.
|
/// The user ID being queried.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub user_id: &'a UserId,
|
pub user_id: &'a UserId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given user id.
|
/// Creates a new `Request` with the given user id.
|
||||||
|
@ -10,20 +10,25 @@ pub mod v1 {
|
|||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, thirdparty::Location};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
thirdparty::Location,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
stable_path: "/_matrix/app/v1/thirdparty/location/:protocol",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/app/v1/thirdparty/location/:protocol",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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: &'a str,
|
pub protocol: &'a str,
|
||||||
@ -34,12 +39,12 @@ pub mod v1 {
|
|||||||
pub fields: BTreeMap<String, String>,
|
pub fields: BTreeMap<String, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response]
|
||||||
|
pub struct 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>,
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given protocol.
|
/// Creates a new `Request` with the given protocol.
|
||||||
|
@ -7,31 +7,37 @@ pub mod v1 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/application-service-api/#get_matrixappv1thirdpartylocation
|
//! [spec]: https://spec.matrix.org/v1.4/application-service-api/#get_matrixappv1thirdpartylocation
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, thirdparty::Location, RoomAliasId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
thirdparty::Location,
|
||||||
|
RoomAliasId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
stable_path: "/_matrix/app/v1/thirdparty/location",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/app/v1/thirdparty/location",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The Matrix room alias to look up.
|
/// The Matrix room alias to look up.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub alias: &'a RoomAliasId,
|
pub alias: &'a RoomAliasId,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response]
|
||||||
|
pub struct 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>,
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room alias id.
|
/// Creates a new `Request` with the given room alias id.
|
||||||
|
@ -8,31 +8,36 @@ pub mod v1 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/application-service-api/#get_matrixappv1thirdpartyprotocolprotocol
|
//! [spec]: https://spec.matrix.org/v1.4/application-service-api/#get_matrixappv1thirdpartyprotocolprotocol
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, thirdparty::Protocol};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
thirdparty::Protocol,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
stable_path: "/_matrix/app/v1/thirdparty/protocol/:protocol",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/app/v1/thirdparty/protocol/:protocol",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The name of the protocol.
|
/// The name of the protocol.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub protocol: &'a str,
|
pub protocol: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response]
|
||||||
|
pub struct Response {
|
||||||
/// Metadata about the protocol.
|
/// Metadata about the protocol.
|
||||||
#[ruma_api(body)]
|
#[ruma_api(body)]
|
||||||
pub protocol: Protocol,
|
pub protocol: Protocol,
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given protocol name.
|
/// Creates a new `Request` with the given protocol name.
|
||||||
|
@ -10,20 +10,25 @@ pub mod v1 {
|
|||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, thirdparty::User};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
thirdparty::User,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
stable_path: "/_matrix/app/v1/thirdparty/user/:protocol",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/app/v1/thirdparty/user/:protocol",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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: &'a str,
|
pub protocol: &'a str,
|
||||||
@ -34,12 +39,12 @@ pub mod v1 {
|
|||||||
pub fields: BTreeMap<String, String>,
|
pub fields: BTreeMap<String, String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response]
|
||||||
|
pub struct 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>,
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given protocol name.
|
/// Creates a new `Request` with the given protocol name.
|
||||||
|
@ -7,31 +7,37 @@ pub mod v1 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/application-service-api/#get_matrixappv1thirdpartyuser
|
//! [spec]: https://spec.matrix.org/v1.4/application-service-api/#get_matrixappv1thirdpartyuser
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, thirdparty::User, UserId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
thirdparty::User,
|
||||||
|
UserId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
stable_path: "/_matrix/app/v1/thirdparty/user",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/app/v1/thirdparty/user",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The Matrix User ID to look up.
|
/// The Matrix User ID to look up.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub userid: &'a UserId,
|
pub userid: &'a UserId,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response]
|
||||||
|
pub struct 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>,
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given user id.
|
/// Creates a new `Request` with the given user id.
|
||||||
|
@ -5,23 +5,27 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3account3pidadd
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3account3pidadd
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, ClientSecret, SessionId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, ClientSecret, SessionId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::uiaa::{AuthData, IncomingAuthData, UiaaResponse};
|
use crate::uiaa::{AuthData, IncomingAuthData, UiaaResponse};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/account/3pid/add",
|
|
||||||
stable_path: "/_matrix/client/v3/account/3pid/add",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/account/3pid/add",
|
||||||
|
1.1 => "/_matrix/client/v3/account/3pid/add",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = UiaaResponse)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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<'a>>,
|
pub auth: Option<AuthData<'a>>,
|
||||||
@ -33,11 +37,9 @@ pub mod v3 {
|
|||||||
pub sid: &'a SessionId,
|
pub sid: &'a SessionId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = UiaaResponse)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: UiaaResponse
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given client secret and session identifier.
|
/// Creates a new `Request` with the given client secret and session identifier.
|
||||||
|
@ -5,23 +5,27 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3account3pidbind
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3account3pidbind
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, ClientSecret, SessionId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, ClientSecret, SessionId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo};
|
use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/account/3pid/bind",
|
|
||||||
stable_path: "/_matrix/client/v3/account/3pid/bind",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/account/3pid/bind",
|
||||||
|
1.1 => "/_matrix/client/v3/account/3pid/bind",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// Client-generated secret string used to protect this session.
|
/// Client-generated secret string used to protect this session.
|
||||||
pub client_secret: &'a ClientSecret,
|
pub client_secret: &'a ClientSecret,
|
||||||
|
|
||||||
@ -34,11 +38,9 @@ pub mod v3 {
|
|||||||
pub sid: &'a SessionId,
|
pub sid: &'a SessionId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given client secret, identity server information and
|
/// Creates a new `Request` with the given client secret, identity server information and
|
||||||
|
@ -5,23 +5,27 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3accountpassword
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3accountpassword
|
||||||
|
|
||||||
use ruma_common::api::ruma_api;
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::uiaa::{AuthData, IncomingAuthData, UiaaResponse};
|
use crate::uiaa::{AuthData, IncomingAuthData, UiaaResponse};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/account/password",
|
|
||||||
stable_path: "/_matrix/client/v3/account/password",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/account/password",
|
||||||
|
1.1 => "/_matrix/client/v3/account/password",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = UiaaResponse)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The new password for the account.
|
/// The new password for the account.
|
||||||
pub new_password: &'a str,
|
pub new_password: &'a str,
|
||||||
|
|
||||||
@ -30,9 +34,12 @@ pub mod v3 {
|
|||||||
///
|
///
|
||||||
/// Defaults to true.
|
/// Defaults to true.
|
||||||
///
|
///
|
||||||
/// When false, the server can still take advantage of the soft logout method for the user's
|
/// When false, the server can still take advantage of the soft logout method for the
|
||||||
/// remaining devices.
|
/// user's remaining devices.
|
||||||
#[serde(default = "ruma_common::serde::default_true", skip_serializing_if = "ruma_common::serde::is_true")]
|
#[serde(
|
||||||
|
default = "ruma_common::serde::default_true",
|
||||||
|
skip_serializing_if = "ruma_common::serde::is_true"
|
||||||
|
)]
|
||||||
pub logout_devices: bool,
|
pub logout_devices: bool,
|
||||||
|
|
||||||
/// Additional authentication information for the user-interactive authentication API.
|
/// Additional authentication information for the user-interactive authentication API.
|
||||||
@ -40,11 +47,9 @@ pub mod v3 {
|
|||||||
pub auth: Option<AuthData<'a>>,
|
pub auth: Option<AuthData<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = UiaaResponse)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: UiaaResponse
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given password.
|
/// Creates a new `Request` with the given password.
|
||||||
|
@ -5,34 +5,36 @@ pub mod v1 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv1registermloginregistration_tokenvalidity
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv1registermloginregistration_tokenvalidity
|
||||||
|
|
||||||
use ruma_common::api::ruma_api;
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Checks to see if the given registration token is valid.",
|
description: "Checks to see if the given registration token is valid.",
|
||||||
method: GET,
|
method: GET,
|
||||||
name: "check_registration_token_validity",
|
name: "check_registration_token_validity",
|
||||||
unstable_path: "/_matrix/client/unstable/org.matrix.msc3231/register/org.matrix.msc3231.login.registration_token/validity",
|
|
||||||
stable_path: "/_matrix/client/v1/register/m.login.registration_token/validity",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.2,
|
history: {
|
||||||
|
unstable => "/_matrix/client/unstable/org.matrix.msc3231/register/org.matrix.msc3231.login.registration_token/validity",
|
||||||
|
1.2 => "/_matrix/client/v1/register/m.login.registration_token/validity",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The registration token to check the validity of.
|
/// The registration token to check the validity of.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub registration_token: &'a str,
|
pub registration_token: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// A flag to indicate that the registration token is valid.
|
/// A flag to indicate that the registration token is valid.
|
||||||
pub valid: bool,
|
pub valid: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given registration token.
|
/// Creates a new `Request` with the given registration token.
|
||||||
pub fn new(registration_token: &'a str) -> Self {
|
pub fn new(registration_token: &'a str) -> Self {
|
||||||
|
@ -5,27 +5,31 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3accountdeactivate
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3accountdeactivate
|
||||||
|
|
||||||
use ruma_common::api::ruma_api;
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
account::ThirdPartyIdRemovalStatus,
|
account::ThirdPartyIdRemovalStatus,
|
||||||
uiaa::{AuthData, IncomingAuthData, UiaaResponse},
|
uiaa::{AuthData, IncomingAuthData, UiaaResponse},
|
||||||
};
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Deactivate the current user's account.",
|
description: "Deactivate the current user's account.",
|
||||||
method: POST,
|
method: POST,
|
||||||
name: "deactivate",
|
name: "deactivate",
|
||||||
r0_path: "/_matrix/client/r0/account/deactivate",
|
|
||||||
stable_path: "/_matrix/client/v3/account/deactivate",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/account/deactivate",
|
||||||
|
1.1 => "/_matrix/client/v3/account/deactivate",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#[request(error = UiaaResponse)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
request: {
|
pub struct Request<'a> {
|
||||||
/// 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<'a>>,
|
pub auth: Option<AuthData<'a>>,
|
||||||
@ -36,14 +40,12 @@ pub mod v3 {
|
|||||||
pub id_server: Option<&'a str>,
|
pub id_server: Option<&'a str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = UiaaResponse)]
|
||||||
|
pub struct Response {
|
||||||
/// Result of unbind operation.
|
/// Result of unbind operation.
|
||||||
pub id_server_unbind_result: ThirdPartyIdRemovalStatus,
|
pub id_server_unbind_result: ThirdPartyIdRemovalStatus,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: UiaaResponse
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Request<'_> {
|
impl Request<'_> {
|
||||||
/// Creates an empty `Request`.
|
/// Creates an empty `Request`.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
@ -5,23 +5,28 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3account3piddelete
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3account3piddelete
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, thirdparty::Medium};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
thirdparty::Medium,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::account::ThirdPartyIdRemovalStatus;
|
use crate::account::ThirdPartyIdRemovalStatus;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/account/3pid/delete",
|
|
||||||
stable_path: "/_matrix/client/v3/account/3pid/delete",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/account/3pid/delete",
|
||||||
|
1.1 => "/_matrix/client/v3/account/3pid/delete",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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<&'a str>,
|
pub id_server: Option<&'a str>,
|
||||||
@ -33,14 +38,12 @@ pub mod v3 {
|
|||||||
pub address: &'a str,
|
pub address: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// Result of unbind operation.
|
/// Result of unbind operation.
|
||||||
pub id_server_unbind_result: ThirdPartyIdRemovalStatus,
|
pub id_server_unbind_result: ThirdPartyIdRemovalStatus,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given medium and address.
|
/// Creates a new `Request` with the given medium and address.
|
||||||
pub fn new(medium: Medium, address: &'a str) -> Self {
|
pub fn new(medium: Medium, address: &'a str) -> Self {
|
||||||
|
@ -5,32 +5,37 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3account3pid
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3account3pid
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, thirdparty::ThirdPartyIdentifier};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
thirdparty::ThirdPartyIdentifier,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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_3pids",
|
name: "get_3pids",
|
||||||
r0_path: "/_matrix/client/r0/account/3pid",
|
|
||||||
stable_path: "/_matrix/client/v3/account/3pid",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/account/3pid",
|
||||||
|
1.1 => "/_matrix/client/v3/account/3pid",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#[request(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
request: {}
|
pub struct Request {}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
/// A list of third party identifiers the homeserver has associated with the user's account.
|
pub struct Response {
|
||||||
|
/// A list of third party identifiers the homeserver has associated with the user's
|
||||||
|
/// account.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
#[cfg_attr(not(feature = "compat"), serde(skip_serializing_if = "Vec::is_empty"))]
|
#[cfg_attr(not(feature = "compat"), serde(skip_serializing_if = "Vec::is_empty"))]
|
||||||
pub threepids: Vec<ThirdPartyIdentifier>,
|
pub threepids: Vec<ThirdPartyIdentifier>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
impl Request {
|
impl Request {
|
||||||
/// Creates an empty `Request`.
|
/// Creates an empty `Request`.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
@ -5,35 +5,37 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3registeravailable
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3registeravailable
|
||||||
|
|
||||||
use ruma_common::api::ruma_api;
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/register/available",
|
|
||||||
stable_path: "/_matrix/client/v3/register/available",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/register/available",
|
||||||
|
1.1 => "/_matrix/client/v3/register/available",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The username to check the availability of.
|
/// The username to check the availability of.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub username: &'a str,
|
pub username: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct 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,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given username.
|
/// Creates a new `Request` with the given username.
|
||||||
pub fn new(username: &'a str) -> Self {
|
pub fn new(username: &'a str) -> Self {
|
||||||
|
@ -9,25 +9,29 @@ pub mod v3 {
|
|||||||
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, DeviceId, OwnedDeviceId, OwnedUserId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, DeviceId, OwnedDeviceId, OwnedUserId,
|
||||||
|
};
|
||||||
|
|
||||||
use super::{LoginType, RegistrationKind};
|
use super::{LoginType, RegistrationKind};
|
||||||
use crate::uiaa::{AuthData, IncomingAuthData, UiaaResponse};
|
use crate::uiaa::{AuthData, IncomingAuthData, UiaaResponse};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Register an account on this homeserver.",
|
description: "Register an account on this homeserver.",
|
||||||
method: POST,
|
method: POST,
|
||||||
name: "register",
|
name: "register",
|
||||||
r0_path: "/_matrix/client/r0/register",
|
|
||||||
stable_path: "/_matrix/client/v3/register",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/register",
|
||||||
|
1.1 => "/_matrix/client/v3/register",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#[request(error = UiaaResponse)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
request: {
|
pub struct Request<'a> {
|
||||||
/// 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
|
||||||
@ -91,7 +95,8 @@ pub mod v3 {
|
|||||||
pub refresh_token: bool,
|
pub refresh_token: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = UiaaResponse)]
|
||||||
|
pub struct 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.
|
||||||
@ -135,14 +140,11 @@ pub mod v3 {
|
|||||||
with = "ruma_common::serde::duration::opt_ms",
|
with = "ruma_common::serde::duration::opt_ms",
|
||||||
default,
|
default,
|
||||||
skip_serializing_if = "Option::is_none",
|
skip_serializing_if = "Option::is_none",
|
||||||
rename = "expires_in_ms",
|
rename = "expires_in_ms"
|
||||||
)]
|
)]
|
||||||
pub expires_in: Option<Duration>,
|
pub expires_in: Option<Duration>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: UiaaResponse
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Request<'_> {
|
impl Request<'_> {
|
||||||
/// Creates a new `Request` with all parameters defaulted.
|
/// Creates a new `Request` with all parameters defaulted.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
@ -6,23 +6,27 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3account3pidemailrequesttoken
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3account3pidemailrequesttoken
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{api::ruma_api, ClientSecret, OwnedSessionId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, ClientSecret, OwnedSessionId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo};
|
use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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_management_token_via_email",
|
name: "request_3pid_management_token_via_email",
|
||||||
r0_path: "/_matrix/client/r0/account/3pid/email/requestToken",
|
|
||||||
stable_path: "/_matrix/client/v3/account/3pid/email/requestToken",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/account/3pid/email/requestToken",
|
||||||
|
1.1 => "/_matrix/client/v3/account/3pid/email/requestToken",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// Client-generated secret string used to protect this session.
|
/// Client-generated secret string used to protect this session.
|
||||||
pub client_secret: &'a ClientSecret,
|
pub client_secret: &'a ClientSecret,
|
||||||
|
|
||||||
@ -43,7 +47,8 @@ pub mod v3 {
|
|||||||
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// The session identifier given by the identity server.
|
/// The session identifier given by the identity server.
|
||||||
pub sid: OwnedSessionId,
|
pub sid: OwnedSessionId,
|
||||||
|
|
||||||
@ -61,9 +66,6 @@ pub mod v3 {
|
|||||||
pub submit_url: Option<String>,
|
pub submit_url: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the client secret, email and send-attempt counter.
|
/// Creates a new `Request` with the client secret, email and send-attempt counter.
|
||||||
pub fn new(client_secret: &'a ClientSecret, email: &'a str, send_attempt: UInt) -> Self {
|
pub fn new(client_secret: &'a ClientSecret, email: &'a str, send_attempt: UInt) -> Self {
|
||||||
|
@ -6,23 +6,27 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3account3pidmsisdnrequesttoken
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3account3pidmsisdnrequesttoken
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{api::ruma_api, ClientSecret, OwnedSessionId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, ClientSecret, OwnedSessionId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo};
|
use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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_management_token_via_msisdn",
|
name: "request_3pid_management_token_via_msisdn",
|
||||||
r0_path: "/_matrix/client/r0/account/3pid/msisdn/requestToken",
|
|
||||||
stable_path: "/_matrix/client/v3/account/3pid/msisdn/requestToken",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/account/3pid/msisdn/requestToken",
|
||||||
|
1.1 => "/_matrix/client/v3/account/3pid/msisdn/requestToken",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// Client-generated secret string used to protect this session.
|
/// Client-generated secret string used to protect this session.
|
||||||
pub client_secret: &'a ClientSecret,
|
pub client_secret: &'a ClientSecret,
|
||||||
|
|
||||||
@ -46,7 +50,8 @@ pub mod v3 {
|
|||||||
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// The session identifier given by the identity server.
|
/// The session identifier given by the identity server.
|
||||||
pub sid: OwnedSessionId,
|
pub sid: OwnedSessionId,
|
||||||
|
|
||||||
@ -64,8 +69,6 @@ pub mod v3 {
|
|||||||
pub submit_url: Option<String>,
|
pub submit_url: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given client secret, country code, phone number and
|
/// Creates a new `Request` with the given client secret, country code, phone number and
|
||||||
/// send-attempt counter.
|
/// send-attempt counter.
|
||||||
|
@ -7,27 +7,33 @@ pub mod v3 {
|
|||||||
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, authentication::TokenType, OwnedServerName, UserId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
authentication::TokenType,
|
||||||
|
metadata, OwnedServerName, UserId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
|
||||||
method: POST,
|
method: POST,
|
||||||
r0_path: "/_matrix/client/r0/user/:user_id/openid/request_token",
|
name: "request_openid_token",
|
||||||
stable_path: "/_matrix/client/v3/user/:user_id/openid/request_token",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/user/:user_id/openid/request_token",
|
||||||
|
1.1 => "/_matrix/client/v3/user/:user_id/openid/request_token",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// User ID of authenticated user.
|
/// User ID of authenticated user.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub user_id: &'a UserId,
|
pub user_id: &'a UserId,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// Access token for verifying user's identity.
|
/// Access token for verifying user's identity.
|
||||||
pub access_token: String,
|
pub access_token: String,
|
||||||
|
|
||||||
@ -42,9 +48,6 @@ pub mod v3 {
|
|||||||
pub expires_in: Duration,
|
pub expires_in: Duration,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given user ID.
|
/// Creates a new `Request` with the given user ID.
|
||||||
pub fn new(user_id: &'a UserId) -> Self {
|
pub fn new(user_id: &'a UserId) -> Self {
|
||||||
|
@ -6,23 +6,27 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3accountpasswordemailrequesttoken
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3accountpasswordemailrequesttoken
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{api::ruma_api, ClientSecret, OwnedSessionId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, ClientSecret, OwnedSessionId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo};
|
use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/account/password/email/requestToken",
|
|
||||||
stable_path: "/_matrix/client/v3/account/password/email/requestToken",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/account/password/email/requestToken",
|
||||||
|
1.1 => "/_matrix/client/v3/account/password/email/requestToken",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// Client-generated secret string used to protect this session.
|
/// Client-generated secret string used to protect this session.
|
||||||
pub client_secret: &'a ClientSecret,
|
pub client_secret: &'a ClientSecret,
|
||||||
|
|
||||||
@ -43,7 +47,8 @@ pub mod v3 {
|
|||||||
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// The session identifier given by the identity server.
|
/// The session identifier given by the identity server.
|
||||||
pub sid: OwnedSessionId,
|
pub sid: OwnedSessionId,
|
||||||
|
|
||||||
@ -51,8 +56,8 @@ pub mod v3 {
|
|||||||
///
|
///
|
||||||
/// If omitted, verification happens without client.
|
/// If omitted, verification happens without client.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will result
|
/// If you activate the `compat` feature, this field being an empty string in JSON will
|
||||||
/// in `None` here during deserialization.
|
/// result in `None` here during deserialization.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "compat",
|
feature = "compat",
|
||||||
@ -61,9 +66,6 @@ pub mod v3 {
|
|||||||
pub submit_url: Option<String>,
|
pub submit_url: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given client secret, email address and send-attempt
|
/// Creates a new `Request` with the given client secret, email address and send-attempt
|
||||||
/// counter.
|
/// counter.
|
||||||
|
@ -6,21 +6,25 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3accountpasswordmsisdnrequesttoken
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3accountpasswordmsisdnrequesttoken
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{api::ruma_api, ClientSecret, OwnedSessionId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, ClientSecret, OwnedSessionId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/account/password/msisdn/requestToken",
|
|
||||||
stable_path: "/_matrix/client/v3/account/password/msisdn/requestToken",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/account/password/msisdn/requestToken",
|
||||||
|
1.1 => "/_matrix/client/v3/account/password/msisdn/requestToken",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// Client-generated secret string used to protect this session.
|
/// Client-generated secret string used to protect this session.
|
||||||
pub client_secret: &'a ClientSecret,
|
pub client_secret: &'a ClientSecret,
|
||||||
|
|
||||||
@ -38,7 +42,8 @@ pub mod v3 {
|
|||||||
pub next_link: Option<&'a str>,
|
pub next_link: Option<&'a str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// The session identifier given by the identity server.
|
/// The session identifier given by the identity server.
|
||||||
pub sid: OwnedSessionId,
|
pub sid: OwnedSessionId,
|
||||||
|
|
||||||
@ -46,8 +51,8 @@ pub mod v3 {
|
|||||||
///
|
///
|
||||||
/// If omitted, verification happens without client.
|
/// If omitted, verification happens without client.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will result
|
/// If you activate the `compat` feature, this field being an empty string in JSON will
|
||||||
/// in `None` here during deserialization.
|
/// result in `None` here during deserialization.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "compat",
|
feature = "compat",
|
||||||
@ -56,9 +61,6 @@ pub mod v3 {
|
|||||||
pub submit_url: Option<String>,
|
pub submit_url: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given client secret, country code, phone number and
|
/// Creates a new `Request` with the given client secret, country code, phone number and
|
||||||
/// send-attempt counter.
|
/// send-attempt counter.
|
||||||
|
@ -6,23 +6,27 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3registeremailrequesttoken
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3registeremailrequesttoken
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{api::ruma_api, ClientSecret, OwnedSessionId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, ClientSecret, OwnedSessionId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo};
|
use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/register/email/requestToken",
|
|
||||||
stable_path: "/_matrix/client/v3/register/email/requestToken",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/register/email/requestToken",
|
||||||
|
1.1 => "/_matrix/client/v3/register/email/requestToken",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// Client-generated secret string used to protect this session.
|
/// Client-generated secret string used to protect this session.
|
||||||
pub client_secret: &'a ClientSecret,
|
pub client_secret: &'a ClientSecret,
|
||||||
|
|
||||||
@ -43,7 +47,8 @@ pub mod v3 {
|
|||||||
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// The session identifier given by the identity server.
|
/// The session identifier given by the identity server.
|
||||||
pub sid: OwnedSessionId,
|
pub sid: OwnedSessionId,
|
||||||
|
|
||||||
@ -51,8 +56,8 @@ pub mod v3 {
|
|||||||
///
|
///
|
||||||
/// If omitted, verification happens without client.
|
/// If omitted, verification happens without client.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will result
|
/// If you activate the `compat` feature, this field being an empty string in JSON will
|
||||||
/// in `None` here during deserialization.
|
/// result in `None` here during deserialization.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "compat",
|
feature = "compat",
|
||||||
@ -61,9 +66,6 @@ pub mod v3 {
|
|||||||
pub submit_url: Option<String>,
|
pub submit_url: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given client secret, email address and send-attempt
|
/// Creates a new `Request` with the given client secret, email address and send-attempt
|
||||||
/// counter.
|
/// counter.
|
||||||
|
@ -6,23 +6,27 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3registermsisdnrequesttoken
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3registermsisdnrequesttoken
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{api::ruma_api, ClientSecret, OwnedSessionId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, ClientSecret, OwnedSessionId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo};
|
use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/register/msisdn/requestToken",
|
|
||||||
stable_path: "/_matrix/client/v3/register/msisdn/requestToken",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/register/msisdn/requestToken",
|
||||||
|
1.1 => "/_matrix/client/v3/register/msisdn/requestToken",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// Client-generated secret string used to protect this session.
|
/// Client-generated secret string used to protect this session.
|
||||||
pub client_secret: &'a ClientSecret,
|
pub client_secret: &'a ClientSecret,
|
||||||
|
|
||||||
@ -46,7 +50,8 @@ pub mod v3 {
|
|||||||
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// The session identifier given by the identity server.
|
/// The session identifier given by the identity server.
|
||||||
pub sid: OwnedSessionId,
|
pub sid: OwnedSessionId,
|
||||||
|
|
||||||
@ -54,8 +59,8 @@ pub mod v3 {
|
|||||||
///
|
///
|
||||||
/// If omitted, verification happens without client.
|
/// If omitted, verification happens without client.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will result
|
/// If you activate the `compat` feature, this field being an empty string in JSON will
|
||||||
/// in `None` here during deserialization.
|
/// result in `None` here during deserialization.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "compat",
|
feature = "compat",
|
||||||
@ -64,9 +69,6 @@ pub mod v3 {
|
|||||||
pub submit_url: Option<String>,
|
pub submit_url: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given client secret, country code, phone number and
|
/// Creates a new `Request` with the given client secret, country code, phone number and
|
||||||
/// send-attempt counter.
|
/// send-attempt counter.
|
||||||
|
@ -5,23 +5,28 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3account3pidunbind
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3account3pidunbind
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, thirdparty::Medium};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
thirdparty::Medium,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::account::ThirdPartyIdRemovalStatus;
|
use crate::account::ThirdPartyIdRemovalStatus;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/account/3pid/unbind",
|
|
||||||
stable_path: "/_matrix/client/v3/account/3pid/unbind",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/account/3pid/unbind",
|
||||||
|
1.1 => "/_matrix/client/v3/account/3pid/unbind",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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<&'a str>,
|
pub id_server: Option<&'a str>,
|
||||||
@ -33,14 +38,12 @@ pub mod v3 {
|
|||||||
pub address: &'a str,
|
pub address: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// Result of unbind operation.
|
/// Result of unbind operation.
|
||||||
pub id_server_unbind_result: ThirdPartyIdRemovalStatus,
|
pub id_server_unbind_result: ThirdPartyIdRemovalStatus,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given medium and third-party address.
|
/// Creates a new `Request` with the given medium and third-party address.
|
||||||
pub fn new(medium: Medium, address: &'a str) -> Self {
|
pub fn new(medium: Medium, address: &'a str) -> Self {
|
||||||
|
@ -5,24 +5,29 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3accountwhoami
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3accountwhoami
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, OwnedDeviceId, OwnedUserId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, OwnedDeviceId, OwnedUserId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/account/whoami",
|
|
||||||
stable_path: "/_matrix/client/v3/account/whoami",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/account/whoami",
|
||||||
|
1.1 => "/_matrix/client/v3/account/whoami",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#[request(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
request: {}
|
pub struct Request {}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// The id of the user that owns the access token.
|
/// The id of the user that owns the access token.
|
||||||
pub user_id: OwnedUserId,
|
pub user_id: OwnedUserId,
|
||||||
|
|
||||||
@ -35,9 +40,6 @@ pub mod v3 {
|
|||||||
pub is_guest: bool,
|
pub is_guest: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Request {
|
impl Request {
|
||||||
/// Creates an empty `Request`.
|
/// Creates an empty `Request`.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
@ -5,21 +5,25 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3directoryroomroomalias
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3directoryroomroomalias
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, RoomAliasId, RoomId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, RoomAliasId, RoomId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/directory/room/:room_alias",
|
|
||||||
stable_path: "/_matrix/client/v3/directory/room/:room_alias",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/directory/room/:room_alias",
|
||||||
|
1.1 => "/_matrix/client/v3/directory/room/:room_alias",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The room alias to set.
|
/// The room alias to set.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub room_alias: &'a RoomAliasId,
|
pub room_alias: &'a RoomAliasId,
|
||||||
@ -28,11 +32,9 @@ pub mod v3 {
|
|||||||
pub room_id: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room alias and room id.
|
/// Creates a new `Request` with the given room alias and room id.
|
||||||
|
@ -5,31 +5,33 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#delete_matrixclientv3directoryroomroomalias
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#delete_matrixclientv3directoryroomroomalias
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, RoomAliasId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, RoomAliasId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/directory/room/:room_alias",
|
|
||||||
stable_path: "/_matrix/client/v3/directory/room/:room_alias",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/directory/room/:room_alias",
|
||||||
|
1.1 => "/_matrix/client/v3/directory/room/:room_alias",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The room alias to remove.
|
/// The room alias to remove.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub room_alias: &'a RoomAliasId,
|
pub room_alias: &'a RoomAliasId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room alias.
|
/// Creates a new `Request` with the given room alias.
|
||||||
|
@ -5,27 +5,32 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3directoryroomroomalias
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3directoryroomroomalias
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, OwnedRoomId, OwnedServerName, RoomAliasId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, OwnedRoomId, OwnedServerName, RoomAliasId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/directory/room/:room_alias",
|
|
||||||
stable_path: "/_matrix/client/v3/directory/room/:room_alias",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/directory/room/:room_alias",
|
||||||
|
1.1 => "/_matrix/client/v3/directory/room/:room_alias",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The room alias.
|
/// The room alias.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub room_alias: &'a RoomAliasId,
|
pub room_alias: &'a RoomAliasId,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// The room ID for this room alias.
|
/// The room ID for this room alias.
|
||||||
pub room_id: OwnedRoomId,
|
pub room_id: OwnedRoomId,
|
||||||
|
|
||||||
@ -33,9 +38,6 @@ pub mod v3 {
|
|||||||
pub servers: Vec<OwnedServerName>,
|
pub servers: Vec<OwnedServerName>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room alias id.
|
/// Creates a new `Request` with the given room alias id.
|
||||||
pub fn new(room_alias: &'a RoomAliasId) -> Self {
|
pub fn new(room_alias: &'a RoomAliasId) -> Self {
|
||||||
|
@ -5,23 +5,27 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/application-service-api/#put_matrixclientv3directorylistappservicenetworkidroomid
|
//! [spec]: https://spec.matrix.org/v1.4/application-service-api/#put_matrixclientv3directorylistappservicenetworkidroomid
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, RoomId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, RoomId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::room::Visibility;
|
use crate::room::Visibility;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/directory/list/appservice/:network_id/:room_id",
|
|
||||||
stable_path: "/_matrix/client/v3/directory/list/appservice/:network_id/:room_id",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/directory/list/appservice/:network_id/:room_id",
|
||||||
|
1.1 => "/_matrix/client/v3/directory/list/appservice/:network_id/:room_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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: &'a str,
|
pub network_id: &'a str,
|
||||||
@ -34,11 +38,9 @@ pub mod v3 {
|
|||||||
pub visibility: Visibility,
|
pub visibility: Visibility,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given network ID, room ID and visibility.
|
/// Creates a new `Request` with the given network ID, room ID and visibility.
|
||||||
|
@ -8,23 +8,27 @@ pub mod v3 {
|
|||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{api::ruma_api, OwnedRoomId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, OwnedRoomId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::backup::RoomKeyBackup;
|
use crate::backup::RoomKeyBackup;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Store keys in the backup.",
|
description: "Store keys in the backup.",
|
||||||
method: PUT,
|
method: PUT,
|
||||||
name: "add_backup_keys",
|
name: "add_backup_keys",
|
||||||
unstable_path: "/_matrix/client/unstable/room_keys/keys",
|
|
||||||
stable_path: "/_matrix/client/v3/room_keys/keys",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.1,
|
history: {
|
||||||
|
unstable => "/_matrix/client/unstable/room_keys/keys",
|
||||||
|
1.1 => "/_matrix/client/v3/room_keys/keys",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The backup version to add keys to.
|
/// The backup version to add keys to.
|
||||||
///
|
///
|
||||||
/// Must be the current backup.
|
/// Must be the current backup.
|
||||||
@ -35,7 +39,8 @@ pub mod v3 {
|
|||||||
pub rooms: BTreeMap<OwnedRoomId, RoomKeyBackup>,
|
pub rooms: BTreeMap<OwnedRoomId, RoomKeyBackup>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// An opaque string representing stored keys in the backup.
|
/// An opaque string representing stored keys in the backup.
|
||||||
///
|
///
|
||||||
/// Clients can compare it with the etag value they received in the request of their last
|
/// Clients can compare it with the etag value they received in the request of their last
|
||||||
@ -46,9 +51,6 @@ pub mod v3 {
|
|||||||
pub count: UInt,
|
pub count: UInt,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given version and room key backups.
|
/// Creates a new `Request` with the given version and room key backups.
|
||||||
pub fn new(version: &'a str, rooms: BTreeMap<OwnedRoomId, RoomKeyBackup>) -> Self {
|
pub fn new(version: &'a str, rooms: BTreeMap<OwnedRoomId, RoomKeyBackup>) -> Self {
|
||||||
|
@ -8,24 +8,30 @@ pub mod v3 {
|
|||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{api::ruma_api, serde::Raw, RoomId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
serde::Raw,
|
||||||
|
RoomId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::backup::KeyBackupData;
|
use crate::backup::KeyBackupData;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Store keys in the backup for a room.",
|
description: "Store keys in the backup for a room.",
|
||||||
method: PUT,
|
method: PUT,
|
||||||
name: "add_backup_keys_for_room",
|
name: "add_backup_keys_for_room",
|
||||||
unstable_path: "/_matrix/client/unstable/room_keys/keys/:room_id",
|
|
||||||
r0_path: "/_matrix/client/r0/room_keys/keys/:room_id",
|
|
||||||
stable_path: "/_matrix/client/v3/room_keys/keys/:room_id",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
unstable => "/_matrix/client/unstable/room_keys/keys/:room_id",
|
||||||
|
1.0 => "/_matrix/client/r0/room_keys/keys/:room_id",
|
||||||
|
1.1 => "/_matrix/client/v3/room_keys/keys/:room_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The backup version to add keys to.
|
/// The backup version to add keys to.
|
||||||
///
|
///
|
||||||
/// Must be the current backup.
|
/// Must be the current backup.
|
||||||
@ -40,7 +46,8 @@ pub mod v3 {
|
|||||||
pub sessions: BTreeMap<String, Raw<KeyBackupData>>,
|
pub sessions: BTreeMap<String, Raw<KeyBackupData>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// An opaque string representing stored keys in the backup.
|
/// An opaque string representing stored keys in the backup.
|
||||||
///
|
///
|
||||||
/// Clients can compare it with the etag value they received in the request of their last
|
/// Clients can compare it with the etag value they received in the request of their last
|
||||||
@ -51,9 +58,6 @@ pub mod v3 {
|
|||||||
pub count: UInt,
|
pub count: UInt,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given version, room_id and sessions.
|
/// Creates a new `Request` with the given version, room_id and sessions.
|
||||||
pub fn new(
|
pub fn new(
|
||||||
|
@ -6,24 +6,30 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3room_keyskeysroomidsessionid
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3room_keyskeysroomidsessionid
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{api::ruma_api, serde::Raw, RoomId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
serde::Raw,
|
||||||
|
RoomId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::backup::KeyBackupData;
|
use crate::backup::KeyBackupData;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Store keys in the backup for a session.",
|
description: "Store keys in the backup for a session.",
|
||||||
method: PUT,
|
method: PUT,
|
||||||
name: "add_backup_keys_for_session",
|
name: "add_backup_keys_for_session",
|
||||||
unstable_path: "/_matrix/client/unstable/room_keys/keys/:room_id/:session_id",
|
|
||||||
r0_path: "/_matrix/client/r0/room_keys/keys/:room_id/:session_id",
|
|
||||||
stable_path: "/_matrix/client/v3/room_keys/keys/:room_id/:session_id",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
unstable => "/_matrix/client/unstable/room_keys/keys/:room_id/:session_id",
|
||||||
|
1.0 => "/_matrix/client/r0/room_keys/keys/:room_id/:session_id",
|
||||||
|
1.1 => "/_matrix/client/v3/room_keys/keys/:room_id/:session_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The backup version to add keys to.
|
/// The backup version to add keys to.
|
||||||
///
|
///
|
||||||
/// Must be the current backup.
|
/// Must be the current backup.
|
||||||
@ -43,7 +49,8 @@ pub mod v3 {
|
|||||||
pub session_data: Raw<KeyBackupData>,
|
pub session_data: Raw<KeyBackupData>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// An opaque string representing stored keys in the backup.
|
/// An opaque string representing stored keys in the backup.
|
||||||
///
|
///
|
||||||
/// Clients can compare it with the etag value they received in the request of their last
|
/// Clients can compare it with the etag value they received in the request of their last
|
||||||
@ -54,9 +61,6 @@ pub mod v3 {
|
|||||||
pub count: UInt,
|
pub count: UInt,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given version, room_id, session_id and session_data.
|
/// Creates a new `Request` with the given version, room_id, session_id and session_data.
|
||||||
pub fn new(
|
pub fn new(
|
||||||
|
@ -5,36 +5,39 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3room_keysversion
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3room_keysversion
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, serde::Raw};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
serde::Raw,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::backup::BackupAlgorithm;
|
use crate::backup::BackupAlgorithm;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Create a new backup version.",
|
description: "Create a new backup version.",
|
||||||
method: POST,
|
method: POST,
|
||||||
name: "create_backup_version",
|
name: "create_backup_version",
|
||||||
unstable_path: "/_matrix/client/unstable/room_keys/version",
|
|
||||||
stable_path: "/_matrix/client/v3/room_keys/version",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.1,
|
history: {
|
||||||
|
unstable => "/_matrix/client/unstable/room_keys/version",
|
||||||
|
1.1 => "/_matrix/client/v3/room_keys/version",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request {
|
||||||
/// The algorithm used for storing backups.
|
/// The algorithm used for storing backups.
|
||||||
#[ruma_api(body)]
|
#[ruma_api(body)]
|
||||||
pub algorithm: Raw<BackupAlgorithm>,
|
pub algorithm: Raw<BackupAlgorithm>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// The backup version.
|
/// The backup version.
|
||||||
pub version: String,
|
pub version: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Request {
|
impl Request {
|
||||||
/// Creates a new `Request` with the given backup algorithm.
|
/// Creates a new `Request` with the given backup algorithm.
|
||||||
pub fn new(algorithm: Raw<BackupAlgorithm>) -> Self {
|
pub fn new(algorithm: Raw<BackupAlgorithm>) -> Self {
|
||||||
|
@ -8,28 +8,33 @@ pub mod v3 {
|
|||||||
//! This deletes keys from a backup version, but not the version itself.
|
//! This deletes keys from a backup version, but not the version itself.
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::api::ruma_api;
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Delete all keys from a backup.",
|
description: "Delete all keys from a backup.",
|
||||||
method: DELETE,
|
method: DELETE,
|
||||||
name: "delete_backup_keys",
|
name: "delete_backup_keys",
|
||||||
unstable_path: "/_matrix/client/unstable/room_keys/keys",
|
|
||||||
r0_path: "/_matrix/client/r0/room_keys/keys",
|
|
||||||
stable_path: "/_matrix/client/v3/room_keys/keys",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
unstable => "/_matrix/client/unstable/room_keys/keys",
|
||||||
|
1.0 => "/_matrix/client/r0/room_keys/keys",
|
||||||
|
1.1 => "/_matrix/client/v3/room_keys/keys",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The backup version from which to delete keys.
|
/// The backup version from which to delete keys.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub version: &'a str,
|
pub version: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// An opaque string representing stored keys in the backup.
|
/// An opaque string representing stored keys in the backup.
|
||||||
///
|
///
|
||||||
/// Clients can compare it with the etag value they received in the request of their last
|
/// Clients can compare it with the etag value they received in the request of their last
|
||||||
@ -40,9 +45,6 @@ pub mod v3 {
|
|||||||
pub count: UInt,
|
pub count: UInt,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given version.
|
/// Creates a new `Request` with the given version.
|
||||||
pub fn new(version: &'a str) -> Self {
|
pub fn new(version: &'a str) -> Self {
|
||||||
|
@ -6,22 +6,26 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#delete_matrixclientv3room_keyskeysroomid
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#delete_matrixclientv3room_keyskeysroomid
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{api::ruma_api, RoomId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, RoomId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Delete keys from a backup for a given room.",
|
description: "Delete keys from a backup for a given room.",
|
||||||
method: DELETE,
|
method: DELETE,
|
||||||
name: "delete_backup_keys_for_room",
|
name: "delete_backup_keys_for_room",
|
||||||
unstable_path: "/_matrix/client/unstable/room_keys/keys/:room_id",
|
|
||||||
r0_path: "/_matrix/client/r0/room_keys/keys/:room_id",
|
|
||||||
stable_path: "/_matrix/client/v3/room_keys/keys/:room_id",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
unstable => "/_matrix/client/unstable/room_keys/keys/:room_id",
|
||||||
|
1.0 => "/_matrix/client/r0/room_keys/keys/:room_id",
|
||||||
|
1.1 => "/_matrix/client/v3/room_keys/keys/:room_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The backup version from which to delete keys.
|
/// The backup version from which to delete keys.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub version: &'a str,
|
pub version: &'a str,
|
||||||
@ -31,7 +35,8 @@ pub mod v3 {
|
|||||||
pub room_id: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// An opaque string representing stored keys in the backup.
|
/// An opaque string representing stored keys in the backup.
|
||||||
///
|
///
|
||||||
/// Clients can compare it with the etag value they received in the request of their last
|
/// Clients can compare it with the etag value they received in the request of their last
|
||||||
@ -42,9 +47,6 @@ pub mod v3 {
|
|||||||
pub count: UInt,
|
pub count: UInt,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given version and room_id.
|
/// Creates a new `Request` with the given version and room_id.
|
||||||
|
|
||||||
|
@ -6,22 +6,26 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#delete_matrixclientv3room_keyskeysroomidsessionid
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#delete_matrixclientv3room_keyskeysroomidsessionid
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{api::ruma_api, RoomId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, RoomId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Delete keys from a backup for a given session.",
|
description: "Delete keys from a backup for a given session.",
|
||||||
method: DELETE,
|
method: DELETE,
|
||||||
name: "delete_backup_keys_for_session",
|
name: "delete_backup_keys_for_session",
|
||||||
unstable_path: "/_matrix/client/unstable/room_keys/keys/:room_id/:session_id",
|
|
||||||
r0_path: "/_matrix/client/r0/room_keys/keys/:room_id/:session_id",
|
|
||||||
stable_path: "/_matrix/client/v3/room_keys/keys/:room_id/:session_id",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
unstable => "/_matrix/client/unstable/room_keys/keys/:room_id/:session_id",
|
||||||
|
1.0 => "/_matrix/client/r0/room_keys/keys/:room_id/:session_id",
|
||||||
|
1.1 => "/_matrix/client/v3/room_keys/keys/:room_id/:session_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The backup version from which to delete keys.
|
/// The backup version from which to delete keys.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub version: &'a str,
|
pub version: &'a str,
|
||||||
@ -35,7 +39,8 @@ pub mod v3 {
|
|||||||
pub session_id: &'a str,
|
pub session_id: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// An opaque string representing stored keys in the backup.
|
/// An opaque string representing stored keys in the backup.
|
||||||
///
|
///
|
||||||
/// Clients can compare it with the etag value they received in the request of their last
|
/// Clients can compare it with the etag value they received in the request of their last
|
||||||
@ -46,9 +51,6 @@ pub mod v3 {
|
|||||||
pub count: UInt,
|
pub count: UInt,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given version, room_id and session_id.
|
/// Creates a new `Request` with the given version, room_id and session_id.
|
||||||
pub fn new(version: &'a str, room_id: &'a RoomId, session_id: &'a str) -> Self {
|
pub fn new(version: &'a str, room_id: &'a RoomId, session_id: &'a str) -> Self {
|
||||||
|
@ -7,32 +7,34 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! This deletes a backup version and its room keys.
|
//! This deletes a backup version and its room keys.
|
||||||
|
|
||||||
use ruma_common::api::ruma_api;
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Delete a backup version.",
|
description: "Delete a backup version.",
|
||||||
method: DELETE,
|
method: DELETE,
|
||||||
name: "delete_backup_version",
|
name: "delete_backup_version",
|
||||||
unstable_path: "/_matrix/client/unstable/room_keys/version/:version",
|
|
||||||
r0_path: "/_matrix/client/r0/room_keys/version/:version",
|
|
||||||
stable_path: "/_matrix/client/v3/room_keys/version/:version",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
unstable => "/_matrix/client/unstable/room_keys/version/:version",
|
||||||
|
1.0 => "/_matrix/client/r0/room_keys/version/:version",
|
||||||
|
1.1 => "/_matrix/client/v3/room_keys/version/:version",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The backup version to delete.
|
/// The backup version to delete.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub version: &'a str,
|
pub version: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given version, room_id and sessions.
|
/// Creates a new `Request` with the given version, room_id and sessions.
|
||||||
|
@ -8,32 +8,38 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3room_keysversionversion
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3room_keysversionversion
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{api::ruma_api, serde::Raw};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
serde::Raw,
|
||||||
|
};
|
||||||
use serde::{ser, Deserialize, Deserializer, Serialize};
|
use serde::{ser, Deserialize, Deserializer, Serialize};
|
||||||
use serde_json::value::{to_raw_value as to_raw_json_value, RawValue as RawJsonValue};
|
use serde_json::value::{to_raw_value as to_raw_json_value, RawValue as RawJsonValue};
|
||||||
|
|
||||||
use crate::backup::BackupAlgorithm;
|
use crate::backup::BackupAlgorithm;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Get information about a specific backup.",
|
description: "Get information about a specific backup.",
|
||||||
method: GET,
|
method: GET,
|
||||||
name: "get_backup_info",
|
name: "get_backup_info",
|
||||||
unstable_path: "/_matrix/client/unstable/room_keys/version/:version",
|
|
||||||
stable_path: "/_matrix/client/v3/room_keys/version/:version",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.1,
|
history: {
|
||||||
|
unstable => "/_matrix/client/unstable/room_keys/version/:version",
|
||||||
|
1.1 => "/_matrix/client/v3/room_keys/version/:version",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The backup version to retrieve info from.
|
/// The backup version to retrieve info from.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub version: &'a str,
|
pub version: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[ruma_api(manual_body_serde)]
|
#[ruma_api(manual_body_serde)]
|
||||||
response: {
|
pub struct Response {
|
||||||
/// The algorithm used for storing backups.
|
/// The algorithm used for storing backups.
|
||||||
pub algorithm: Raw<BackupAlgorithm>,
|
pub algorithm: Raw<BackupAlgorithm>,
|
||||||
|
|
||||||
@ -50,9 +56,6 @@ pub mod v3 {
|
|||||||
pub version: String,
|
pub version: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given version.
|
/// Creates a new `Request` with the given version.
|
||||||
pub fn new(version: &'a str) -> Self {
|
pub fn new(version: &'a str) -> Self {
|
||||||
|
@ -9,37 +9,39 @@ pub mod v3 {
|
|||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, OwnedRoomId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, OwnedRoomId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::backup::RoomKeyBackup;
|
use crate::backup::RoomKeyBackup;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Retrieve all keys from a backup version.",
|
description: "Retrieve all keys from a backup version.",
|
||||||
method: GET,
|
method: GET,
|
||||||
name: "get_backup_keys",
|
name: "get_backup_keys",
|
||||||
unstable_path: "/_matrix/client/unstable/room_keys/keys",
|
|
||||||
r0_path: "/_matrix/client/r0/room_keys/keys",
|
|
||||||
stable_path: "/_matrix/client/v3/room_keys/keys",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
unstable => "/_matrix/client/unstable/room_keys/keys",
|
||||||
|
1.0 => "/_matrix/client/r0/room_keys/keys",
|
||||||
|
1.1 => "/_matrix/client/v3/room_keys/keys",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The backup version to retrieve keys from.
|
/// The backup version to retrieve keys from.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub version: &'a str,
|
pub version: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// A map from room IDs to session IDs to key data.
|
/// A map from room IDs to session IDs to key data.
|
||||||
pub rooms: BTreeMap<OwnedRoomId, RoomKeyBackup>,
|
pub rooms: BTreeMap<OwnedRoomId, RoomKeyBackup>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given version.
|
/// Creates a new `Request` with the given version.
|
||||||
pub fn new(version: &'a str) -> Self {
|
pub fn new(version: &'a str) -> Self {
|
||||||
|
@ -7,24 +7,30 @@ pub mod v3 {
|
|||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, serde::Raw, RoomId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
serde::Raw,
|
||||||
|
RoomId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::backup::KeyBackupData;
|
use crate::backup::KeyBackupData;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Retrieve sessions from the backup for a given room.",
|
description: "Retrieve sessions from the backup for a given room.",
|
||||||
method: GET,
|
method: GET,
|
||||||
name: "get_backup_keys_for_room",
|
name: "get_backup_keys_for_room",
|
||||||
unstable_path: "/_matrix/client/unstable/room_keys/keys/:room_id",
|
|
||||||
r0_path: "/_matrix/client/r0/room_keys/keys/:room_id",
|
|
||||||
stable_path: "/_matrix/client/v3/room_keys/keys/:room_id",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
unstable => "/_matrix/client/unstable/room_keys/keys/:room_id",
|
||||||
|
1.0 => "/_matrix/client/r0/room_keys/keys/:room_id",
|
||||||
|
1.1 => "/_matrix/client/v3/room_keys/keys/:room_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The backup version to retrieve keys from.
|
/// The backup version to retrieve keys from.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub version: &'a str,
|
pub version: &'a str,
|
||||||
@ -34,14 +40,12 @@ pub mod v3 {
|
|||||||
pub room_id: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// A map of session IDs to key data.
|
/// A map of session IDs to key data.
|
||||||
pub sessions: BTreeMap<String, Raw<KeyBackupData>>,
|
pub sessions: BTreeMap<String, Raw<KeyBackupData>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given version and room_id.
|
/// Creates a new `Request` with the given version and room_id.
|
||||||
pub fn new(version: &'a str, room_id: &'a RoomId) -> Self {
|
pub fn new(version: &'a str, room_id: &'a RoomId) -> Self {
|
||||||
|
@ -5,24 +5,30 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3room_keyskeysroomidsessionid
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3room_keyskeysroomidsessionid
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, serde::Raw, RoomId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
serde::Raw,
|
||||||
|
RoomId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::backup::KeyBackupData;
|
use crate::backup::KeyBackupData;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Retrieve a key from the backup for a given session.",
|
description: "Retrieve a key from the backup for a given session.",
|
||||||
method: GET,
|
method: GET,
|
||||||
name: "get_backup_keys_for_session",
|
name: "get_backup_keys_for_session",
|
||||||
unstable_path: "/_matrix/client/unstable/room_keys/keys/:room_id/:session_id",
|
|
||||||
r0_path: "/_matrix/client/r0/room_keys/keys/:room_id/:session_id",
|
|
||||||
stable_path: "/_matrix/client/v3/room_keys/keys/:room_id/:session_id",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
unstable => "/_matrix/client/unstable/room_keys/keys/:room_id/:session_id",
|
||||||
|
1.0 => "/_matrix/client/r0/room_keys/keys/:room_id/:session_id",
|
||||||
|
1.1 => "/_matrix/client/v3/room_keys/keys/:room_id/:session_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The backup version to retrieve keys from.
|
/// The backup version to retrieve keys from.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub version: &'a str,
|
pub version: &'a str,
|
||||||
@ -36,15 +42,13 @@ pub mod v3 {
|
|||||||
pub session_id: &'a str,
|
pub session_id: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// Information about the requested backup key.
|
/// Information about the requested backup key.
|
||||||
#[ruma_api(body)]
|
#[ruma_api(body)]
|
||||||
pub key_data: Raw<KeyBackupData>,
|
pub key_data: Raw<KeyBackupData>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given version, room_id and session_id.
|
/// Creates a new `Request` with the given version, room_id and session_id.
|
||||||
pub fn new(version: &'a str, room_id: &'a RoomId, session_id: &'a str) -> Self {
|
pub fn new(version: &'a str, room_id: &'a RoomId, session_id: &'a str) -> Self {
|
||||||
|
@ -6,7 +6,11 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3room_keysversion
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3room_keysversion
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{api::ruma_api, serde::Raw};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
serde::Raw,
|
||||||
|
};
|
||||||
use serde::{ser, Deserialize, Deserializer, Serialize};
|
use serde::{ser, Deserialize, Deserializer, Serialize};
|
||||||
use serde_json::value::to_raw_value as to_raw_json_value;
|
use serde_json::value::to_raw_value as to_raw_json_value;
|
||||||
|
|
||||||
@ -15,24 +19,26 @@ pub mod v3 {
|
|||||||
BackupAlgorithm,
|
BackupAlgorithm,
|
||||||
};
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Get information about the latest backup.",
|
description: "Get information about the latest backup.",
|
||||||
method: GET,
|
method: GET,
|
||||||
name: "get_latest_backup_info",
|
name: "get_latest_backup_info",
|
||||||
unstable_path: "/_matrix/client/unstable/room_keys/version",
|
|
||||||
r0_path: "/_matrix/client/r0/room_keys/version",
|
|
||||||
stable_path: "/_matrix/client/v3/room_keys/version",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
unstable => "/_matrix/client/unstable/room_keys/version",
|
||||||
|
1.0 => "/_matrix/client/r0/room_keys/version",
|
||||||
|
1.1 => "/_matrix/client/v3/room_keys/version",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#[request(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
request: {}
|
pub struct Request {}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[ruma_api(manual_body_serde)]
|
#[ruma_api(manual_body_serde)]
|
||||||
response: {
|
pub struct Response {
|
||||||
/// The algorithm used for storing backups.
|
/// The algorithm used for storing backups.
|
||||||
pub algorithm: Raw<BackupAlgorithm>,
|
pub algorithm: Raw<BackupAlgorithm>,
|
||||||
|
|
||||||
@ -49,9 +55,6 @@ pub mod v3 {
|
|||||||
pub version: String,
|
pub version: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Request {
|
impl Request {
|
||||||
/// Creates an empty `Request`.
|
/// Creates an empty `Request`.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
@ -5,23 +5,28 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3room_keysversionversion
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3room_keysversionversion
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, serde::Raw};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
serde::Raw,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::backup::BackupAlgorithm;
|
use crate::backup::BackupAlgorithm;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Update information about an existing backup.",
|
description: "Update information about an existing backup.",
|
||||||
method: PUT,
|
method: PUT,
|
||||||
name: "update_backup_version",
|
name: "update_backup_version",
|
||||||
unstable_path: "/_matrix/client/unstable/room_keys/version/:version",
|
|
||||||
stable_path: "/_matrix/client/v3/room_keys/version/:version",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
unstable => "/_matrix/client/unstable/room_keys/version/:version",
|
||||||
|
1.1 => "/_matrix/client/v3/room_keys/version/:version",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The backup version.
|
/// The backup version.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub version: &'a str,
|
pub version: &'a str,
|
||||||
@ -31,11 +36,9 @@ pub mod v3 {
|
|||||||
pub algorithm: Raw<BackupAlgorithm>,
|
pub algorithm: Raw<BackupAlgorithm>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given backup version and algorithm.
|
/// Creates a new `Request` with the given backup version and algorithm.
|
||||||
|
@ -6,22 +6,27 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3useruseridaccount_datatype
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3useruseridaccount_datatype
|
||||||
|
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::ruma_api, events::AnyGlobalAccountDataEventContent, serde::Raw, UserId,
|
api::{request, response, Metadata},
|
||||||
|
events::AnyGlobalAccountDataEventContent,
|
||||||
|
metadata,
|
||||||
|
serde::Raw,
|
||||||
|
UserId,
|
||||||
};
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Gets global account data for a user.",
|
description: "Gets global account data for a user.",
|
||||||
name: "get_global_account_data",
|
|
||||||
method: GET,
|
method: GET,
|
||||||
r0_path: "/_matrix/client/r0/user/:user_id/account_data/:event_type",
|
name: "get_global_account_data",
|
||||||
stable_path: "/_matrix/client/v3/user/:user_id/account_data/:event_type",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/user/:user_id/account_data/:event_type",
|
||||||
|
1.1 => "/_matrix/client/v3/user/:user_id/account_data/:event_type",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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: &'a UserId,
|
pub user_id: &'a UserId,
|
||||||
@ -31,7 +36,8 @@ pub mod v3 {
|
|||||||
pub event_type: &'a str,
|
pub event_type: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// Account data content for the given type.
|
/// Account data content for the given type.
|
||||||
///
|
///
|
||||||
/// Use [`Raw::deserialize_content`] for deserialization.
|
/// Use [`Raw::deserialize_content`] for deserialization.
|
||||||
@ -39,9 +45,6 @@ pub mod v3 {
|
|||||||
pub account_data: Raw<AnyGlobalAccountDataEventContent>,
|
pub account_data: Raw<AnyGlobalAccountDataEventContent>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given user ID and event type.
|
/// Creates a new `Request` with the given user ID and event type.
|
||||||
pub fn new(user_id: &'a UserId, event_type: &'a str) -> Self {
|
pub fn new(user_id: &'a UserId, event_type: &'a str) -> Self {
|
||||||
|
@ -6,22 +6,27 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3useruseridroomsroomidaccount_datatype
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3useruseridroomsroomidaccount_datatype
|
||||||
|
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::ruma_api, events::AnyRoomAccountDataEventContent, serde::Raw, RoomId, UserId,
|
api::{request, response, Metadata},
|
||||||
|
events::AnyRoomAccountDataEventContent,
|
||||||
|
metadata,
|
||||||
|
serde::Raw,
|
||||||
|
RoomId, UserId,
|
||||||
};
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
|
||||||
method: GET,
|
method: GET,
|
||||||
r0_path: "/_matrix/client/r0/user/:user_id/rooms/:room_id/account_data/:event_type",
|
name: "get_room_account_data",
|
||||||
stable_path: "/_matrix/client/v3/user/:user_id/rooms/:room_id/account_data/:event_type",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/user/:user_id/rooms/:room_id/account_data/:event_type",
|
||||||
|
1.1 => "/_matrix/client/v3/user/:user_id/rooms/:room_id/account_data/:event_type",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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: &'a UserId,
|
pub user_id: &'a UserId,
|
||||||
@ -35,7 +40,8 @@ pub mod v3 {
|
|||||||
pub event_type: &'a str,
|
pub event_type: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// Account data content for the given type.
|
/// Account data content for the given type.
|
||||||
///
|
///
|
||||||
/// Use [`Raw::deserialize_content`] for deserialization.
|
/// Use [`Raw::deserialize_content`] for deserialization.
|
||||||
@ -43,9 +49,6 @@ pub mod v3 {
|
|||||||
pub account_data: Raw<AnyRoomAccountDataEventContent>,
|
pub account_data: Raw<AnyRoomAccountDataEventContent>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given user ID, room ID and event type.
|
/// Creates a new `Request` with the given user ID, room ID and event type.
|
||||||
pub fn new(user_id: &'a UserId, room_id: &'a RoomId, event_type: &'a str) -> Self {
|
pub fn new(user_id: &'a UserId, room_id: &'a RoomId, event_type: &'a str) -> Self {
|
||||||
|
@ -6,29 +6,31 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3useruseridaccount_datatype
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3useruseridaccount_datatype
|
||||||
|
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::ruma_api,
|
api::{request, response, Metadata},
|
||||||
events::{
|
events::{
|
||||||
AnyGlobalAccountDataEventContent, GlobalAccountDataEventContent,
|
AnyGlobalAccountDataEventContent, GlobalAccountDataEventContent,
|
||||||
GlobalAccountDataEventType,
|
GlobalAccountDataEventType,
|
||||||
},
|
},
|
||||||
|
metadata,
|
||||||
serde::Raw,
|
serde::Raw,
|
||||||
UserId,
|
UserId,
|
||||||
};
|
};
|
||||||
use serde_json::value::to_raw_value as to_raw_json_value;
|
use serde_json::value::to_raw_value as to_raw_json_value;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/user/:user_id/account_data/:event_type",
|
|
||||||
stable_path: "/_matrix/client/v3/user/:user_id/account_data/:event_type",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/user/:user_id/account_data/:event_type",
|
||||||
|
1.1 => "/_matrix/client/v3/user/:user_id/account_data/:event_type",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The ID of the user to set account_data for.
|
/// The ID of the user to set account_data for.
|
||||||
///
|
///
|
||||||
/// 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.
|
||||||
@ -48,11 +50,9 @@ pub mod v3 {
|
|||||||
pub data: Raw<AnyGlobalAccountDataEventContent>,
|
pub data: Raw<AnyGlobalAccountDataEventContent>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given data, event type and user ID.
|
/// Creates a new `Request` with the given data, event type and user ID.
|
||||||
|
@ -6,28 +6,30 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3useruseridroomsroomidaccount_datatype
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3useruseridroomsroomidaccount_datatype
|
||||||
|
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::ruma_api,
|
api::{request, response, Metadata},
|
||||||
events::{
|
events::{
|
||||||
AnyRoomAccountDataEventContent, RoomAccountDataEventContent, RoomAccountDataEventType,
|
AnyRoomAccountDataEventContent, RoomAccountDataEventContent, RoomAccountDataEventType,
|
||||||
},
|
},
|
||||||
|
metadata,
|
||||||
serde::Raw,
|
serde::Raw,
|
||||||
RoomId, UserId,
|
RoomId, UserId,
|
||||||
};
|
};
|
||||||
use serde_json::value::to_raw_value as to_raw_json_value;
|
use serde_json::value::to_raw_value as to_raw_json_value;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/user/:user_id/rooms/:room_id/account_data/:event_type",
|
|
||||||
stable_path: "/_matrix/client/v3/user/:user_id/rooms/:room_id/account_data/:event_type",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/user/:user_id/rooms/:room_id/account_data/:event_type",
|
||||||
|
1.1 => "/_matrix/client/v3/user/:user_id/rooms/:room_id/account_data/:event_type",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The ID of the user to set account_data for.
|
/// The ID of the user to set account_data for.
|
||||||
///
|
///
|
||||||
/// 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.
|
||||||
@ -51,11 +53,9 @@ pub mod v3 {
|
|||||||
pub data: Raw<AnyRoomAccountDataEventContent>,
|
pub data: Raw<AnyRoomAccountDataEventContent>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given data, event type, room ID and user ID.
|
/// Creates a new `Request` with the given data, event type, room ID and user ID.
|
||||||
|
@ -7,27 +7,29 @@ pub mod v3 {
|
|||||||
|
|
||||||
use js_int::{uint, UInt};
|
use js_int::{uint, UInt};
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::ruma_api,
|
api::{request, response, Metadata},
|
||||||
events::{AnyStateEvent, AnyTimelineEvent},
|
events::{AnyStateEvent, AnyTimelineEvent},
|
||||||
|
metadata,
|
||||||
serde::Raw,
|
serde::Raw,
|
||||||
EventId, RoomId,
|
EventId, RoomId,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::filter::{IncomingRoomEventFilter, RoomEventFilter};
|
use crate::filter::{IncomingRoomEventFilter, RoomEventFilter};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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,
|
||||||
r0_path: "/_matrix/client/r0/rooms/:room_id/context/:event_id",
|
|
||||||
stable_path: "/_matrix/client/v3/rooms/:room_id/context/:event_id",
|
|
||||||
name: "get_context",
|
name: "get_context",
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/rooms/:room_id/context/:event_id",
|
||||||
|
1.1 => "/_matrix/client/v3/rooms/:room_id/context/:event_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The room to get events from.
|
/// The room to get events from.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub room_id: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
@ -53,8 +55,9 @@ pub mod v3 {
|
|||||||
pub filter: RoomEventFilter<'a>,
|
pub filter: RoomEventFilter<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {
|
pub struct 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>,
|
||||||
@ -82,9 +85,6 @@ pub mod v3 {
|
|||||||
pub state: Vec<Raw<AnyStateEvent>>,
|
pub state: Vec<Raw<AnyStateEvent>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room id and event id.
|
/// Creates a new `Request` with the given room id and event id.
|
||||||
pub fn new(room_id: &'a RoomId, event_id: &'a EventId) -> Self {
|
pub fn new(room_id: &'a RoomId, event_id: &'a EventId) -> Self {
|
||||||
|
@ -5,23 +5,27 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#delete_matrixclientv3devicesdeviceid
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#delete_matrixclientv3devicesdeviceid
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, DeviceId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, DeviceId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::uiaa::{AuthData, IncomingAuthData, UiaaResponse};
|
use crate::uiaa::{AuthData, IncomingAuthData, UiaaResponse};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/devices/:device_id",
|
|
||||||
stable_path: "/_matrix/client/v3/devices/:device_id",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/devices/:device_id",
|
||||||
|
1.1 => "/_matrix/client/v3/devices/:device_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = UiaaResponse)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The device to delete.
|
/// The device to delete.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub device_id: &'a DeviceId,
|
pub device_id: &'a DeviceId,
|
||||||
@ -31,11 +35,9 @@ pub mod v3 {
|
|||||||
pub auth: Option<AuthData<'a>>,
|
pub auth: Option<AuthData<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = UiaaResponse)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: UiaaResponse
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given device ID.
|
/// Creates a new `Request` with the given device ID.
|
||||||
|
@ -5,23 +5,27 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3delete_devices
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3delete_devices
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, OwnedDeviceId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, OwnedDeviceId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::uiaa::{AuthData, IncomingAuthData, UiaaResponse};
|
use crate::uiaa::{AuthData, IncomingAuthData, UiaaResponse};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Delete specified devices.",
|
description: "Delete specified devices.",
|
||||||
method: POST,
|
method: POST,
|
||||||
r0_path: "/_matrix/client/r0/delete_devices",
|
|
||||||
stable_path: "/_matrix/client/v3/delete_devices",
|
|
||||||
name: "delete_devices",
|
name: "delete_devices",
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/delete_devices",
|
||||||
|
1.1 => "/_matrix/client/v3/delete_devices",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = UiaaResponse)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// List of devices to delete.
|
/// List of devices to delete.
|
||||||
pub devices: &'a [OwnedDeviceId],
|
pub devices: &'a [OwnedDeviceId],
|
||||||
|
|
||||||
@ -30,11 +34,9 @@ pub mod v3 {
|
|||||||
pub auth: Option<AuthData<'a>>,
|
pub auth: Option<AuthData<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = UiaaResponse)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: UiaaResponse
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given device list.
|
/// Creates a new `Request` with the given device list.
|
||||||
|
@ -5,37 +5,39 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3devicesdeviceid
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3devicesdeviceid
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, DeviceId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, DeviceId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::device::Device;
|
use crate::device::Device;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/devices/:device_id",
|
|
||||||
stable_path: "/_matrix/client/v3/devices/:device_id",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/devices/:device_id",
|
||||||
|
1.1 => "/_matrix/client/v3/devices/:device_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The device to retrieve.
|
/// The device to retrieve.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub device_id: &'a DeviceId,
|
pub device_id: &'a DeviceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// Information about the device.
|
/// Information about the device.
|
||||||
#[ruma_api(body)]
|
#[ruma_api(body)]
|
||||||
pub device: Device,
|
pub device: Device,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given device ID.
|
/// Creates a new `Request` with the given device ID.
|
||||||
pub fn new(device_id: &'a DeviceId) -> Self {
|
pub fn new(device_id: &'a DeviceId) -> Self {
|
||||||
|
@ -5,33 +5,35 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3devices
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3devices
|
||||||
|
|
||||||
use ruma_common::api::ruma_api;
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::device::Device;
|
use crate::device::Device;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/devices",
|
|
||||||
stable_path: "/_matrix/client/v3/devices",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/devices",
|
||||||
|
1.1 => "/_matrix/client/v3/devices",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#[request(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
request: {}
|
pub struct Request {}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct 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>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Request {
|
impl Request {
|
||||||
/// Creates an empty `Request`.
|
/// Creates an empty `Request`.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
@ -5,21 +5,25 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3devicesdeviceid
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3devicesdeviceid
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, DeviceId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, DeviceId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Update metadata for a device.",
|
description: "Update metadata for a device.",
|
||||||
method: PUT,
|
method: PUT,
|
||||||
name: "update_device",
|
name: "update_device",
|
||||||
r0_path: "/_matrix/client/r0/devices/:device_id",
|
|
||||||
stable_path: "/_matrix/client/v3/devices/:device_id",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/devices/:device_id",
|
||||||
|
1.1 => "/_matrix/client/v3/devices/:device_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The device to update.
|
/// The device to update.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub device_id: &'a DeviceId,
|
pub device_id: &'a DeviceId,
|
||||||
@ -31,11 +35,9 @@ pub mod v3 {
|
|||||||
pub display_name: Option<&'a str>,
|
pub display_name: Option<&'a str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given device ID.
|
/// Creates a new `Request` with the given device ID.
|
||||||
|
@ -6,22 +6,27 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3publicrooms
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3publicrooms
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{api::ruma_api, directory::PublicRoomsChunk, ServerName};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
directory::PublicRoomsChunk,
|
||||||
|
metadata, ServerName,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/publicRooms",
|
|
||||||
stable_path: "/_matrix/client/v3/publicRooms",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/publicRooms",
|
||||||
|
1.1 => "/_matrix/client/v3/publicRooms",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#[request(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
request: {
|
pub struct Request<'a> {
|
||||||
/// 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)]
|
||||||
@ -40,7 +45,8 @@ pub mod v3 {
|
|||||||
pub server: Option<&'a ServerName>,
|
pub server: Option<&'a ServerName>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// A paginated chunk of public rooms.
|
/// A paginated chunk of public rooms.
|
||||||
pub chunk: Vec<PublicRoomsChunk>,
|
pub chunk: Vec<PublicRoomsChunk>,
|
||||||
|
|
||||||
@ -57,9 +63,6 @@ pub mod v3 {
|
|||||||
pub total_room_count_estimate: Option<UInt>,
|
pub total_room_count_estimate: Option<UInt>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates an empty `Request`.
|
/// Creates an empty `Request`.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
@ -7,25 +7,26 @@ pub mod v3 {
|
|||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::ruma_api,
|
api::{request, response, Metadata},
|
||||||
directory::{Filter, IncomingFilter, IncomingRoomNetwork, PublicRoomsChunk, RoomNetwork},
|
directory::{Filter, IncomingFilter, IncomingRoomNetwork, PublicRoomsChunk, RoomNetwork},
|
||||||
ServerName,
|
metadata, ServerName,
|
||||||
};
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/publicRooms",
|
|
||||||
stable_path: "/_matrix/client/v3/publicRooms",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/publicRooms",
|
||||||
|
1.1 => "/_matrix/client/v3/publicRooms",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#[request(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
request: {
|
pub struct Request<'a> {
|
||||||
/// 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.
|
||||||
@ -50,8 +51,9 @@ pub mod v3 {
|
|||||||
pub room_network: RoomNetwork<'a>,
|
pub room_network: RoomNetwork<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {
|
pub struct Response {
|
||||||
/// A paginated chunk of public rooms.
|
/// A paginated chunk of public rooms.
|
||||||
pub chunk: Vec<PublicRoomsChunk>,
|
pub chunk: Vec<PublicRoomsChunk>,
|
||||||
|
|
||||||
@ -68,9 +70,6 @@ pub mod v3 {
|
|||||||
pub total_room_count_estimate: Option<UInt>,
|
pub total_room_count_estimate: Option<UInt>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Request<'_> {
|
impl Request<'_> {
|
||||||
/// Creates an empty `Request`.
|
/// Creates an empty `Request`.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
@ -5,36 +5,38 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3directorylistroomroomid
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3directorylistroomroomid
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, RoomId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, RoomId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::room::Visibility;
|
use crate::room::Visibility;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
|
||||||
method: GET,
|
method: GET,
|
||||||
r0_path: "/_matrix/client/r0/directory/list/room/:room_id",
|
name: "get_room_visibility",
|
||||||
stable_path: "/_matrix/client/v3/directory/list/room/:room_id",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/directory/list/room/:room_id",
|
||||||
|
1.1 => "/_matrix/client/v3/directory/list/room/:room_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// Visibility of the room.
|
/// Visibility of the room.
|
||||||
pub visibility: Visibility,
|
pub visibility: Visibility,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room ID.
|
/// Creates a new `Request` with the given room ID.
|
||||||
pub fn new(room_id: &'a RoomId) -> Self {
|
pub fn new(room_id: &'a RoomId) -> Self {
|
||||||
|
@ -5,23 +5,27 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3directorylistroomroomid
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3directorylistroomroomid
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, RoomId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, RoomId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::room::Visibility;
|
use crate::room::Visibility;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
|
||||||
method: PUT,
|
method: PUT,
|
||||||
r0_path: "/_matrix/client/r0/directory/list/room/:room_id",
|
name: "set_room_visibility",
|
||||||
stable_path: "/_matrix/client/v3/directory/list/room/:room_id",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/directory/list/room/:room_id",
|
||||||
|
1.1 => "/_matrix/client/v3/directory/list/room/:room_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
@ -30,11 +34,9 @@ pub mod v3 {
|
|||||||
pub visibility: Visibility,
|
pub visibility: Visibility,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room ID and visibility.
|
/// Creates a new `Request` with the given room ID and visibility.
|
||||||
|
@ -2,24 +2,29 @@
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#getwell-knownmatrixclient
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#getwell-knownmatrixclient
|
||||||
|
|
||||||
use ruma_common::api::ruma_api;
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Get discovery information about the domain.",
|
description: "Get discovery information about the domain.",
|
||||||
method: GET,
|
method: GET,
|
||||||
name: "client_well_known",
|
name: "client_well_known",
|
||||||
stable_path: "/.well-known/matrix/client",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/.well-known/matrix/client",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#[request(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
request: {}
|
pub struct Request {}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// Information about the homeserver to connect to.
|
/// Information about the homeserver to connect to.
|
||||||
#[serde(rename = "m.homeserver")]
|
#[serde(rename = "m.homeserver")]
|
||||||
pub homeserver: HomeserverInfo,
|
pub homeserver: HomeserverInfo,
|
||||||
@ -33,7 +38,7 @@ ruma_api! {
|
|||||||
#[serde(
|
#[serde(
|
||||||
rename = "org.matrix.msc3488.tile_server",
|
rename = "org.matrix.msc3488.tile_server",
|
||||||
alias = "m.tile_server",
|
alias = "m.tile_server",
|
||||||
skip_serializing_if = "Option::is_none",
|
skip_serializing_if = "Option::is_none"
|
||||||
)]
|
)]
|
||||||
pub tile_server: Option<TileServerInfo>,
|
pub tile_server: Option<TileServerInfo>,
|
||||||
|
|
||||||
@ -47,9 +52,6 @@ ruma_api! {
|
|||||||
pub authentication: Option<AuthenticationServerInfo>,
|
pub authentication: Option<AuthenticationServerInfo>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Request {
|
impl Request {
|
||||||
/// Creates an empty `Request`.
|
/// Creates an empty `Request`.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
@ -2,33 +2,35 @@
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3capabilities
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3capabilities
|
||||||
|
|
||||||
use ruma_common::api::ruma_api;
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
};
|
||||||
|
|
||||||
use super::Capabilities;
|
use super::Capabilities;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/capabilities",
|
|
||||||
stable_path: "/_matrix/client/v3/capabilities",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/capabilities",
|
||||||
|
1.1 => "/_matrix/client/v3/capabilities",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#[request(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
request: {}
|
pub struct Request {}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// The capabilities the server supports
|
/// The capabilities the server supports
|
||||||
pub capabilities: Capabilities,
|
pub capabilities: Capabilities,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Request {
|
impl Request {
|
||||||
/// Creates an empty `Request`.
|
/// Creates an empty `Request`.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
@ -4,23 +4,28 @@
|
|||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use ruma_common::api::{ruma_api, MatrixVersion};
|
use ruma_common::{
|
||||||
|
api::{request, response, MatrixVersion, Metadata},
|
||||||
|
metadata,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Get the versions of the client-server API supported by this homeserver.",
|
description: "Get the versions of the client-server API supported by this homeserver.",
|
||||||
method: GET,
|
method: GET,
|
||||||
name: "api_versions",
|
name: "api_versions",
|
||||||
stable_path: "/_matrix/client/versions",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/versions",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#[request(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
request: {}
|
pub struct Request {}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// A list of Matrix client API protocol versions supported by the homeserver.
|
/// A list of Matrix client API protocol versions supported by the homeserver.
|
||||||
pub versions: Vec<String>,
|
pub versions: Vec<String>,
|
||||||
|
|
||||||
@ -29,9 +34,6 @@ ruma_api! {
|
|||||||
pub unstable_features: BTreeMap<String, bool>,
|
pub unstable_features: BTreeMap<String, bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Request {
|
impl Request {
|
||||||
/// Creates an empty `Request`.
|
/// Creates an empty `Request`.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
@ -5,23 +5,27 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3useruseridfilter
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3useruseridfilter
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, UserId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, UserId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::filter::{FilterDefinition, IncomingFilterDefinition};
|
use crate::filter::{FilterDefinition, IncomingFilterDefinition};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/user/:user_id/filter",
|
|
||||||
stable_path: "/_matrix/client/v3/user/:user_id/filter",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/user/:user_id/filter",
|
||||||
|
1.1 => "/_matrix/client/v3/user/:user_id/filter",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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.
|
||||||
@ -33,14 +37,12 @@ pub mod v3 {
|
|||||||
pub filter: FilterDefinition<'a>,
|
pub filter: FilterDefinition<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct 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,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given user ID and filter definition.
|
/// Creates a new `Request` with the given user ID and filter definition.
|
||||||
pub fn new(user_id: &'a UserId, filter: FilterDefinition<'a>) -> Self {
|
pub fn new(user_id: &'a UserId, filter: FilterDefinition<'a>) -> Self {
|
||||||
|
@ -5,23 +5,27 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3useruseridfilterfilterid
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3useruseridfilterfilterid
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, UserId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, UserId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::filter::IncomingFilterDefinition;
|
use crate::filter::IncomingFilterDefinition;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Retrieve a previously created filter.",
|
description: "Retrieve a previously created filter.",
|
||||||
method: GET,
|
method: GET,
|
||||||
name: "get_filter",
|
name: "get_filter",
|
||||||
r0_path: "/_matrix/client/r0/user/:user_id/filter/:filter_id",
|
|
||||||
stable_path: "/_matrix/client/v3/user/:user_id/filter/:filter_id",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/user/:user_id/filter/:filter_id",
|
||||||
|
1.1 => "/_matrix/client/v3/user/:user_id/filter/:filter_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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: &'a UserId,
|
pub user_id: &'a UserId,
|
||||||
@ -31,15 +35,13 @@ pub mod v3 {
|
|||||||
pub filter_id: &'a str,
|
pub filter_id: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// The filter definition.
|
/// The filter definition.
|
||||||
#[ruma_api(body)]
|
#[ruma_api(body)]
|
||||||
pub filter: IncomingFilterDefinition,
|
pub filter: IncomingFilterDefinition,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given user ID and filter ID.
|
/// Creates a new `Request` with the given user ID and filter ID.
|
||||||
pub fn new(user_id: &'a UserId, filter_id: &'a str) -> Self {
|
pub fn new(user_id: &'a UserId, filter_id: &'a str) -> Self {
|
||||||
|
@ -8,30 +8,34 @@ pub mod v3 {
|
|||||||
use std::{collections::BTreeMap, time::Duration};
|
use std::{collections::BTreeMap, time::Duration};
|
||||||
|
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::ruma_api, encryption::OneTimeKey, serde::Raw, DeviceKeyAlgorithm, OwnedDeviceId,
|
api::{request, response, Metadata},
|
||||||
OwnedDeviceKeyId, OwnedUserId,
|
encryption::OneTimeKey,
|
||||||
|
metadata,
|
||||||
|
serde::Raw,
|
||||||
|
DeviceKeyAlgorithm, OwnedDeviceId, OwnedDeviceKeyId, OwnedUserId,
|
||||||
};
|
};
|
||||||
use serde_json::Value as JsonValue;
|
use serde_json::Value as JsonValue;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/keys/claim",
|
|
||||||
stable_path: "/_matrix/client/v3/keys/claim",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/keys/claim",
|
||||||
|
1.1 => "/_matrix/client/v3/keys/claim",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct 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(
|
||||||
with = "ruma_common::serde::duration::opt_ms",
|
with = "ruma_common::serde::duration::opt_ms",
|
||||||
default,
|
default,
|
||||||
skip_serializing_if = "Option::is_none",
|
skip_serializing_if = "Option::is_none"
|
||||||
)]
|
)]
|
||||||
pub timeout: Option<Duration>,
|
pub timeout: Option<Duration>,
|
||||||
|
|
||||||
@ -39,7 +43,8 @@ pub mod v3 {
|
|||||||
pub one_time_keys: BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceId, DeviceKeyAlgorithm>>,
|
pub one_time_keys: BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceId, DeviceKeyAlgorithm>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct 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>,
|
||||||
@ -48,9 +53,6 @@ pub mod v3 {
|
|||||||
pub one_time_keys: BTreeMap<OwnedUserId, OneTimeKeys>,
|
pub one_time_keys: BTreeMap<OwnedUserId, OneTimeKeys>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Request {
|
impl Request {
|
||||||
/// Creates a new `Request` with the given key claims and the recommended 10 second timeout.
|
/// Creates a new `Request` with the given key claims and the recommended 10 second timeout.
|
||||||
pub fn new(
|
pub fn new(
|
||||||
|
@ -5,21 +5,25 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3keyschanges
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3keyschanges
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, OwnedUserId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, OwnedUserId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/keys/changes",
|
|
||||||
stable_path: "/_matrix/client/v3/keys/changes",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/keys/changes",
|
||||||
|
1.1 => "/_matrix/client/v3/keys/changes",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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.
|
||||||
@ -34,7 +38,8 @@ pub mod v3 {
|
|||||||
pub to: &'a str,
|
pub to: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct 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<OwnedUserId>,
|
pub changed: Vec<OwnedUserId>,
|
||||||
|
|
||||||
@ -43,9 +48,6 @@ pub mod v3 {
|
|||||||
pub left: Vec<OwnedUserId>,
|
pub left: Vec<OwnedUserId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given start and end points.
|
/// Creates a new `Request` with the given start and end points.
|
||||||
pub fn new(from: &'a str, to: &'a str) -> Self {
|
pub fn new(from: &'a str, to: &'a str) -> Self {
|
||||||
|
@ -8,34 +8,36 @@ pub mod v3 {
|
|||||||
use std::{collections::BTreeMap, time::Duration};
|
use std::{collections::BTreeMap, time::Duration};
|
||||||
|
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::ruma_api,
|
api::{request, response, Metadata},
|
||||||
encryption::{CrossSigningKey, DeviceKeys},
|
encryption::{CrossSigningKey, DeviceKeys},
|
||||||
|
metadata,
|
||||||
serde::Raw,
|
serde::Raw,
|
||||||
OwnedDeviceId, OwnedUserId,
|
OwnedDeviceId, OwnedUserId,
|
||||||
};
|
};
|
||||||
use serde_json::Value as JsonValue;
|
use serde_json::Value as JsonValue;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/keys/query",
|
|
||||||
stable_path: "/_matrix/client/v3/keys/query",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/keys/query",
|
||||||
|
1.1 => "/_matrix/client/v3/keys/query",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#[request(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
request: {
|
pub struct Request<'a> {
|
||||||
/// 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(
|
||||||
with = "ruma_common::serde::duration::opt_ms",
|
with = "ruma_common::serde::duration::opt_ms",
|
||||||
default,
|
default,
|
||||||
skip_serializing_if = "Option::is_none",
|
skip_serializing_if = "Option::is_none"
|
||||||
)]
|
)]
|
||||||
pub timeout: Option<Duration>,
|
pub timeout: Option<Duration>,
|
||||||
|
|
||||||
@ -45,7 +47,8 @@ pub mod v3 {
|
|||||||
pub device_keys: BTreeMap<OwnedUserId, Vec<OwnedDeviceId>>,
|
pub device_keys: BTreeMap<OwnedUserId, Vec<OwnedDeviceId>>,
|
||||||
|
|
||||||
/// If the client is fetching keys as a result of a device update received in a sync
|
/// If the client is fetching keys as a result of a device update received in a sync
|
||||||
/// request, this should be the 'since' token of that sync request, or any later sync token.
|
/// request, this should be the 'since' token of that sync request, or any later sync
|
||||||
|
/// token.
|
||||||
///
|
///
|
||||||
/// This allows the server to ensure its response contains the keys advertised by the
|
/// This allows the server to ensure its response contains the keys advertised by the
|
||||||
/// notification in that sync.
|
/// notification in that sync.
|
||||||
@ -53,8 +56,9 @@ pub mod v3 {
|
|||||||
pub token: Option<&'a str>,
|
pub token: Option<&'a str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {
|
pub struct 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.
|
||||||
@ -78,9 +82,6 @@ pub mod v3 {
|
|||||||
pub user_signing_keys: BTreeMap<OwnedUserId, Raw<CrossSigningKey>>,
|
pub user_signing_keys: BTreeMap<OwnedUserId, Raw<CrossSigningKey>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Request<'_> {
|
impl Request<'_> {
|
||||||
/// Creates an empty `Request`.
|
/// Creates an empty `Request`.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
@ -9,26 +9,28 @@ pub mod v3 {
|
|||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::ruma_api,
|
api::{request, response, Metadata},
|
||||||
encryption::{DeviceKeys, OneTimeKey},
|
encryption::{DeviceKeys, OneTimeKey},
|
||||||
|
metadata,
|
||||||
serde::Raw,
|
serde::Raw,
|
||||||
DeviceKeyAlgorithm, OwnedDeviceKeyId,
|
DeviceKeyAlgorithm, OwnedDeviceKeyId,
|
||||||
};
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/keys/upload",
|
|
||||||
stable_path: "/_matrix/client/v3/keys/upload",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/keys/upload",
|
||||||
|
1.1 => "/_matrix/client/v3/keys/upload",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#[request(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
request: {
|
pub struct Request {
|
||||||
/// Identity keys for the device.
|
/// Identity keys for the device.
|
||||||
///
|
///
|
||||||
/// May be absent if no new identity keys are required.
|
/// May be absent if no new identity keys are required.
|
||||||
@ -44,15 +46,13 @@ pub mod v3 {
|
|||||||
pub fallback_keys: BTreeMap<OwnedDeviceKeyId, Raw<OneTimeKey>>,
|
pub fallback_keys: BTreeMap<OwnedDeviceKeyId, Raw<OneTimeKey>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct 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<DeviceKeyAlgorithm, UInt>,
|
pub one_time_key_counts: BTreeMap<DeviceKeyAlgorithm, UInt>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Request {
|
impl Request {
|
||||||
/// Creates an empty `Request`.
|
/// Creates an empty `Request`.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
@ -8,8 +8,9 @@ pub mod v3 {
|
|||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::ruma_api,
|
api::{request, response, Metadata},
|
||||||
encryption::{CrossSigningKey, DeviceKeys},
|
encryption::{CrossSigningKey, DeviceKeys},
|
||||||
|
metadata,
|
||||||
serde::{Raw, StringEnum},
|
serde::{Raw, StringEnum},
|
||||||
OwnedDeviceId, OwnedUserId,
|
OwnedDeviceId, OwnedUserId,
|
||||||
};
|
};
|
||||||
@ -20,33 +21,32 @@ pub mod v3 {
|
|||||||
|
|
||||||
pub use super::iter::SignedKeysIter;
|
pub use super::iter::SignedKeysIter;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Publishes cross-signing signatures for the user.",
|
description: "Publishes cross-signing signatures for the user.",
|
||||||
method: POST,
|
method: POST,
|
||||||
name: "upload_signatures",
|
name: "upload_signatures",
|
||||||
unstable_path: "/_matrix/client/unstable/keys/signatures/upload",
|
|
||||||
stable_path: "/_matrix/client/v3/keys/signatures/upload",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.1,
|
history: {
|
||||||
|
unstable => "/_matrix/client/unstable/keys/signatures/upload",
|
||||||
|
1.1 => "/_matrix/client/v3/keys/signatures/upload",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request {
|
||||||
/// Signed keys.
|
/// Signed keys.
|
||||||
#[ruma_api(body)]
|
#[ruma_api(body)]
|
||||||
pub signed_keys: BTreeMap<OwnedUserId, SignedKeys>,
|
pub signed_keys: BTreeMap<OwnedUserId, SignedKeys>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {
|
pub struct Response {
|
||||||
/// Signature processing failures.
|
/// Signature processing failures.
|
||||||
pub failures: BTreeMap<OwnedUserId, BTreeMap<String, Failure>>,
|
pub failures: BTreeMap<OwnedUserId, BTreeMap<String, Failure>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Request {
|
impl Request {
|
||||||
/// Creates a new `Request` with the given signed keys.
|
/// Creates a new `Request` with the given signed keys.
|
||||||
pub fn new(signed_keys: BTreeMap<OwnedUserId, SignedKeys>) -> Self {
|
pub fn new(signed_keys: BTreeMap<OwnedUserId, SignedKeys>) -> Self {
|
||||||
|
@ -5,24 +5,30 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3keysdevice_signingupload
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3keysdevice_signingupload
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, encryption::CrossSigningKey, serde::Raw};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
encryption::CrossSigningKey,
|
||||||
|
metadata,
|
||||||
|
serde::Raw,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::uiaa::{AuthData, IncomingAuthData, UiaaResponse};
|
use crate::uiaa::{AuthData, IncomingAuthData, UiaaResponse};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Publishes cross signing keys for the user.",
|
description: "Publishes cross signing keys for the user.",
|
||||||
method: POST,
|
method: POST,
|
||||||
name: "upload_signing_keys",
|
name: "upload_signing_keys",
|
||||||
unstable_path: "/_matrix/client/unstable/keys/device_signing/upload",
|
|
||||||
stable_path: "/_matrix/client/v3/keys/device_signing/upload",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.1,
|
history: {
|
||||||
|
unstable => "/_matrix/client/unstable/keys/device_signing/upload",
|
||||||
|
1.1 => "/_matrix/client/v3/keys/device_signing/upload",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#[request(error = UiaaResponse)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
request: {
|
pub struct Request<'a> {
|
||||||
/// 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<'a>>,
|
pub auth: Option<AuthData<'a>>,
|
||||||
@ -46,11 +52,9 @@ pub mod v3 {
|
|||||||
pub user_signing_key: Option<Raw<CrossSigningKey>>,
|
pub user_signing_key: Option<Raw<CrossSigningKey>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = UiaaResponse)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: UiaaResponse
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Request<'_> {
|
impl Request<'_> {
|
||||||
/// Creates an empty `Request`.
|
/// Creates an empty `Request`.
|
||||||
|
@ -5,21 +5,25 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3knockroomidoralias
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3knockroomidoralias
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, OwnedRoomId, OwnedServerName, RoomOrAliasId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, OwnedRoomId, OwnedServerName, RoomOrAliasId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Knock on a room.",
|
description: "Knock on a room.",
|
||||||
method: POST,
|
method: POST,
|
||||||
name: "knock_room",
|
name: "knock_room",
|
||||||
unstable_path: "/_matrix/client/unstable/xyz.amorgan.knock/knock/:room_id_or_alias",
|
|
||||||
stable_path: "/_matrix/client/v3/knock/:room_id_or_alias",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.1,
|
history: {
|
||||||
|
unstable => "/_matrix/client/unstable/xyz.amorgan.knock/knock/:room_id_or_alias",
|
||||||
|
1.1 => "/_matrix/client/v3/knock/:room_id_or_alias",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The room the user should knock on.
|
/// The room the user should knock on.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub room_id_or_alias: &'a RoomOrAliasId,
|
pub room_id_or_alias: &'a RoomOrAliasId,
|
||||||
@ -36,11 +40,11 @@ pub mod v3 {
|
|||||||
pub server_name: &'a [OwnedServerName],
|
pub server_name: &'a [OwnedServerName],
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// The room that the user knocked on.
|
/// The room that the user knocked on.
|
||||||
pub room_id: OwnedRoomId,
|
pub room_id: OwnedRoomId,
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room ID or alias.
|
/// Creates a new `Request` with the given room ID or alias.
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#![cfg(any(feature = "client", feature = "server"))]
|
#![cfg(any(feature = "client", feature = "server"))]
|
||||||
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
|
||||||
#![warn(missing_docs)]
|
// #![warn(missing_docs)] FIXME
|
||||||
|
|
||||||
pub mod account;
|
pub mod account;
|
||||||
pub mod alias;
|
pub mod alias;
|
||||||
|
@ -6,21 +6,25 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixmediav3upload
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixmediav3upload
|
||||||
|
|
||||||
use http::header::CONTENT_TYPE;
|
use http::header::CONTENT_TYPE;
|
||||||
use ruma_common::{api::ruma_api, OwnedMxcUri};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, OwnedMxcUri,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/media/r0/upload",
|
|
||||||
stable_path: "/_matrix/media/v3/upload",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/media/r0/upload",
|
||||||
|
1.1 => "/_matrix/media/v3/upload",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The file contents to upload.
|
/// The file contents to upload.
|
||||||
#[ruma_api(raw_body)]
|
#[ruma_api(raw_body)]
|
||||||
pub file: &'a [u8],
|
pub file: &'a [u8],
|
||||||
@ -43,12 +47,13 @@ pub mod v3 {
|
|||||||
#[serde(
|
#[serde(
|
||||||
default,
|
default,
|
||||||
skip_serializing_if = "ruma_common::serde::is_default",
|
skip_serializing_if = "ruma_common::serde::is_default",
|
||||||
rename = "xyz.amorgan.generate_blurhash",
|
rename = "xyz.amorgan.generate_blurhash"
|
||||||
)]
|
)]
|
||||||
pub generate_blurhash: bool,
|
pub generate_blurhash: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// The MXC URI for the uploaded content.
|
/// The MXC URI for the uploaded content.
|
||||||
pub content_uri: OwnedMxcUri,
|
pub content_uri: OwnedMxcUri,
|
||||||
|
|
||||||
@ -65,9 +70,6 @@ pub mod v3 {
|
|||||||
pub blurhash: Option<String>,
|
pub blurhash: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given file contents.
|
/// Creates a new `Request` with the given file contents.
|
||||||
pub fn new(file: &'a [u8]) -> Self {
|
pub fn new(file: &'a [u8]) -> Self {
|
||||||
|
@ -6,19 +6,24 @@ pub mod unstable {
|
|||||||
//! [spec]: https://github.com/tulir/matrix-doc/blob/asynchronous_uploads/proposals/2246-asynchronous-uploads.md
|
//! [spec]: https://github.com/tulir/matrix-doc/blob/asynchronous_uploads/proposals/2246-asynchronous-uploads.md
|
||||||
|
|
||||||
use http::header::CONTENT_TYPE;
|
use http::header::CONTENT_TYPE;
|
||||||
use ruma_common::{api::ruma_api, IdParseError, MxcUri, ServerName};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, IdParseError, MxcUri, ServerName,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Upload media to an MXC URI that was created with create_mxc_uri.",
|
description: "Upload media to an MXC URI that was created with create_mxc_uri.",
|
||||||
method: PUT,
|
method: PUT,
|
||||||
name: "create_content_async",
|
name: "create_content_async",
|
||||||
unstable_path: "/_matrix/media/unstable/fi.mau.msc2246/upload/:server_name/:media_id",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
|
history: {
|
||||||
|
unstable => "/_matrix/media/unstable/fi.mau.msc2246/upload/:server_name/:media_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The server name from the mxc:// URI (the authoritory component).
|
/// The server name from the mxc:// URI (the authoritory component).
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub server_name: &'a ServerName,
|
pub server_name: &'a ServerName,
|
||||||
@ -34,14 +39,11 @@ pub mod unstable {
|
|||||||
/// The content type of the file being uploaded.
|
/// The content type of the file being uploaded.
|
||||||
#[ruma_api(header = CONTENT_TYPE)]
|
#[ruma_api(header = CONTENT_TYPE)]
|
||||||
pub content_type: Option<&'a str>,
|
pub content_type: Option<&'a str>,
|
||||||
|
|
||||||
// TODO: How does this and msc2448 (blurhash) interact?
|
// TODO: How does this and msc2448 (blurhash) interact?
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {}
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {}
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given file contents.
|
/// Creates a new `Request` with the given file contents.
|
||||||
|
@ -6,21 +6,28 @@ pub mod unstable {
|
|||||||
//! [spec]: https://github.com/tulir/matrix-doc/blob/asynchronous_uploads/proposals/2246-asynchronous-uploads.md
|
//! [spec]: https://github.com/tulir/matrix-doc/blob/asynchronous_uploads/proposals/2246-asynchronous-uploads.md
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{api::ruma_api, OwnedMxcUri};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, OwnedMxcUri,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Create an MXC URI without content.",
|
description: "Create an MXC URI without content.",
|
||||||
method: POST,
|
method: POST,
|
||||||
name: "create_mxc_uri",
|
name: "create_mxc_uri",
|
||||||
unstable_path: "/_matrix/media/unstable/fi.mau.msc2246/create",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
|
history: {
|
||||||
|
unstable => "/_matrix/media/unstable/fi.mau.msc2246/create",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {}
|
#[request(error = crate::Error)]
|
||||||
|
#[derive(Default)]
|
||||||
|
pub struct Request {}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// The MXC URI for the about to be uploaded content.
|
/// The MXC URI for the about to be uploaded content.
|
||||||
pub content_uri: OwnedMxcUri,
|
pub content_uri: OwnedMxcUri,
|
||||||
|
|
||||||
@ -28,9 +35,6 @@ pub mod unstable {
|
|||||||
pub unused_expires_at: UInt,
|
pub unused_expires_at: UInt,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Response {
|
impl Response {
|
||||||
/// Creates a new `Response` with the given MXC URI which expires at a given point in time.
|
/// Creates a new `Response` with the given MXC URI which expires at a given point in time.
|
||||||
pub fn new(content_uri: OwnedMxcUri, unused_expires_at: UInt) -> Self {
|
pub fn new(content_uri: OwnedMxcUri, unused_expires_at: UInt) -> Self {
|
||||||
|
@ -8,23 +8,27 @@ pub mod v3 {
|
|||||||
use http::header::{CONTENT_DISPOSITION, CONTENT_TYPE};
|
use http::header::{CONTENT_DISPOSITION, CONTENT_TYPE};
|
||||||
#[cfg(feature = "unstable-msc2246")]
|
#[cfg(feature = "unstable-msc2246")]
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{api::ruma_api, IdParseError, MxcUri, ServerName};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, IdParseError, MxcUri, ServerName,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::http_headers::CROSS_ORIGIN_RESOURCE_POLICY;
|
use crate::http_headers::CROSS_ORIGIN_RESOURCE_POLICY;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/media/r0/download/:server_name/:media_id",
|
|
||||||
stable_path: "/_matrix/media/v3/download/:server_name/:media_id",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/media/r0/download/:server_name/:media_id",
|
||||||
|
1.1 => "/_matrix/media/v3/download/:server_name/:media_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The server name from the mxc:// URI (the authoritory component).
|
/// The server name from the mxc:// URI (the authoritory component).
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub server_name: &'a ServerName,
|
pub server_name: &'a ServerName,
|
||||||
@ -37,10 +41,12 @@ pub mod v3 {
|
|||||||
///
|
///
|
||||||
/// Used to prevent routing loops. Defaults to `true`.
|
/// Used to prevent routing loops. Defaults to `true`.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
#[serde(default = "ruma_common::serde::default_true", skip_serializing_if = "ruma_common::serde::is_true")]
|
#[serde(
|
||||||
|
default = "ruma_common::serde::default_true",
|
||||||
|
skip_serializing_if = "ruma_common::serde::is_true"
|
||||||
|
)]
|
||||||
pub allow_remote: bool,
|
pub allow_remote: bool,
|
||||||
|
|
||||||
|
|
||||||
/// How long to wait for the media to be uploaded
|
/// How long to wait for the media to be uploaded
|
||||||
///
|
///
|
||||||
/// This uses the unstable prefix in
|
/// This uses the unstable prefix in
|
||||||
@ -50,12 +56,13 @@ pub mod v3 {
|
|||||||
#[serde(
|
#[serde(
|
||||||
default,
|
default,
|
||||||
skip_serializing_if = "ruma_common::serde::is_default",
|
skip_serializing_if = "ruma_common::serde::is_default",
|
||||||
rename = "fi.mau.msc2246.max_stall_ms",
|
rename = "fi.mau.msc2246.max_stall_ms"
|
||||||
)]
|
)]
|
||||||
pub max_stall_ms: Option<UInt>,
|
pub max_stall_ms: Option<UInt>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct 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>,
|
||||||
@ -82,9 +89,6 @@ pub mod v3 {
|
|||||||
pub cross_origin_resource_policy: Option<String>,
|
pub cross_origin_resource_policy: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given media ID and server name.
|
/// Creates a new `Request` with the given media ID and server name.
|
||||||
pub fn new(media_id: &'a str, server_name: &'a ServerName) -> Self {
|
pub fn new(media_id: &'a str, server_name: &'a ServerName) -> Self {
|
||||||
|
@ -6,23 +6,27 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixmediav3downloadservernamemediaidfilename
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixmediav3downloadservernamemediaidfilename
|
||||||
|
|
||||||
use http::header::{CONTENT_DISPOSITION, CONTENT_TYPE};
|
use http::header::{CONTENT_DISPOSITION, CONTENT_TYPE};
|
||||||
use ruma_common::{api::ruma_api, IdParseError, MxcUri, ServerName};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, IdParseError, MxcUri, ServerName,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::http_headers::CROSS_ORIGIN_RESOURCE_POLICY;
|
use crate::http_headers::CROSS_ORIGIN_RESOURCE_POLICY;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/media/r0/download/:server_name/:media_id/:filename",
|
|
||||||
stable_path: "/_matrix/media/v3/download/:server_name/:media_id/:filename",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/media/r0/download/:server_name/:media_id/:filename",
|
||||||
|
1.1 => "/_matrix/media/v3/download/:server_name/:media_id/:filename",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The server name from the mxc:// URI (the authoritory component).
|
/// The server name from the mxc:// URI (the authoritory component).
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub server_name: &'a ServerName,
|
pub server_name: &'a ServerName,
|
||||||
@ -39,11 +43,15 @@ pub mod v3 {
|
|||||||
///
|
///
|
||||||
/// Used to prevent routing loops. Defaults to `true`.
|
/// Used to prevent routing loops. Defaults to `true`.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
#[serde(default = "ruma_common::serde::default_true", skip_serializing_if = "ruma_common::serde::is_true")]
|
#[serde(
|
||||||
|
default = "ruma_common::serde::default_true",
|
||||||
|
skip_serializing_if = "ruma_common::serde::is_true"
|
||||||
|
)]
|
||||||
pub allow_remote: bool,
|
pub allow_remote: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct 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>,
|
||||||
@ -70,9 +78,6 @@ pub mod v3 {
|
|||||||
pub cross_origin_resource_policy: Option<String>,
|
pub cross_origin_resource_policy: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given media ID, server name and filename.
|
/// Creates a new `Request` with the given media ID, server name and filename.
|
||||||
pub fn new(media_id: &'a str, server_name: &'a ServerName, filename: &'a str) -> Self {
|
pub fn new(media_id: &'a str, server_name: &'a ServerName, filename: &'a str) -> Self {
|
||||||
|
@ -7,23 +7,29 @@ pub mod v3 {
|
|||||||
|
|
||||||
use http::header::CONTENT_TYPE;
|
use http::header::CONTENT_TYPE;
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::{api::ruma_api, serde::StringEnum, IdParseError, MxcUri, ServerName};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
serde::StringEnum,
|
||||||
|
IdParseError, MxcUri, ServerName,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::{http_headers::CROSS_ORIGIN_RESOURCE_POLICY, PrivOwnedStr};
|
use crate::{http_headers::CROSS_ORIGIN_RESOURCE_POLICY, PrivOwnedStr};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/media/r0/thumbnail/:server_name/:media_id",
|
|
||||||
stable_path: "/_matrix/media/v3/thumbnail/:server_name/:media_id",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/media/r0/thumbnail/:server_name/:media_id",
|
||||||
|
1.1 => "/_matrix/media/v3/thumbnail/:server_name/:media_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The server name from the mxc:// URI (the authoritory component).
|
/// The server name from the mxc:// URI (the authoritory component).
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub server_name: &'a ServerName,
|
pub server_name: &'a ServerName,
|
||||||
@ -53,7 +59,10 @@ pub mod v3 {
|
|||||||
///
|
///
|
||||||
/// Used to prevent routing loops. Defaults to `true`.
|
/// Used to prevent routing loops. Defaults to `true`.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
#[serde(default = "ruma_common::serde::default_true", skip_serializing_if = "ruma_common::serde::is_true")]
|
#[serde(
|
||||||
|
default = "ruma_common::serde::default_true",
|
||||||
|
skip_serializing_if = "ruma_common::serde::is_true"
|
||||||
|
)]
|
||||||
pub allow_remote: bool,
|
pub allow_remote: bool,
|
||||||
|
|
||||||
/// How long to wait for the media to be uploaded
|
/// How long to wait for the media to be uploaded
|
||||||
@ -65,12 +74,13 @@ pub mod v3 {
|
|||||||
#[serde(
|
#[serde(
|
||||||
default,
|
default,
|
||||||
skip_serializing_if = "ruma_common::serde::is_default",
|
skip_serializing_if = "ruma_common::serde::is_default",
|
||||||
rename = "fi.mau.msc2246.max_stall_ms",
|
rename = "fi.mau.msc2246.max_stall_ms"
|
||||||
)]
|
)]
|
||||||
pub max_stall_ms: Option<UInt>,
|
pub max_stall_ms: Option<UInt>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// A thumbnail of the requested content.
|
/// A thumbnail of the requested content.
|
||||||
#[ruma_api(raw_body)]
|
#[ruma_api(raw_body)]
|
||||||
pub file: Vec<u8>,
|
pub file: Vec<u8>,
|
||||||
@ -88,9 +98,6 @@ pub mod v3 {
|
|||||||
pub cross_origin_resource_policy: Option<String>,
|
pub cross_origin_resource_policy: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given media ID, server name, desired thumbnail width
|
/// Creates a new `Request` with the given media ID, server name, desired thumbnail width
|
||||||
/// and desired thumbnail height.
|
/// and desired thumbnail height.
|
||||||
|
@ -6,32 +6,34 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixmediav3config
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixmediav3config
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::UInt;
|
||||||
use ruma_common::api::ruma_api;
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Gets the config for the media repository.",
|
description: "Gets the config for the media repository.",
|
||||||
method: GET,
|
method: GET,
|
||||||
r0_path: "/_matrix/media/r0/config",
|
|
||||||
stable_path: "/_matrix/media/v3/config",
|
|
||||||
name: "get_media_config",
|
name: "get_media_config",
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/media/r0/config",
|
||||||
|
1.1 => "/_matrix/media/v3/config",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#[request(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
request: {}
|
pub struct Request {}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct 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,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Request {
|
impl Request {
|
||||||
/// Creates an empty `Request`.
|
/// Creates an empty `Request`.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
@ -5,23 +5,27 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixmediav3preview_url
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixmediav3preview_url
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, MilliSecondsSinceUnixEpoch};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, MilliSecondsSinceUnixEpoch,
|
||||||
|
};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use serde_json::value::{to_raw_value as to_raw_json_value, RawValue as RawJsonValue};
|
use serde_json::value::{to_raw_value as to_raw_json_value, RawValue as RawJsonValue};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Get a preview for a URL.",
|
description: "Get a preview for a URL.",
|
||||||
name: "get_media_preview",
|
|
||||||
method: GET,
|
method: GET,
|
||||||
r0_path: "/_matrix/media/r0/preview_url",
|
name: "get_media_preview",
|
||||||
stable_path: "/_matrix/media/v3/preview_url",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/media/r0/preview_url",
|
||||||
|
1.1 => "/_matrix/media/v3/preview_url",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// URL to get a preview of.
|
/// URL to get a preview of.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub url: &'a str,
|
pub url: &'a str,
|
||||||
@ -31,8 +35,9 @@ pub mod v3 {
|
|||||||
pub ts: MilliSecondsSinceUnixEpoch,
|
pub ts: MilliSecondsSinceUnixEpoch,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {
|
pub struct 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`
|
||||||
@ -41,9 +46,6 @@ pub mod v3 {
|
|||||||
pub data: Option<Box<RawJsonValue>>,
|
pub data: Option<Box<RawJsonValue>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given url and timestamp.
|
/// Creates a new `Request` with the given url and timestamp.
|
||||||
pub fn new(url: &'a str, ts: MilliSecondsSinceUnixEpoch) -> Self {
|
pub fn new(url: &'a str, ts: MilliSecondsSinceUnixEpoch) -> Self {
|
||||||
|
@ -5,21 +5,25 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3roomsroomidban
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3roomsroomidban
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, RoomId, UserId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, RoomId, UserId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/rooms/:room_id/ban",
|
|
||||||
stable_path: "/_matrix/client/v3/rooms/:room_id/ban",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/rooms/:room_id/ban",
|
||||||
|
1.1 => "/_matrix/client/v3/rooms/:room_id/ban",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The room to kick the user from.
|
/// The room to kick the user from.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub room_id: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
@ -32,11 +36,9 @@ pub mod v3 {
|
|||||||
pub reason: Option<&'a str>,
|
pub reason: Option<&'a str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room id and room id.
|
/// Creates a new `Request` with the given room id and room id.
|
||||||
|
@ -5,31 +5,33 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3roomsroomidforget
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3roomsroomidforget
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, RoomId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, RoomId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Forget a room.",
|
description: "Forget a room.",
|
||||||
method: POST,
|
method: POST,
|
||||||
name: "forget_room",
|
name: "forget_room",
|
||||||
r0_path: "/_matrix/client/r0/rooms/:room_id/forget",
|
|
||||||
stable_path: "/_matrix/client/v3/rooms/:room_id/forget",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/rooms/:room_id/forget",
|
||||||
|
1.1 => "/_matrix/client/v3/rooms/:room_id/forget",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The room to forget.
|
/// The room to forget.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub room_id: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room id.
|
/// Creates a new `Request` with the given room id.
|
||||||
|
@ -6,27 +6,29 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3roomsroomidmembers
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3roomsroomidmembers
|
||||||
|
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::ruma_api,
|
api::{request, response, Metadata},
|
||||||
events::room::member::RoomMemberEvent,
|
events::room::member::RoomMemberEvent,
|
||||||
|
metadata,
|
||||||
serde::{Raw, StringEnum},
|
serde::{Raw, StringEnum},
|
||||||
RoomId,
|
RoomId,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::PrivOwnedStr;
|
use crate::PrivOwnedStr;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/rooms/:room_id/members",
|
|
||||||
stable_path: "/_matrix/client/v3/rooms/:room_id/members",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/rooms/:room_id/members",
|
||||||
|
1.1 => "/_matrix/client/v3/rooms/:room_id/members",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
@ -42,8 +44,8 @@ pub mod v3 {
|
|||||||
/// The kind of memberships to filter for.
|
/// The kind of memberships to filter for.
|
||||||
///
|
///
|
||||||
/// Defaults to no filtering if unspecified. When specified alongside not_membership, the
|
/// Defaults to no filtering if unspecified. When specified alongside not_membership, the
|
||||||
/// two parameters create an 'or' condition: either the membership is the same as membership
|
/// two parameters create an 'or' condition: either the membership is the same as
|
||||||
/// or is not the same as not_membership.
|
/// membership or is not the same as not_membership.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub membership: Option<MembershipEventFilter>,
|
pub membership: Option<MembershipEventFilter>,
|
||||||
@ -56,14 +58,12 @@ pub mod v3 {
|
|||||||
pub not_membership: Option<MembershipEventFilter>,
|
pub not_membership: Option<MembershipEventFilter>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// A list of member events.
|
/// A list of member events.
|
||||||
pub chunk: Vec<Raw<RoomMemberEvent>>,
|
pub chunk: Vec<Raw<RoomMemberEvent>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room ID.
|
/// Creates a new `Request` with the given room ID.
|
||||||
pub fn new(room_id: &'a RoomId) -> Self {
|
pub fn new(room_id: &'a RoomId) -> Self {
|
||||||
|
@ -10,24 +10,30 @@ pub mod v3 {
|
|||||||
//! [spec-mxid]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3roomsroomidinvite
|
//! [spec-mxid]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3roomsroomidinvite
|
||||||
//! [spec-3pid]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3roomsroomidinvite-1
|
//! [spec-3pid]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3roomsroomidinvite-1
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, serde::Incoming, RoomId, UserId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
serde::Incoming,
|
||||||
|
RoomId, UserId,
|
||||||
|
};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::membership::{IncomingInvite3pid, Invite3pid};
|
use crate::membership::{IncomingInvite3pid, Invite3pid};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/rooms/:room_id/invite",
|
|
||||||
stable_path: "/_matrix/client/v3/rooms/:room_id/invite",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/rooms/:room_id/invite",
|
||||||
|
1.1 => "/_matrix/client/v3/rooms/:room_id/invite",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
@ -41,11 +47,9 @@ pub mod v3 {
|
|||||||
pub reason: Option<&'a str>,
|
pub reason: Option<&'a str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room ID and invitation recipient.
|
/// Creates a new `Request` with the given room ID and invitation recipient.
|
||||||
|
@ -5,23 +5,27 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3roomsroomidjoin
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3roomsroomidjoin
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, OwnedRoomId, RoomId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, OwnedRoomId, RoomId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::membership::{IncomingThirdPartySigned, ThirdPartySigned};
|
use crate::membership::{IncomingThirdPartySigned, ThirdPartySigned};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/rooms/:room_id/join",
|
|
||||||
stable_path: "/_matrix/client/v3/rooms/:room_id/join",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/rooms/:room_id/join",
|
||||||
|
1.1 => "/_matrix/client/v3/rooms/:room_id/join",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
@ -36,14 +40,12 @@ pub mod v3 {
|
|||||||
pub reason: Option<&'a str>,
|
pub reason: Option<&'a str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// The room that the user joined.
|
/// The room that the user joined.
|
||||||
pub room_id: OwnedRoomId,
|
pub room_id: OwnedRoomId,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room id.
|
/// Creates a new `Request` with the given room id.
|
||||||
pub fn new(room_id: &'a RoomId) -> Self {
|
pub fn new(room_id: &'a RoomId) -> Self {
|
||||||
|
@ -5,23 +5,27 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3joinroomidoralias
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3joinroomidoralias
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, OwnedRoomId, OwnedServerName, RoomOrAliasId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, OwnedRoomId, OwnedServerName, RoomOrAliasId,
|
||||||
|
};
|
||||||
|
|
||||||
use crate::membership::{IncomingThirdPartySigned, ThirdPartySigned};
|
use crate::membership::{IncomingThirdPartySigned, ThirdPartySigned};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/join/:room_id_or_alias",
|
|
||||||
stable_path: "/_matrix/client/v3/join/:room_id_or_alias",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/join/:room_id_or_alias",
|
||||||
|
1.1 => "/_matrix/client/v3/join/:room_id_or_alias",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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: &'a RoomOrAliasId,
|
pub room_id_or_alias: &'a RoomOrAliasId,
|
||||||
@ -43,14 +47,12 @@ pub mod v3 {
|
|||||||
pub reason: Option<&'a str>,
|
pub reason: Option<&'a str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// The room that the user joined.
|
/// The room that the user joined.
|
||||||
pub room_id: OwnedRoomId,
|
pub room_id: OwnedRoomId,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room ID or alias ID.
|
/// Creates a new `Request` with the given room ID or alias ID.
|
||||||
pub fn new(room_id_or_alias: &'a RoomOrAliasId) -> Self {
|
pub fn new(room_id_or_alias: &'a RoomOrAliasId) -> Self {
|
||||||
|
@ -7,36 +7,38 @@ pub mod v3 {
|
|||||||
|
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, OwnedMxcUri, OwnedUserId, RoomId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, OwnedMxcUri, OwnedUserId, RoomId,
|
||||||
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/rooms/:room_id/joined_members",
|
|
||||||
stable_path: "/_matrix/client/v3/rooms/:room_id/joined_members",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/rooms/:room_id/joined_members",
|
||||||
|
1.1 => "/_matrix/client/v3/rooms/:room_id/joined_members",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The room to get the members of.
|
/// The room to get the members of.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub room_id: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct 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<OwnedUserId, RoomMember>,
|
pub joined: BTreeMap<OwnedUserId, RoomMember>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room ID.
|
/// Creates a new `Request` with the given room ID.
|
||||||
pub fn new(room_id: &'a RoomId) -> Self {
|
pub fn new(room_id: &'a RoomId) -> Self {
|
||||||
|
@ -5,32 +5,34 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3joined_rooms
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3joined_rooms
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, OwnedRoomId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, OwnedRoomId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/joined_rooms",
|
|
||||||
stable_path: "/_matrix/client/v3/joined_rooms",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/joined_rooms",
|
||||||
|
1.1 => "/_matrix/client/v3/joined_rooms",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#[request(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
request: {}
|
pub struct Request {}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct 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<OwnedRoomId>,
|
pub joined_rooms: Vec<OwnedRoomId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Request {
|
impl Request {
|
||||||
/// Creates an empty `Request`.
|
/// Creates an empty `Request`.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
@ -5,21 +5,25 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3roomsroomidkick
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3roomsroomidkick
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, RoomId, UserId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, RoomId, UserId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/rooms/:room_id/kick",
|
|
||||||
stable_path: "/_matrix/client/v3/rooms/:room_id/kick",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/rooms/:room_id/kick",
|
||||||
|
1.1 => "/_matrix/client/v3/rooms/:room_id/kick",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The room to kick the user from.
|
/// The room to kick the user from.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub room_id: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
@ -32,11 +36,9 @@ pub mod v3 {
|
|||||||
pub reason: Option<&'a str>,
|
pub reason: Option<&'a str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room id and room id.
|
/// Creates a new `Request` with the given room id and room id.
|
||||||
|
@ -5,21 +5,25 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3roomsroomidleave
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3roomsroomidleave
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, RoomId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, RoomId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Leave a room.",
|
description: "Leave a room.",
|
||||||
method: POST,
|
method: POST,
|
||||||
name: "leave_room",
|
name: "leave_room",
|
||||||
r0_path: "/_matrix/client/r0/rooms/:room_id/leave",
|
|
||||||
stable_path: "/_matrix/client/v3/rooms/:room_id/leave",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/rooms/:room_id/leave",
|
||||||
|
1.1 => "/_matrix/client/v3/rooms/:room_id/leave",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The room to leave.
|
/// The room to leave.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub room_id: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
@ -29,11 +33,9 @@ pub mod v3 {
|
|||||||
pub reason: Option<&'a str>,
|
pub reason: Option<&'a str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room id.
|
/// Creates a new `Request` with the given room id.
|
||||||
|
@ -5,32 +5,35 @@ pub mod unstable {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://github.com/matrix-org/matrix-spec-proposals/blob/hs/shared-rooms/proposals/2666-get-rooms-in-common.md
|
//! [spec]: https://github.com/matrix-org/matrix-spec-proposals/blob/hs/shared-rooms/proposals/2666-get-rooms-in-common.md
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, OwnedRoomId, UserId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, OwnedRoomId, UserId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = metadata! {
|
||||||
metadata: {
|
|
||||||
description: "Get mutual rooms with another user.",
|
description: "Get mutual rooms with another user.",
|
||||||
method: GET,
|
method: GET,
|
||||||
name: "mutual_rooms",
|
name: "mutual_rooms",
|
||||||
unstable_path: "/_matrix/client/unstable/uk.half-shot.msc2666/user/mutual_rooms/:user_id",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
|
history: {
|
||||||
|
unstable => "/_matrix/client/unstable/uk.half-shot.msc2666/user/mutual_rooms/:user_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The user to search mutual rooms for.
|
/// The user to search mutual rooms for.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub user_id: &'a UserId,
|
pub user_id: &'a UserId,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// A list of rooms the user is in together with the authenticated user.
|
/// A list of rooms the user is in together with the authenticated user.
|
||||||
pub joined: Vec<OwnedRoomId>,
|
pub joined: Vec<OwnedRoomId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given user id.
|
/// Creates a new `Request` with the given user id.
|
||||||
pub fn new(user_id: &'a UserId) -> Self {
|
pub fn new(user_id: &'a UserId) -> Self {
|
||||||
|
@ -5,21 +5,25 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3roomsroomidunban
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#post_matrixclientv3roomsroomidunban
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, RoomId, UserId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, RoomId, UserId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/rooms/:room_id/unban",
|
|
||||||
stable_path: "/_matrix/client/v3/rooms/:room_id/unban",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/rooms/:room_id/unban",
|
||||||
|
1.1 => "/_matrix/client/v3/rooms/:room_id/unban",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The room to unban the user from.
|
/// The room to unban the user from.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub room_id: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
@ -32,11 +36,9 @@ pub mod v3 {
|
|||||||
pub reason: Option<&'a str>,
|
pub reason: Option<&'a str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room id and room id.
|
/// Creates a new `Request` with the given room id and room id.
|
||||||
|
@ -7,8 +7,9 @@ pub mod v3 {
|
|||||||
|
|
||||||
use js_int::{uint, UInt};
|
use js_int::{uint, UInt};
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::ruma_api,
|
api::{request, response, Metadata},
|
||||||
events::{AnyStateEvent, AnyTimelineEvent},
|
events::{AnyStateEvent, AnyTimelineEvent},
|
||||||
|
metadata,
|
||||||
serde::Raw,
|
serde::Raw,
|
||||||
RoomId,
|
RoomId,
|
||||||
};
|
};
|
||||||
@ -18,19 +19,20 @@ pub mod v3 {
|
|||||||
Direction,
|
Direction,
|
||||||
};
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/rooms/:room_id/messages",
|
|
||||||
stable_path: "/_matrix/client/v3/rooms/:room_id/messages",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/rooms/:room_id/messages",
|
||||||
|
1.1 => "/_matrix/client/v3/rooms/:room_id/messages",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The room to get events from.
|
/// The room to get events from.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub room_id: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
@ -76,8 +78,9 @@ pub mod v3 {
|
|||||||
pub filter: RoomEventFilter<'a>,
|
pub filter: RoomEventFilter<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {
|
pub struct Response {
|
||||||
/// The token the pagination starts from.
|
/// The token the pagination starts from.
|
||||||
pub start: String,
|
pub start: String,
|
||||||
|
|
||||||
@ -94,9 +97,6 @@ pub mod v3 {
|
|||||||
pub state: Vec<Raw<AnyStateEvent>>,
|
pub state: Vec<Raw<AnyStateEvent>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room ID and direction.
|
/// Creates a new `Request` with the given room ID and direction.
|
||||||
///
|
///
|
||||||
|
@ -6,26 +6,28 @@ pub mod v3 {
|
|||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3roomsroomidsendeventtypetxnid
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3roomsroomidsendeventtypetxnid
|
||||||
|
|
||||||
use ruma_common::{
|
use ruma_common::{
|
||||||
api::ruma_api,
|
api::{request, response, Metadata},
|
||||||
events::{AnyMessageLikeEventContent, MessageLikeEventContent, MessageLikeEventType},
|
events::{AnyMessageLikeEventContent, MessageLikeEventContent, MessageLikeEventType},
|
||||||
|
metadata,
|
||||||
serde::Raw,
|
serde::Raw,
|
||||||
MilliSecondsSinceUnixEpoch, OwnedEventId, RoomId, TransactionId,
|
MilliSecondsSinceUnixEpoch, OwnedEventId, RoomId, TransactionId,
|
||||||
};
|
};
|
||||||
use serde_json::value::to_raw_value as to_raw_json_value;
|
use serde_json::value::to_raw_value as to_raw_json_value;
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/rooms/:room_id/send/:event_type/:txn_id",
|
|
||||||
stable_path: "/_matrix/client/v3/rooms/:room_id/send/:event_type/:txn_id",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/rooms/:room_id/send/:event_type/:txn_id",
|
||||||
|
1.1 => "/_matrix/client/v3/rooms/:room_id/send/:event_type/:txn_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The room to send the event to.
|
/// The room to send the event to.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub room_id: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
@ -62,14 +64,12 @@ pub mod v3 {
|
|||||||
pub timestamp: Option<MilliSecondsSinceUnixEpoch>,
|
pub timestamp: Option<MilliSecondsSinceUnixEpoch>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct Response {
|
||||||
/// A unique identifier for the event.
|
/// A unique identifier for the event.
|
||||||
pub event_id: OwnedEventId,
|
pub event_id: OwnedEventId,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given room id, transaction id and event content.
|
/// Creates a new `Request` with the given room id, transaction id and event content.
|
||||||
///
|
///
|
||||||
|
@ -7,27 +7,34 @@ pub mod v3 {
|
|||||||
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, presence::PresenceState, UserId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
presence::PresenceState,
|
||||||
|
UserId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/presence/:user_id/status",
|
|
||||||
stable_path: "/_matrix/client/v3/presence/:user_id/status",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/presence/:user_id/status",
|
||||||
|
1.1 => "/_matrix/client/v3/presence/:user_id/status",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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: &'a UserId,
|
pub user_id: &'a UserId,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
#[response(error = crate::Error)]
|
||||||
|
pub struct 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>,
|
||||||
@ -40,7 +47,7 @@ pub mod v3 {
|
|||||||
#[serde(
|
#[serde(
|
||||||
with = "ruma_common::serde::duration::opt_ms",
|
with = "ruma_common::serde::duration::opt_ms",
|
||||||
default,
|
default,
|
||||||
skip_serializing_if = "Option::is_none",
|
skip_serializing_if = "Option::is_none"
|
||||||
)]
|
)]
|
||||||
pub last_active_ago: Option<Duration>,
|
pub last_active_ago: Option<Duration>,
|
||||||
|
|
||||||
@ -48,9 +55,6 @@ pub mod v3 {
|
|||||||
pub presence: PresenceState,
|
pub presence: PresenceState,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given user ID.
|
/// Creates a new `Request` with the given user ID.
|
||||||
pub fn new(user_id: &'a UserId) -> Self {
|
pub fn new(user_id: &'a UserId) -> Self {
|
||||||
|
@ -5,21 +5,27 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3presenceuseridstatus
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3presenceuseridstatus
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, presence::PresenceState, UserId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata,
|
||||||
|
presence::PresenceState,
|
||||||
|
UserId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/presence/:user_id/status",
|
|
||||||
stable_path: "/_matrix/client/v3/presence/:user_id/status",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/presence/:user_id/status",
|
||||||
|
1.1 => "/_matrix/client/v3/presence/:user_id/status",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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: &'a UserId,
|
pub user_id: &'a UserId,
|
||||||
@ -32,11 +38,9 @@ pub mod v3 {
|
|||||||
pub status_msg: Option<&'a str>,
|
pub status_msg: Option<&'a str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given user ID and presence state.
|
/// Creates a new `Request` with the given user ID and presence state.
|
||||||
|
@ -5,32 +5,37 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3profileuseridavatar_url
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3profileuseridavatar_url
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, OwnedMxcUri, UserId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, OwnedMxcUri, UserId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/profile/:user_id/avatar_url",
|
|
||||||
stable_path: "/_matrix/client/v3/profile/:user_id/avatar_url",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/profile/:user_id/avatar_url",
|
||||||
|
1.1 => "/_matrix/client/v3/profile/:user_id/avatar_url",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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: &'a UserId,
|
pub user_id: &'a UserId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {
|
pub struct Response {
|
||||||
/// The user's avatar URL, if set.
|
/// The user's avatar URL, if set.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will result
|
/// If you activate the `compat` feature, this field being an empty string in JSON will
|
||||||
/// in `None` here during deserialization.
|
/// result in `None` here during deserialization.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "compat",
|
feature = "compat",
|
||||||
@ -47,9 +52,6 @@ pub mod v3 {
|
|||||||
pub blurhash: Option<String>,
|
pub blurhash: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given user ID.
|
/// Creates a new `Request` with the given user ID.
|
||||||
pub fn new(user_id: &'a UserId) -> Self {
|
pub fn new(user_id: &'a UserId) -> Self {
|
||||||
|
@ -5,36 +5,38 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3profileuseriddisplayname
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3profileuseriddisplayname
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, UserId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, UserId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/profile/:user_id/displayname",
|
|
||||||
stable_path: "/_matrix/client/v3/profile/:user_id/displayname",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/profile/:user_id/displayname",
|
||||||
|
1.1 => "/_matrix/client/v3/profile/:user_id/displayname",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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: &'a UserId,
|
pub user_id: &'a UserId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {
|
pub struct 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>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given user ID.
|
/// Creates a new `Request` with the given user ID.
|
||||||
pub fn new(user_id: &'a UserId) -> Self {
|
pub fn new(user_id: &'a UserId) -> Self {
|
||||||
|
@ -5,32 +5,37 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3profileuserid
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#get_matrixclientv3profileuserid
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, OwnedMxcUri, UserId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, OwnedMxcUri, UserId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/profile/:user_id",
|
|
||||||
stable_path: "/_matrix/client/v3/profile/:user_id",
|
|
||||||
rate_limited: false,
|
rate_limited: false,
|
||||||
authentication: None,
|
authentication: None,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/profile/:user_id",
|
||||||
|
1.1 => "/_matrix/client/v3/profile/:user_id",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// The user whose profile will be retrieved.
|
/// The user whose profile will be retrieved.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub user_id: &'a UserId,
|
pub user_id: &'a UserId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {
|
pub struct Response {
|
||||||
/// The user's avatar URL, if set.
|
/// The user's avatar URL, if set.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will result
|
/// If you activate the `compat` feature, this field being an empty string in JSON will
|
||||||
/// in `None` here during deserialization.
|
/// result in `None` here during deserialization.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "compat",
|
feature = "compat",
|
||||||
@ -51,9 +56,6 @@ pub mod v3 {
|
|||||||
pub blurhash: Option<String>,
|
pub blurhash: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given user ID.
|
/// Creates a new `Request` with the given user ID.
|
||||||
pub fn new(user_id: &'a UserId) -> Self {
|
pub fn new(user_id: &'a UserId) -> Self {
|
||||||
|
@ -5,21 +5,25 @@ pub mod v3 {
|
|||||||
//!
|
//!
|
||||||
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3profileuseridavatar_url
|
//! [spec]: https://spec.matrix.org/v1.4/client-server-api/#put_matrixclientv3profileuseridavatar_url
|
||||||
|
|
||||||
use ruma_common::{api::ruma_api, MxcUri, UserId};
|
use ruma_common::{
|
||||||
|
api::{request, response, Metadata},
|
||||||
|
metadata, MxcUri, UserId,
|
||||||
|
};
|
||||||
|
|
||||||
ruma_api! {
|
const METADATA: Metadata = 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",
|
||||||
r0_path: "/_matrix/client/r0/profile/:user_id/avatar_url",
|
|
||||||
stable_path: "/_matrix/client/v3/profile/:user_id/avatar_url",
|
|
||||||
rate_limited: true,
|
rate_limited: true,
|
||||||
authentication: AccessToken,
|
authentication: AccessToken,
|
||||||
added: 1.0,
|
history: {
|
||||||
|
1.0 => "/_matrix/client/r0/profile/:user_id/avatar_url",
|
||||||
|
1.1 => "/_matrix/client/v3/profile/:user_id/avatar_url",
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
request: {
|
#[request(error = crate::Error)]
|
||||||
|
pub struct Request<'a> {
|
||||||
/// 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: &'a UserId,
|
pub user_id: &'a UserId,
|
||||||
@ -28,8 +32,8 @@ pub mod v3 {
|
|||||||
///
|
///
|
||||||
/// `None` is used to unset the avatar.
|
/// `None` is used to unset the avatar.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will result
|
/// If you activate the `compat` feature, this field being an empty string in JSON will
|
||||||
/// in `None` here during deserialization.
|
/// result in `None` here during deserialization.
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "compat",
|
feature = "compat",
|
||||||
serde(
|
serde(
|
||||||
@ -38,10 +42,7 @@ pub mod v3 {
|
|||||||
serialize_with = "ruma_common::serde::none_as_empty_string"
|
serialize_with = "ruma_common::serde::none_as_empty_string"
|
||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(not(feature = "compat"), serde(skip_serializing_if = "Option::is_none"))]
|
||||||
not(feature = "compat"),
|
|
||||||
serde(skip_serializing_if = "Option::is_none")
|
|
||||||
)]
|
|
||||||
pub avatar_url: Option<&'a MxcUri>,
|
pub avatar_url: Option<&'a MxcUri>,
|
||||||
|
|
||||||
/// The [BlurHash](https://blurha.sh) for the avatar pointed to by `avatar_url`.
|
/// The [BlurHash](https://blurha.sh) for the avatar pointed to by `avatar_url`.
|
||||||
@ -53,11 +54,9 @@ pub mod v3 {
|
|||||||
pub blurhash: Option<&'a str>,
|
pub blurhash: Option<&'a str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[response(error = crate::Error)]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {}
|
pub struct Response {}
|
||||||
|
|
||||||
error: crate::Error
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> Request<'a> {
|
impl<'a> Request<'a> {
|
||||||
/// Creates a new `Request` with the given user ID and avatar URL.
|
/// Creates a new `Request` with the given user ID and avatar URL.
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user