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,77 +37,82 @@ 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", |         rate_limited: false, | ||||||
|             stable_path: "/_matrix/app/v1/transactions/:txn_id", |         authentication: AccessToken, | ||||||
|             rate_limited: false, |         history: { | ||||||
|             authentication: AccessToken, |             1.0 => "/_matrix/app/v1/transactions/:txn_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request] | ||||||
|             /// The transaction ID for this set of events.
 |     pub struct Request<'a> { | ||||||
|             ///
 |         /// The transaction ID for this set of events.
 | ||||||
|             /// Homeservers generate these IDs and they are used to ensure idempotency of results.
 |         ///
 | ||||||
|             #[ruma_api(path)] |         /// Homeservers generate these IDs and they are used to ensure idempotency of results.
 | ||||||
|             pub txn_id: &'a TransactionId, |         #[ruma_api(path)] | ||||||
|  |         pub txn_id: &'a TransactionId, | ||||||
| 
 | 
 | ||||||
|             /// A list of events.
 |         /// A list of events.
 | ||||||
|             pub events: &'a [Raw<AnyTimelineEvent>], |         pub events: &'a [Raw<AnyTimelineEvent>], | ||||||
| 
 | 
 | ||||||
|             /// Information on E2E device updates.
 |         /// Information on E2E device updates.
 | ||||||
|             #[cfg(feature = "unstable-msc3202")] |         #[cfg(feature = "unstable-msc3202")] | ||||||
|             #[serde(
 |         #[serde(
 | ||||||
|                 default, |             default, | ||||||
|                 skip_serializing_if = "DeviceLists::is_empty", |             skip_serializing_if = "DeviceLists::is_empty", | ||||||
|                 rename = "org.matrix.msc3202.device_lists" |             rename = "org.matrix.msc3202.device_lists" | ||||||
|             )] |         )] | ||||||
|             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
 | ||||||
|             #[cfg(feature = "unstable-msc3202")] |         /// each algorithm.
 | ||||||
|             #[serde(
 |         #[cfg(feature = "unstable-msc3202")] | ||||||
|                 default, |         #[serde(
 | ||||||
|                 skip_serializing_if = "BTreeMap::is_empty", |             default, | ||||||
|                 rename = "org.matrix.msc3202.device_one_time_keys_count" |             skip_serializing_if = "BTreeMap::is_empty", | ||||||
|             )] |             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
 | ||||||
|             #[cfg(feature = "unstable-msc3202")] |         /// device.
 | ||||||
|             #[serde(
 |         #[cfg(feature = "unstable-msc3202")] | ||||||
|                 default, |         #[serde(
 | ||||||
|                 skip_serializing_if = "BTreeMap::is_empty", |             default, | ||||||
|                 rename = "org.matrix.msc3202.device_unused_fallback_key_types" |             skip_serializing_if = "BTreeMap::is_empty", | ||||||
|             )] |             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")] | ||||||
|             #[serde(
 |         #[serde(
 | ||||||
|                 default, |             default, | ||||||
|                 skip_serializing_if = "<[_]>::is_empty", |             skip_serializing_if = "<[_]>::is_empty", | ||||||
|                 rename = "de.sorunome.msc2409.ephemeral" |             rename = "de.sorunome.msc2409.ephemeral" | ||||||
|             )] |         )] | ||||||
|             pub ephemeral: &'a [Edu], |         pub ephemeral: &'a [Edu], | ||||||
| 
 | 
 | ||||||
|             /// A list of to-device messages.
 |         /// A list of to-device messages.
 | ||||||
|             #[cfg(feature = "unstable-msc2409")] |         #[cfg(feature = "unstable-msc2409")] | ||||||
|             #[serde(
 |         #[serde(
 | ||||||
|                 default, |             default, | ||||||
|                 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>], | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     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.
 | ||||||
|         pub fn new(txn_id: &'a TransactionId, events: &'a [Raw<AnyTimelineEvent>]) -> Self { |         pub fn new(txn_id: &'a TransactionId, events: &'a [Raw<AnyTimelineEvent>]) -> Self { | ||||||
|  | |||||||
| @ -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,29 +7,33 @@ 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", |         rate_limited: false, | ||||||
|             stable_path: "/_matrix/app/v1/rooms/:room_alias", |         authentication: AccessToken, | ||||||
|             rate_limited: false, |         history: { | ||||||
|             authentication: AccessToken, |             1.0 => "/_matrix/app/v1/rooms/:room_alias", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request] | ||||||
|             /// The room alias being queried.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The room alias being queried.
 | ||||||
|             pub room_alias: &'a RoomAliasId, |         #[ruma_api(path)] | ||||||
|         } |         pub room_alias: &'a RoomAliasId, | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     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.
 | ||||||
|         pub fn new(room_alias: &'a RoomAliasId) -> Self { |         pub fn new(room_alias: &'a RoomAliasId) -> Self { | ||||||
|  | |||||||
| @ -7,29 +7,33 @@ 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", |         rate_limited: false, | ||||||
|             stable_path: "/_matrix/app/v1/users/:user_id", |         authentication: AccessToken, | ||||||
|             rate_limited: false, |         history: { | ||||||
|             authentication: AccessToken, |             1.0 => "/_matrix/app/v1/users/:user_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request] | ||||||
|             /// The user ID being queried.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The user ID being queried.
 | ||||||
|             pub user_id: &'a UserId, |         #[ruma_api(path)] | ||||||
|         } |         pub user_id: &'a UserId, | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     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.
 | ||||||
|         pub fn new(user_id: &'a UserId) -> Self { |         pub fn new(user_id: &'a UserId) -> Self { | ||||||
|  | |||||||
| @ -10,35 +10,40 @@ 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", |         rate_limited: false, | ||||||
|             stable_path: "/_matrix/app/v1/thirdparty/location/:protocol", |         authentication: AccessToken, | ||||||
|             rate_limited: false, |         history: { | ||||||
|             authentication: AccessToken, |             1.0 => "/_matrix/app/v1/thirdparty/location/:protocol", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request] | ||||||
|             /// The protocol used to communicate to the third party network.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The protocol used to communicate to the third party network.
 | ||||||
|             pub protocol: &'a str, |         #[ruma_api(path)] | ||||||
|  |         pub protocol: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// One or more custom fields to help identify the third party location.
 |         /// One or more custom fields to help identify the third party location.
 | ||||||
|             // The specification is incorrect for this parameter. See [matrix-spec#560](https://github.com/matrix-org/matrix-spec/issues/560).
 |         // The specification is incorrect for this parameter. See [matrix-spec#560](https://github.com/matrix-org/matrix-spec/issues/560).
 | ||||||
|             #[ruma_api(query_map)] |         #[ruma_api(query_map)] | ||||||
|             pub fields: BTreeMap<String, String>, |         pub fields: BTreeMap<String, String>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response] | ||||||
|             /// List of matched third party locations.
 |     pub struct Response { | ||||||
|             #[ruma_api(body)] |         /// List of matched third party locations.
 | ||||||
|             pub locations: Vec<Location>, |         #[ruma_api(body)] | ||||||
|         } |         pub locations: Vec<Location>, | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -7,30 +7,36 @@ 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", |         rate_limited: false, | ||||||
|             stable_path: "/_matrix/app/v1/thirdparty/location", |         authentication: AccessToken, | ||||||
|             rate_limited: false, |         history: { | ||||||
|             authentication: AccessToken, |             1.0 => "/_matrix/app/v1/thirdparty/location", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request] | ||||||
|             /// The Matrix room alias to look up.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(query)] |         /// The Matrix room alias to look up.
 | ||||||
|             pub alias: &'a RoomAliasId, |         #[ruma_api(query)] | ||||||
|         } |         pub alias: &'a RoomAliasId, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response] | ||||||
|             /// List of matched third party locations.
 |     pub struct Response { | ||||||
|             #[ruma_api(body)] |         /// List of matched third party locations.
 | ||||||
|             pub locations: Vec<Location>, |         #[ruma_api(body)] | ||||||
|         } |         pub locations: Vec<Location>, | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -8,30 +8,35 @@ 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", |         rate_limited: false, | ||||||
|             stable_path: "/_matrix/app/v1/thirdparty/protocol/:protocol", |         authentication: AccessToken, | ||||||
|             rate_limited: false, |         history: { | ||||||
|             authentication: AccessToken, |             1.0 => "/_matrix/app/v1/thirdparty/protocol/:protocol", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request] | ||||||
|             /// The name of the protocol.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The name of the protocol.
 | ||||||
|             pub protocol: &'a str, |         #[ruma_api(path)] | ||||||
|         } |         pub protocol: &'a str, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response] | ||||||
|             /// Metadata about the protocol.
 |     pub struct Response { | ||||||
|             #[ruma_api(body)] |         /// Metadata about the protocol.
 | ||||||
|             pub protocol: Protocol, |         #[ruma_api(body)] | ||||||
|         } |         pub protocol: Protocol, | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -10,35 +10,40 @@ 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", |         rate_limited: false, | ||||||
|             stable_path: "/_matrix/app/v1/thirdparty/user/:protocol", |         authentication: AccessToken, | ||||||
|             rate_limited: false, |         history: { | ||||||
|             authentication: AccessToken, |             1.0 => "/_matrix/app/v1/thirdparty/user/:protocol", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request] | ||||||
|             /// The protocol used to communicate to the third party network.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The protocol used to communicate to the third party network.
 | ||||||
|             pub protocol: &'a str, |         #[ruma_api(path)] | ||||||
|  |         pub protocol: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// One or more custom fields that are passed to the AS to help identify the user.
 |         /// One or more custom fields that are passed to the AS to help identify the user.
 | ||||||
|             // The specification is incorrect for this parameter. See [matrix-spec#560](https://github.com/matrix-org/matrix-spec/issues/560).
 |         // The specification is incorrect for this parameter. See [matrix-spec#560](https://github.com/matrix-org/matrix-spec/issues/560).
 | ||||||
|             #[ruma_api(query_map)] |         #[ruma_api(query_map)] | ||||||
|             pub fields: BTreeMap<String, String>, |         pub fields: BTreeMap<String, String>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response] | ||||||
|             /// List of matched third party users.
 |     pub struct Response { | ||||||
|             #[ruma_api(body)] |         /// List of matched third party users.
 | ||||||
|             pub users: Vec<User>, |         #[ruma_api(body)] | ||||||
|         } |         pub users: Vec<User>, | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -7,30 +7,36 @@ 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", |         rate_limited: false, | ||||||
|             stable_path: "/_matrix/app/v1/thirdparty/user", |         authentication: AccessToken, | ||||||
|             rate_limited: false, |         history: { | ||||||
|             authentication: AccessToken, |             1.0 => "/_matrix/app/v1/thirdparty/user", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request] | ||||||
|             /// The Matrix User ID to look up.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(query)] |         /// The Matrix User ID to look up.
 | ||||||
|             pub userid: &'a UserId, |         #[ruma_api(query)] | ||||||
|         } |         pub userid: &'a UserId, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response] | ||||||
|             /// List of matched third party users.
 |     pub struct Response { | ||||||
|             #[ruma_api(body)] |         /// List of matched third party users.
 | ||||||
|             pub users: Vec<User>, |         #[ruma_api(body)] | ||||||
|         } |         pub users: Vec<User>, | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -5,40 +5,42 @@ 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", |         rate_limited: true, | ||||||
|             r0_path: "/_matrix/client/r0/account/3pid/add", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/account/3pid/add", |         history: { | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/account/3pid/add", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/account/3pid/add", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = UiaaResponse)] | ||||||
|             /// Additional information for the User-Interactive Authentication API.
 |     pub struct Request<'a> { | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         /// Additional information for the User-Interactive Authentication API.
 | ||||||
|             pub auth: Option<AuthData<'a>>, |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|  |         pub auth: Option<AuthData<'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, | ||||||
| 
 | 
 | ||||||
|             /// The session identifier given by the identity server.
 |         /// The session identifier given by the identity server.
 | ||||||
|             pub sid: &'a SessionId, |         pub sid: &'a SessionId, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: UiaaResponse |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = UiaaResponse)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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.
 | ||||||
|         pub fn new(client_secret: &'a ClientSecret, sid: &'a SessionId) -> Self { |         pub fn new(client_secret: &'a ClientSecret, sid: &'a SessionId) -> Self { | ||||||
|  | |||||||
| @ -5,41 +5,43 @@ 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", |         rate_limited: true, | ||||||
|             r0_path: "/_matrix/client/r0/account/3pid/bind", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/account/3pid/bind", |         history: { | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/account/3pid/bind", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/account/3pid/bind", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// Client-generated secret string used to protect this session.
 |     pub struct Request<'a> { | ||||||
|             pub client_secret: &'a ClientSecret, |         /// Client-generated secret string used to protect this session.
 | ||||||
|  |         pub client_secret: &'a ClientSecret, | ||||||
| 
 | 
 | ||||||
|             /// The ID server to send the onward request to as a hostname with an
 |         /// The ID server to send the onward request to as a hostname with an
 | ||||||
|             /// appended colon and port number if the port is not the default.
 |         /// appended colon and port number if the port is not the default.
 | ||||||
|             #[serde(flatten)] |         #[serde(flatten)] | ||||||
|             pub identity_server_info: IdentityServerInfo<'a>, |         pub identity_server_info: IdentityServerInfo<'a>, | ||||||
| 
 | 
 | ||||||
|             /// The session identifier given by the identity server.
 |         /// The session identifier given by the identity server.
 | ||||||
|             pub sid: &'a SessionId, |         pub sid: &'a SessionId, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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
 | ||||||
|         /// session identifier.
 |         /// session identifier.
 | ||||||
|  | |||||||
| @ -5,47 +5,52 @@ 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", |         rate_limited: true, | ||||||
|             r0_path: "/_matrix/client/r0/account/password", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/account/password", |         history: { | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/account/password", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/account/password", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = UiaaResponse)] | ||||||
|             /// The new password for the account.
 |     pub struct Request<'a> { | ||||||
|             pub new_password: &'a str, |         /// The new password for the account.
 | ||||||
|  |         pub new_password: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// True to revoke the user's other access tokens, and their associated devices if the
 |         /// True to revoke the user's other access tokens, and their associated devices if the
 | ||||||
|             /// request succeeds.
 |         /// request succeeds.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// 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(
 | ||||||
|             pub logout_devices: bool, |             default = "ruma_common::serde::default_true", | ||||||
|  |             skip_serializing_if = "ruma_common::serde::is_true" | ||||||
|  |         )] | ||||||
|  |         pub logout_devices: bool, | ||||||
| 
 | 
 | ||||||
|             /// 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>>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: UiaaResponse |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = UiaaResponse)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|         /// Creates a new `Request` with the given password.
 |         /// Creates a new `Request` with the given password.
 | ||||||
|         pub fn new(new_password: &'a str) -> Self { |         pub fn new(new_password: &'a str) -> Self { | ||||||
|  | |||||||
| @ -5,32 +5,34 @@ 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", |         rate_limited: true, | ||||||
|             unstable_path: "/_matrix/client/unstable/org.matrix.msc3231/register/org.matrix.msc3231.login.registration_token/validity", |         authentication: None, | ||||||
|             stable_path: "/_matrix/client/v1/register/m.login.registration_token/validity", |         history: { | ||||||
|             rate_limited: true, |             unstable => "/_matrix/client/unstable/org.matrix.msc3231/register/org.matrix.msc3231.login.registration_token/validity", | ||||||
|             authentication: None, |             1.2 => "/_matrix/client/v1/register/m.login.registration_token/validity", | ||||||
|             added: 1.2, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The registration token to check the validity of.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(query)] |         /// The registration token to check the validity of.
 | ||||||
|             pub registration_token: &'a str, |         #[ruma_api(query)] | ||||||
|         } |         pub registration_token: &'a str, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// A flag to indicate that the registration token is valid.
 |     pub struct Response { | ||||||
|             pub valid: bool, |         /// A flag to indicate that the registration token is valid.
 | ||||||
|         } |         pub valid: bool, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -5,43 +5,45 @@ 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", |         rate_limited: true, | ||||||
|             r0_path: "/_matrix/client/r0/account/deactivate", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/account/deactivate", |         history: { | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/account/deactivate", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/account/deactivate", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[request(error = UiaaResponse)] | ||||||
|         request: { |     #[derive(Default)] | ||||||
|             /// Additional authentication information for the user-interactive authentication API.
 |     pub struct Request<'a> { | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         /// Additional authentication information for the user-interactive authentication API.
 | ||||||
|             pub auth: Option<AuthData<'a>>, |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|  |         pub auth: Option<AuthData<'a>>, | ||||||
| 
 | 
 | ||||||
|             /// Identity server from which to unbind the user's third party
 |         /// Identity server from which to unbind the user's third party
 | ||||||
|             /// identifier.
 |         /// identifier.
 | ||||||
|             #[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>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = UiaaResponse)] | ||||||
|             /// Result of unbind operation.
 |     pub struct Response { | ||||||
|             pub id_server_unbind_result: ThirdPartyIdRemovalStatus, |         /// Result of unbind operation.
 | ||||||
|         } |         pub id_server_unbind_result: ThirdPartyIdRemovalStatus, | ||||||
| 
 |  | ||||||
|         error: UiaaResponse |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl Request<'_> { |     impl Request<'_> { | ||||||
|  | |||||||
| @ -5,40 +5,43 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/account/3pid/delete", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/account/3pid/delete", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/account/3pid/delete", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/account/3pid/delete", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// Identity server to delete from.
 |     pub struct Request<'a> { | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         /// Identity server to delete from.
 | ||||||
|             pub id_server: Option<&'a str>, |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|  |         pub id_server: Option<&'a str>, | ||||||
| 
 | 
 | ||||||
|             /// Medium of the 3PID to be removed.
 |         /// Medium of the 3PID to be removed.
 | ||||||
|             pub medium: Medium, |         pub medium: Medium, | ||||||
| 
 | 
 | ||||||
|             /// Third-party address being removed.
 |         /// Third-party address being removed.
 | ||||||
|             pub address: &'a str, |         pub address: &'a str, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// Result of unbind operation.
 |     pub struct Response { | ||||||
|             pub id_server_unbind_result: ThirdPartyIdRemovalStatus, |         /// Result of unbind operation.
 | ||||||
|         } |         pub id_server_unbind_result: ThirdPartyIdRemovalStatus, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/account/3pid", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/account/3pid", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/account/3pid", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/account/3pid", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[request(error = crate::Error)] | ||||||
|         request: {} |     #[derive(Default)] | ||||||
|  |     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 { | ||||||
|             #[serde(default)] |         /// A list of third party identifiers the homeserver has associated with the user's
 | ||||||
|             #[cfg_attr(not(feature = "compat"), serde(skip_serializing_if = "Vec::is_empty"))] |         /// account.
 | ||||||
|             pub threepids: Vec<ThirdPartyIdentifier>, |         #[serde(default)] | ||||||
|         } |         #[cfg_attr(not(feature = "compat"), serde(skip_serializing_if = "Vec::is_empty"))] | ||||||
| 
 |         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,33 +5,35 @@ 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", |         rate_limited: true, | ||||||
|             r0_path: "/_matrix/client/r0/register/available", |         authentication: None, | ||||||
|             stable_path: "/_matrix/client/v3/register/available", |         history: { | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/register/available", | ||||||
|             authentication: None, |             1.1 => "/_matrix/client/v3/register/available", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The username to check the availability of.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(query)] |         /// The username to check the availability of.
 | ||||||
|             pub username: &'a str, |         #[ruma_api(query)] | ||||||
|         } |         pub username: &'a str, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// A flag to indicate that the username is available.
 |     pub struct Response { | ||||||
|             /// This should always be true when the server replies with 200 OK.
 |         /// A flag to indicate that the username is available.
 | ||||||
|             pub available: bool, |         /// This should always be true when the server replies with 200 OK.
 | ||||||
|         } |         pub available: bool, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -9,138 +9,140 @@ 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", |         rate_limited: true, | ||||||
|             r0_path: "/_matrix/client/r0/register", |         authentication: None, | ||||||
|             stable_path: "/_matrix/client/v3/register", |         history: { | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/register", | ||||||
|             authentication: None, |             1.1 => "/_matrix/client/v3/register", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[request(error = UiaaResponse)] | ||||||
|         request: { |     #[derive(Default)] | ||||||
|             /// The desired password for the account.
 |     pub struct Request<'a> { | ||||||
|             ///
 |         /// The desired password for the account.
 | ||||||
|             /// May be empty for accounts that should not be able to log in again
 |         ///
 | ||||||
|             /// with a password, e.g., for guest or application service accounts.
 |         /// May be empty for accounts that should not be able to log in again
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         /// with a password, e.g., for guest or application service accounts.
 | ||||||
|             pub password: Option<&'a str>, |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|  |         pub password: Option<&'a str>, | ||||||
| 
 | 
 | ||||||
|             /// Localpart of the desired Matrix ID.
 |         /// Localpart of the desired Matrix ID.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// If omitted, the homeserver MUST generate a Matrix ID local part.
 |         /// If omitted, the homeserver MUST generate a Matrix ID local part.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub username: Option<&'a str>, |         pub username: Option<&'a str>, | ||||||
| 
 | 
 | ||||||
|             /// ID of the client device.
 |         /// ID of the client device.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// If this does not correspond to a known client device, a new device will be created.
 |         /// If this does not correspond to a known client device, a new device will be created.
 | ||||||
|             /// The server will auto-generate a device_id if this is not specified.
 |         /// The server will auto-generate a device_id if this is not specified.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub device_id: Option<&'a DeviceId>, |         pub device_id: Option<&'a DeviceId>, | ||||||
| 
 | 
 | ||||||
|             /// A display name to assign to the newly-created device.
 |         /// A display name to assign to the newly-created device.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Ignored if `device_id` corresponds to a known device.
 |         /// Ignored if `device_id` corresponds to a known device.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub initial_device_display_name: Option<&'a str>, |         pub initial_device_display_name: Option<&'a str>, | ||||||
| 
 | 
 | ||||||
|             /// Additional authentication information for the user-interactive authentication API.
 |         /// Additional authentication information for the user-interactive authentication API.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Note that this information is not used to define how the registered user should be
 |         /// Note that this information is not used to define how the registered user should be
 | ||||||
|             /// authenticated, but is instead used to authenticate the register call itself.
 |         /// authenticated, but is instead used to authenticate the register call itself.
 | ||||||
|             /// It should be left empty, or omitted, unless an earlier call returned an response
 |         /// It should be left empty, or omitted, unless an earlier call returned an response
 | ||||||
|             /// with status code 401.
 |         /// with status code 401.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub auth: Option<AuthData<'a>>, |         pub auth: Option<AuthData<'a>>, | ||||||
| 
 | 
 | ||||||
|             /// Kind of account to register
 |         /// Kind of account to register
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Defaults to `User` if omitted.
 |         /// Defaults to `User` if omitted.
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             #[serde(default, skip_serializing_if = "ruma_common::serde::is_default")] |         #[serde(default, skip_serializing_if = "ruma_common::serde::is_default")] | ||||||
|             pub kind: RegistrationKind, |         pub kind: RegistrationKind, | ||||||
| 
 | 
 | ||||||
|             /// If `true`, an `access_token` and `device_id` should not be returned
 |         /// If `true`, an `access_token` and `device_id` should not be returned
 | ||||||
|             /// from this call, therefore preventing an automatic login.
 |         /// from this call, therefore preventing an automatic login.
 | ||||||
|             #[serde(default, skip_serializing_if = "ruma_common::serde::is_default")] |         #[serde(default, skip_serializing_if = "ruma_common::serde::is_default")] | ||||||
|             pub inhibit_login: bool, |         pub inhibit_login: bool, | ||||||
| 
 | 
 | ||||||
|             /// Login `type` used by Appservices.
 |         /// Login `type` used by Appservices.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Appservices can [bypass the registration flows][admin] entirely by providing their
 |         /// Appservices can [bypass the registration flows][admin] entirely by providing their
 | ||||||
|             /// token in the header and setting this login `type` to `m.login.application_service`.
 |         /// token in the header and setting this login `type` to `m.login.application_service`.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// [admin]: https://spec.matrix.org/v1.4/application-service-api/#server-admin-style-permissions
 |         /// [admin]: https://spec.matrix.org/v1.4/application-service-api/#server-admin-style-permissions
 | ||||||
|             #[serde(rename = "type", skip_serializing_if = "Option::is_none")] |         #[serde(rename = "type", skip_serializing_if = "Option::is_none")] | ||||||
|             pub login_type: Option<&'a LoginType>, |         pub login_type: Option<&'a LoginType>, | ||||||
| 
 | 
 | ||||||
|             /// If set to `true`, the client supports [refresh tokens].
 |         /// If set to `true`, the client supports [refresh tokens].
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// [refresh tokens]: https://spec.matrix.org/v1.4/client-server-api/#refreshing-access-tokens
 |         /// [refresh tokens]: https://spec.matrix.org/v1.4/client-server-api/#refreshing-access-tokens
 | ||||||
|             #[serde(default, skip_serializing_if = "ruma_common::serde::is_default")] |         #[serde(default, skip_serializing_if = "ruma_common::serde::is_default")] | ||||||
|             pub refresh_token: bool, |         pub refresh_token: bool, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = UiaaResponse)] | ||||||
|             /// An access token for the account.
 |     pub struct Response { | ||||||
|             ///
 |         /// 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.
 | ||||||
|             /// Required if the request's `inhibit_login` was set to `false`.
 |         ///
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         /// Required if the request's `inhibit_login` was set to `false`.
 | ||||||
|             pub access_token: Option<String>, |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|  |         pub access_token: Option<String>, | ||||||
| 
 | 
 | ||||||
|             /// The fully-qualified Matrix ID that has been registered.
 |         /// The fully-qualified Matrix ID that has been registered.
 | ||||||
|             pub user_id: OwnedUserId, |         pub user_id: OwnedUserId, | ||||||
| 
 | 
 | ||||||
|             /// ID of the registered device.
 |         /// ID of the registered device.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Will be the same as the corresponding parameter in the request, if one was specified.
 |         /// Will be the same as the corresponding parameter in the request, if one was specified.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Required if the request's `inhibit_login` was set to `false`.
 |         /// Required if the request's `inhibit_login` was set to `false`.
 | ||||||
|             pub device_id: Option<OwnedDeviceId>, |         pub device_id: Option<OwnedDeviceId>, | ||||||
| 
 | 
 | ||||||
|             /// A [refresh token] for the account.
 |         /// A [refresh token] for the account.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// This token can be used to obtain a new access token when it expires by calling the
 |         /// This token can be used to obtain a new access token when it expires by calling the
 | ||||||
|             /// [`refresh_token`] endpoint.
 |         /// [`refresh_token`] endpoint.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Omitted if the request's `inhibit_login` was set to `true`.
 |         /// Omitted if the request's `inhibit_login` was set to `true`.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// [refresh token]: https://spec.matrix.org/v1.4/client-server-api/#refreshing-access-tokens
 |         /// [refresh token]: https://spec.matrix.org/v1.4/client-server-api/#refreshing-access-tokens
 | ||||||
|             /// [`refresh_token`]: crate::session::refresh_token
 |         /// [`refresh_token`]: crate::session::refresh_token
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub refresh_token: Option<String>, |         pub refresh_token: Option<String>, | ||||||
| 
 | 
 | ||||||
|             /// The lifetime of the access token, in milliseconds.
 |         /// The lifetime of the access token, in milliseconds.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Once the access token has expired, a new access token can be obtained by using the
 |         /// Once the access token has expired, a new access token can be obtained by using the
 | ||||||
|             /// provided refresh token. If no refresh token is provided, the client will need to
 |         /// provided refresh token. If no refresh token is provided, the client will need to
 | ||||||
|             /// re-login to obtain a new access token.
 |         /// re-login to obtain a new access token.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// If this is `None`, the client can assume that the access token will not expire.
 |         /// If this is `None`, the client can assume that the access token will not expire.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Omitted if the request's `inhibit_login` was set to `true`.
 |         /// Omitted if the request's `inhibit_login` was set to `true`.
 | ||||||
|             #[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", | ||||||
|                 rename = "expires_in_ms", |             rename = "expires_in_ms" | ||||||
|             )] |         )] | ||||||
|             pub expires_in: Option<Duration>, |         pub expires_in: Option<Duration>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: UiaaResponse |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl Request<'_> { |     impl Request<'_> { | ||||||
|  | |||||||
| @ -6,62 +6,64 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/account/3pid/email/requestToken", |         authentication: None, | ||||||
|             stable_path: "/_matrix/client/v3/account/3pid/email/requestToken", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/account/3pid/email/requestToken", | ||||||
|             authentication: None, |             1.1 => "/_matrix/client/v3/account/3pid/email/requestToken", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// Client-generated secret string used to protect this session.
 |     pub struct Request<'a> { | ||||||
|             pub client_secret: &'a ClientSecret, |         /// Client-generated secret string used to protect this session.
 | ||||||
|  |         pub client_secret: &'a ClientSecret, | ||||||
| 
 | 
 | ||||||
|             /// The email address.
 |         /// The email address.
 | ||||||
|             pub email: &'a str, |         pub email: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// Used to distinguish protocol level retries from requests to re-send the email.
 |         /// Used to distinguish protocol level retries from requests to re-send the email.
 | ||||||
|             pub send_attempt: UInt, |         pub send_attempt: UInt, | ||||||
| 
 | 
 | ||||||
|             /// Return URL for identity server to redirect the client back to.
 |         /// Return URL for identity server to redirect the client back to.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub next_link: Option<&'a str>, |         pub next_link: Option<&'a str>, | ||||||
| 
 | 
 | ||||||
|             /// Optional identity server hostname and access token.
 |         /// Optional identity server hostname and access token.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Deprecated since r0.6.0.
 |         /// Deprecated since r0.6.0.
 | ||||||
|             #[serde(flatten, skip_serializing_if = "Option::is_none")] |         #[serde(flatten, skip_serializing_if = "Option::is_none")] | ||||||
|             pub identity_server_info: Option<IdentityServerInfo<'a>>, |         pub identity_server_info: Option<IdentityServerInfo<'a>>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// The session identifier given by the identity server.
 |     pub struct Response { | ||||||
|             pub sid: OwnedSessionId, |         /// The session identifier given by the identity server.
 | ||||||
|  |         pub sid: OwnedSessionId, | ||||||
| 
 | 
 | ||||||
|             /// URL to submit validation token to.
 |         /// URL to submit validation token to.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// 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
 |         /// If you activate the `compat` feature, this field being an empty string in JSON will
 | ||||||
|             /// result 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", | ||||||
|                 serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none") |             serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none") | ||||||
|             )] |         )] | ||||||
|             pub submit_url: Option<String>, |         pub submit_url: Option<String>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -6,66 +6,69 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/account/3pid/msisdn/requestToken", |         authentication: None, | ||||||
|             stable_path: "/_matrix/client/v3/account/3pid/msisdn/requestToken", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/account/3pid/msisdn/requestToken", | ||||||
|             authentication: None, |             1.1 => "/_matrix/client/v3/account/3pid/msisdn/requestToken", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// Client-generated secret string used to protect this session.
 |     pub struct Request<'a> { | ||||||
|             pub client_secret: &'a ClientSecret, |         /// Client-generated secret string used to protect this session.
 | ||||||
|  |         pub client_secret: &'a ClientSecret, | ||||||
| 
 | 
 | ||||||
|             /// Two-letter ISO 3166 country code for the phone number.
 |         /// Two-letter ISO 3166 country code for the phone number.
 | ||||||
|             pub country: &'a str, |         pub country: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// Phone number to validate.
 |         /// Phone number to validate.
 | ||||||
|             pub phone_number: &'a str, |         pub phone_number: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// Used to distinguish protocol level retries from requests to re-send the SMS.
 |         /// Used to distinguish protocol level retries from requests to re-send the SMS.
 | ||||||
|             pub send_attempt: UInt, |         pub send_attempt: UInt, | ||||||
| 
 | 
 | ||||||
|             /// Return URL for identity server to redirect the client back to.
 |         /// Return URL for identity server to redirect the client back to.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub next_link: Option<&'a str>, |         pub next_link: Option<&'a str>, | ||||||
| 
 | 
 | ||||||
|             /// Optional identity server hostname and access token.
 |         /// Optional identity server hostname and access token.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Deprecated since r0.6.0.
 |         /// Deprecated since r0.6.0.
 | ||||||
|             #[serde(flatten, skip_serializing_if = "Option::is_none")] |         #[serde(flatten, skip_serializing_if = "Option::is_none")] | ||||||
|             pub identity_server_info: Option<IdentityServerInfo<'a>>, |         pub identity_server_info: Option<IdentityServerInfo<'a>>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         response: { |  | ||||||
|             /// The session identifier given by the identity server.
 |  | ||||||
|             pub sid: OwnedSessionId, |  | ||||||
| 
 |  | ||||||
|             /// URL to submit validation token to.
 |  | ||||||
|             ///
 |  | ||||||
|             /// If omitted, verification happens without client.
 |  | ||||||
|             ///
 |  | ||||||
|             /// If you activate the `compat` feature, this field being an empty string in JSON will
 |  | ||||||
|             /// result in `None` here during deserialization.
 |  | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |  | ||||||
|             #[cfg_attr(
 |  | ||||||
|                 feature = "compat", |  | ||||||
|                 serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none") |  | ||||||
|             )] |  | ||||||
|             pub submit_url: Option<String>, |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     pub struct Response { | ||||||
|  |         /// The session identifier given by the identity server.
 | ||||||
|  |         pub sid: OwnedSessionId, | ||||||
|  | 
 | ||||||
|  |         /// URL to submit validation token to.
 | ||||||
|  |         ///
 | ||||||
|  |         /// If omitted, verification happens without client.
 | ||||||
|  |         ///
 | ||||||
|  |         /// If you activate the `compat` feature, this field being an empty string in JSON will
 | ||||||
|  |         /// result in `None` here during deserialization.
 | ||||||
|  |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|  |         #[cfg_attr(
 | ||||||
|  |             feature = "compat", | ||||||
|  |             serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none") | ||||||
|  |         )] | ||||||
|  |         pub submit_url: Option<String>, | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     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,42 +7,45 @@ 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.", |         method: POST, | ||||||
|             name: "request_openid_token", |         name: "request_openid_token", | ||||||
|             method: POST, |         rate_limited: true, | ||||||
|             r0_path: "/_matrix/client/r0/user/:user_id/openid/request_token", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/user/:user_id/openid/request_token", |         history: { | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/user/:user_id/openid/request_token", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/user/:user_id/openid/request_token", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// User ID of authenticated user.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// User ID of authenticated user.
 | ||||||
|             pub user_id: &'a UserId, |         #[ruma_api(path)] | ||||||
|         } |         pub user_id: &'a UserId, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// Access token for verifying user's identity.
 |     pub struct Response { | ||||||
|             pub access_token: String, |         /// Access token for verifying user's identity.
 | ||||||
|  |         pub access_token: String, | ||||||
| 
 | 
 | ||||||
|             /// Access token type.
 |         /// Access token type.
 | ||||||
|             pub token_type: TokenType, |         pub token_type: TokenType, | ||||||
| 
 | 
 | ||||||
|             /// Homeserver domain for verification of user's identity.
 |         /// Homeserver domain for verification of user's identity.
 | ||||||
|             pub matrix_server_name: OwnedServerName, |         pub matrix_server_name: OwnedServerName, | ||||||
| 
 | 
 | ||||||
|             /// Seconds until token expiration.
 |         /// Seconds until token expiration.
 | ||||||
|             #[serde(with = "ruma_common::serde::duration::secs")] |         #[serde(with = "ruma_common::serde::duration::secs")] | ||||||
|             pub expires_in: Duration, |         pub expires_in: Duration, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -6,62 +6,64 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/account/password/email/requestToken", |         authentication: None, | ||||||
|             stable_path: "/_matrix/client/v3/account/password/email/requestToken", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/account/password/email/requestToken", | ||||||
|             authentication: None, |             1.1 => "/_matrix/client/v3/account/password/email/requestToken", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// Client-generated secret string used to protect this session.
 |     pub struct Request<'a> { | ||||||
|             pub client_secret: &'a ClientSecret, |         /// Client-generated secret string used to protect this session.
 | ||||||
|  |         pub client_secret: &'a ClientSecret, | ||||||
| 
 | 
 | ||||||
|             /// The email address.
 |         /// The email address.
 | ||||||
|             pub email: &'a str, |         pub email: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// Used to distinguish protocol level retries from requests to re-send the email.
 |         /// Used to distinguish protocol level retries from requests to re-send the email.
 | ||||||
|             pub send_attempt: UInt, |         pub send_attempt: UInt, | ||||||
| 
 | 
 | ||||||
|             /// Return URL for identity server to redirect the client back to.
 |         /// Return URL for identity server to redirect the client back to.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub next_link: Option<&'a str>, |         pub next_link: Option<&'a str>, | ||||||
| 
 | 
 | ||||||
|             /// Optional identity server hostname and access token.
 |         /// Optional identity server hostname and access token.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Deprecated since r0.6.0.
 |         /// Deprecated since r0.6.0.
 | ||||||
|             #[serde(flatten, skip_serializing_if = "Option::is_none")] |         #[serde(flatten, skip_serializing_if = "Option::is_none")] | ||||||
|             pub identity_server_info: Option<IdentityServerInfo<'a>>, |         pub identity_server_info: Option<IdentityServerInfo<'a>>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// The session identifier given by the identity server.
 |     pub struct Response { | ||||||
|             pub sid: OwnedSessionId, |         /// The session identifier given by the identity server.
 | ||||||
|  |         pub sid: OwnedSessionId, | ||||||
| 
 | 
 | ||||||
|             /// URL to submit validation token to.
 |         /// URL to submit validation token to.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// 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", | ||||||
|                 serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none") |             serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none") | ||||||
|             )] |         )] | ||||||
|             pub submit_url: Option<String>, |         pub submit_url: Option<String>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -6,57 +6,59 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/account/password/msisdn/requestToken", |         authentication: None, | ||||||
|             stable_path: "/_matrix/client/v3/account/password/msisdn/requestToken", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/account/password/msisdn/requestToken", | ||||||
|             authentication: None, |             1.1 => "/_matrix/client/v3/account/password/msisdn/requestToken", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// Client-generated secret string used to protect this session.
 |     pub struct Request<'a> { | ||||||
|             pub client_secret: &'a ClientSecret, |         /// Client-generated secret string used to protect this session.
 | ||||||
|  |         pub client_secret: &'a ClientSecret, | ||||||
| 
 | 
 | ||||||
|             /// Two-letter ISO 3166 country code for the phone number.
 |         /// Two-letter ISO 3166 country code for the phone number.
 | ||||||
|             pub country: &'a str, |         pub country: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// Phone number to validate.
 |         /// Phone number to validate.
 | ||||||
|             pub phone_number: &'a str, |         pub phone_number: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// Used to distinguish protocol level retries from requests to re-send the SMS.
 |         /// Used to distinguish protocol level retries from requests to re-send the SMS.
 | ||||||
|             pub send_attempt: UInt, |         pub send_attempt: UInt, | ||||||
| 
 | 
 | ||||||
|             /// Return URL for identity server to redirect the client back to.
 |         /// Return URL for identity server to redirect the client back to.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub next_link: Option<&'a str>, |         pub next_link: Option<&'a str>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// The session identifier given by the identity server.
 |     pub struct Response { | ||||||
|             pub sid: OwnedSessionId, |         /// The session identifier given by the identity server.
 | ||||||
|  |         pub sid: OwnedSessionId, | ||||||
| 
 | 
 | ||||||
|             /// URL to submit validation token to.
 |         /// URL to submit validation token to.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// 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", | ||||||
|                 serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none") |             serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none") | ||||||
|             )] |         )] | ||||||
|             pub submit_url: Option<String>, |         pub submit_url: Option<String>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -6,62 +6,64 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/register/email/requestToken", |         authentication: None, | ||||||
|             stable_path: "/_matrix/client/v3/register/email/requestToken", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/register/email/requestToken", | ||||||
|             authentication: None, |             1.1 => "/_matrix/client/v3/register/email/requestToken", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// Client-generated secret string used to protect this session.
 |     pub struct Request<'a> { | ||||||
|             pub client_secret: &'a ClientSecret, |         /// Client-generated secret string used to protect this session.
 | ||||||
|  |         pub client_secret: &'a ClientSecret, | ||||||
| 
 | 
 | ||||||
|             /// The email address.
 |         /// The email address.
 | ||||||
|             pub email: &'a str, |         pub email: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// Used to distinguish protocol level retries from requests to re-send the email.
 |         /// Used to distinguish protocol level retries from requests to re-send the email.
 | ||||||
|             pub send_attempt: UInt, |         pub send_attempt: UInt, | ||||||
| 
 | 
 | ||||||
|             /// Return URL for identity server to redirect the client back to.
 |         /// Return URL for identity server to redirect the client back to.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub next_link: Option<&'a str>, |         pub next_link: Option<&'a str>, | ||||||
| 
 | 
 | ||||||
|             /// Optional identity server hostname and access token.
 |         /// Optional identity server hostname and access token.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Deprecated since r0.6.0.
 |         /// Deprecated since r0.6.0.
 | ||||||
|             #[serde(flatten, skip_serializing_if = "Option::is_none")] |         #[serde(flatten, skip_serializing_if = "Option::is_none")] | ||||||
|             pub identity_server_info: Option<IdentityServerInfo<'a>>, |         pub identity_server_info: Option<IdentityServerInfo<'a>>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// The session identifier given by the identity server.
 |     pub struct Response { | ||||||
|             pub sid: OwnedSessionId, |         /// The session identifier given by the identity server.
 | ||||||
|  |         pub sid: OwnedSessionId, | ||||||
| 
 | 
 | ||||||
|             /// URL to submit validation token to.
 |         /// URL to submit validation token to.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// 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", | ||||||
|                 serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none") |             serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none") | ||||||
|             )] |         )] | ||||||
|             pub submit_url: Option<String>, |         pub submit_url: Option<String>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -6,65 +6,67 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/register/msisdn/requestToken", |         authentication: None, | ||||||
|             stable_path: "/_matrix/client/v3/register/msisdn/requestToken", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/register/msisdn/requestToken", | ||||||
|             authentication: None, |             1.1 => "/_matrix/client/v3/register/msisdn/requestToken", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// Client-generated secret string used to protect this session.
 |     pub struct Request<'a> { | ||||||
|             pub client_secret: &'a ClientSecret, |         /// Client-generated secret string used to protect this session.
 | ||||||
|  |         pub client_secret: &'a ClientSecret, | ||||||
| 
 | 
 | ||||||
|             /// Two-letter ISO 3166 country code for the phone number.
 |         /// Two-letter ISO 3166 country code for the phone number.
 | ||||||
|             pub country: &'a str, |         pub country: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// Phone number to validate.
 |         /// Phone number to validate.
 | ||||||
|             pub phone_number: &'a str, |         pub phone_number: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// Used to distinguish protocol level retries from requests to re-send the SMS.
 |         /// Used to distinguish protocol level retries from requests to re-send the SMS.
 | ||||||
|             pub send_attempt: UInt, |         pub send_attempt: UInt, | ||||||
| 
 | 
 | ||||||
|             /// Return URL for identity server to redirect the client back to.
 |         /// Return URL for identity server to redirect the client back to.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub next_link: Option<&'a str>, |         pub next_link: Option<&'a str>, | ||||||
| 
 | 
 | ||||||
|             /// Optional identity server hostname and access token.
 |         /// Optional identity server hostname and access token.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Deprecated since r0.6.0.
 |         /// Deprecated since r0.6.0.
 | ||||||
|             #[serde(flatten, skip_serializing_if = "Option::is_none")] |         #[serde(flatten, skip_serializing_if = "Option::is_none")] | ||||||
|             pub identity_server_info: Option<IdentityServerInfo<'a>>, |         pub identity_server_info: Option<IdentityServerInfo<'a>>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// The session identifier given by the identity server.
 |     pub struct Response { | ||||||
|             pub sid: OwnedSessionId, |         /// The session identifier given by the identity server.
 | ||||||
|  |         pub sid: OwnedSessionId, | ||||||
| 
 | 
 | ||||||
|             /// URL to submit validation token to.
 |         /// URL to submit validation token to.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// 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", | ||||||
|                 serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none") |             serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none") | ||||||
|             )] |         )] | ||||||
|             pub submit_url: Option<String>, |         pub submit_url: Option<String>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -5,40 +5,43 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/account/3pid/unbind", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/account/3pid/unbind", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/account/3pid/unbind", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/account/3pid/unbind", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// Identity server to unbind from.
 |     pub struct Request<'a> { | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         /// Identity server to unbind from.
 | ||||||
|             pub id_server: Option<&'a str>, |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|  |         pub id_server: Option<&'a str>, | ||||||
| 
 | 
 | ||||||
|             /// Medium of the 3PID to be removed.
 |         /// Medium of the 3PID to be removed.
 | ||||||
|             pub medium: Medium, |         pub medium: Medium, | ||||||
| 
 | 
 | ||||||
|             /// Third-party address being removed.
 |         /// Third-party address being removed.
 | ||||||
|             pub address: &'a str, |         pub address: &'a str, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// Result of unbind operation.
 |     pub struct Response { | ||||||
|             pub id_server_unbind_result: ThirdPartyIdRemovalStatus, |         /// Result of unbind operation.
 | ||||||
|         } |         pub id_server_unbind_result: ThirdPartyIdRemovalStatus, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -5,37 +5,39 @@ 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", |         rate_limited: true, | ||||||
|             r0_path: "/_matrix/client/r0/account/whoami", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/account/whoami", |         history: { | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/account/whoami", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/account/whoami", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[request(error = crate::Error)] | ||||||
|         request: {} |     #[derive(Default)] | ||||||
|  |     pub struct Request {} | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// The id of the user that owns the access token.
 |     pub struct Response { | ||||||
|             pub user_id: OwnedUserId, |         /// The id of the user that owns the access token.
 | ||||||
|  |         pub user_id: OwnedUserId, | ||||||
| 
 | 
 | ||||||
|             /// The device ID associated with the access token, if any.
 |         /// The device ID associated with the access token, if any.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub device_id: Option<OwnedDeviceId>, |         pub device_id: Option<OwnedDeviceId>, | ||||||
| 
 | 
 | ||||||
|             /// If `true`, the user is a guest user.
 |         /// If `true`, the user is a guest user.
 | ||||||
|             #[serde(default, skip_serializing_if = "ruma_common::serde::is_default")] |         #[serde(default, skip_serializing_if = "ruma_common::serde::is_default")] | ||||||
|             pub is_guest: bool, |         pub is_guest: bool, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl Request { |     impl Request { | ||||||
|  | |||||||
| @ -5,35 +5,37 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/directory/room/:room_alias", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/directory/room/:room_alias", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/directory/room/:room_alias", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/directory/room/:room_alias", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The room alias to set.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The room alias to set.
 | ||||||
|             pub room_alias: &'a RoomAliasId, |         #[ruma_api(path)] | ||||||
|  |         pub room_alias: &'a RoomAliasId, | ||||||
| 
 | 
 | ||||||
|             /// The room ID to set.
 |         /// The room ID to set.
 | ||||||
|             pub room_id: &'a RoomId, |         pub room_id: &'a RoomId, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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.
 | ||||||
|         pub fn new(room_alias: &'a RoomAliasId, room_id: &'a RoomId) -> Self { |         pub fn new(room_alias: &'a RoomAliasId, room_id: &'a RoomId) -> Self { | ||||||
|  | |||||||
| @ -5,32 +5,34 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/directory/room/:room_alias", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/directory/room/:room_alias", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/directory/room/:room_alias", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/directory/room/:room_alias", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The room alias to remove.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The room alias to remove.
 | ||||||
|             pub room_alias: &'a RoomAliasId, |         #[ruma_api(path)] | ||||||
|         } |         pub room_alias: &'a RoomAliasId, | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     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.
 | ||||||
|         pub fn new(room_alias: &'a RoomAliasId) -> Self { |         pub fn new(room_alias: &'a RoomAliasId) -> Self { | ||||||
|  | |||||||
| @ -5,35 +5,37 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/directory/room/:room_alias", |         authentication: None, | ||||||
|             stable_path: "/_matrix/client/v3/directory/room/:room_alias", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/directory/room/:room_alias", | ||||||
|             authentication: None, |             1.1 => "/_matrix/client/v3/directory/room/:room_alias", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The room alias.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The room alias.
 | ||||||
|             pub room_alias: &'a RoomAliasId, |         #[ruma_api(path)] | ||||||
|         } |         pub room_alias: &'a RoomAliasId, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// The room ID for this room alias.
 |     pub struct Response { | ||||||
|             pub room_id: OwnedRoomId, |         /// The room ID for this room alias.
 | ||||||
|  |         pub room_id: OwnedRoomId, | ||||||
| 
 | 
 | ||||||
|             /// A list of servers that are aware of this room ID.
 |         /// A list of servers that are aware of this room ID.
 | ||||||
|             pub servers: Vec<OwnedServerName>, |         pub servers: Vec<OwnedServerName>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -5,41 +5,43 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/directory/list/appservice/:network_id/:room_id", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/directory/list/appservice/:network_id/:room_id", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/directory/list/appservice/:network_id/:room_id", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/directory/list/appservice/:network_id/:room_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The protocol (network) ID to update the room list for.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The protocol (network) ID to update the room list for.
 | ||||||
|             pub network_id: &'a str, |         #[ruma_api(path)] | ||||||
|  |         pub network_id: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// The room ID to add to the directory.
 |         /// The room ID to add to the directory.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub room_id: &'a RoomId, |         pub room_id: &'a RoomId, | ||||||
| 
 | 
 | ||||||
|             /// Whether the room should be visible (public) in the directory or not (private).
 |         /// Whether the room should be visible (public) in the directory or not (private).
 | ||||||
|             pub visibility: Visibility, |         pub visibility: Visibility, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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.
 | ||||||
|         pub fn new(network_id: &'a str, room_id: &'a RoomId, visibility: Visibility) -> Self { |         pub fn new(network_id: &'a str, room_id: &'a RoomId, visibility: Visibility) -> Self { | ||||||
|  | |||||||
| @ -8,45 +8,47 @@ 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", |         rate_limited: true, | ||||||
|             unstable_path: "/_matrix/client/unstable/room_keys/keys", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/room_keys/keys", |         history: { | ||||||
|             rate_limited: true, |             unstable => "/_matrix/client/unstable/room_keys/keys", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/room_keys/keys", | ||||||
|             added: 1.1, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The backup version to add keys to.
 |     pub struct Request<'a> { | ||||||
|             ///
 |         /// The backup version to add keys to.
 | ||||||
|             /// Must be the current backup.
 |         ///
 | ||||||
|             #[ruma_api(query)] |         /// Must be the current backup.
 | ||||||
|             pub version: &'a str, |         #[ruma_api(query)] | ||||||
|  |         pub version: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// A map of room IDs to session IDs to key data to store.
 |         /// A map of room IDs to session IDs to key data to store.
 | ||||||
|             pub rooms: BTreeMap<OwnedRoomId, RoomKeyBackup>, |         pub rooms: BTreeMap<OwnedRoomId, RoomKeyBackup>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// An opaque string representing stored keys in the backup.
 |     pub struct Response { | ||||||
|             ///
 |         /// 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
 |         ///
 | ||||||
|             /// key storage request.
 |         /// Clients can compare it with  the etag value they received in the request of their last
 | ||||||
|             pub etag: String, |         /// key storage request.
 | ||||||
|  |         pub etag: String, | ||||||
| 
 | 
 | ||||||
|             /// The number of keys stored in the backup.
 |         /// The number of keys stored in the backup.
 | ||||||
|             pub count: UInt, |         pub count: UInt, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -8,50 +8,54 @@ 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", |         rate_limited: true, | ||||||
|             unstable_path: "/_matrix/client/unstable/room_keys/keys/:room_id", |         authentication: AccessToken, | ||||||
|             r0_path: "/_matrix/client/r0/room_keys/keys/:room_id", |         history: { | ||||||
|             stable_path: "/_matrix/client/v3/room_keys/keys/:room_id", |             unstable => "/_matrix/client/unstable/room_keys/keys/:room_id", | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/room_keys/keys/:room_id", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/room_keys/keys/:room_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The backup version to add keys to.
 |     pub struct Request<'a> { | ||||||
|             ///
 |         /// The backup version to add keys to.
 | ||||||
|             /// Must be the current backup.
 |         ///
 | ||||||
|             #[ruma_api(query)] |         /// Must be the current backup.
 | ||||||
|             pub version: &'a str, |         #[ruma_api(query)] | ||||||
|  |         pub version: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// The ID of the room to add keys to.
 |         /// The ID of the room to add keys to.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub room_id: &'a RoomId, |         pub room_id: &'a RoomId, | ||||||
| 
 | 
 | ||||||
|             /// A map of session IDs to key data to store.
 |         /// A map of session IDs to key data to store.
 | ||||||
|             pub sessions: BTreeMap<String, Raw<KeyBackupData>>, |         pub sessions: BTreeMap<String, Raw<KeyBackupData>>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// An opaque string representing stored keys in the backup.
 |     pub struct Response { | ||||||
|             ///
 |         /// 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
 |         ///
 | ||||||
|             /// key storage request.
 |         /// Clients can compare it with the etag value they received in the request of their last
 | ||||||
|             pub etag: String, |         /// key storage request.
 | ||||||
|  |         pub etag: String, | ||||||
| 
 | 
 | ||||||
|             /// The number of keys stored in the backup.
 |         /// The number of keys stored in the backup.
 | ||||||
|             pub count: UInt, |         pub count: UInt, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -6,55 +6,59 @@ 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", |         rate_limited: true, | ||||||
|             unstable_path: "/_matrix/client/unstable/room_keys/keys/:room_id/:session_id", |         authentication: AccessToken, | ||||||
|             r0_path: "/_matrix/client/r0/room_keys/keys/:room_id/:session_id", |         history: { | ||||||
|             stable_path: "/_matrix/client/v3/room_keys/keys/:room_id/:session_id", |             unstable => "/_matrix/client/unstable/room_keys/keys/:room_id/:session_id", | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/room_keys/keys/:room_id/:session_id", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/room_keys/keys/:room_id/:session_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The backup version to add keys to.
 |     pub struct Request<'a> { | ||||||
|             ///
 |         /// The backup version to add keys to.
 | ||||||
|             /// Must be the current backup.
 |         ///
 | ||||||
|             #[ruma_api(query)] |         /// Must be the current backup.
 | ||||||
|             pub version: &'a str, |         #[ruma_api(query)] | ||||||
|  |         pub version: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// The ID of the room to add keys to.
 |         /// The ID of the room to add keys to.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub room_id: &'a RoomId, |         pub room_id: &'a RoomId, | ||||||
| 
 | 
 | ||||||
|             /// The ID of the megolm session to add keys to.
 |         /// The ID of the megolm session to add keys to.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub session_id: &'a str, |         pub session_id: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// The key information to store.
 |         /// The key information to store.
 | ||||||
|             #[ruma_api(body)] |         #[ruma_api(body)] | ||||||
|             pub session_data: Raw<KeyBackupData>, |         pub session_data: Raw<KeyBackupData>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// An opaque string representing stored keys in the backup.
 |     pub struct Response { | ||||||
|             ///
 |         /// 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
 |         ///
 | ||||||
|             /// key storage request.
 |         /// Clients can compare it with the etag value they received in the request of their last
 | ||||||
|             pub etag: String, |         /// key storage request.
 | ||||||
|  |         pub etag: String, | ||||||
| 
 | 
 | ||||||
|             /// The number of keys stored in the backup.
 |         /// The number of keys stored in the backup.
 | ||||||
|             pub count: UInt, |         pub count: UInt, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -5,34 +5,37 @@ 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", |         rate_limited: true, | ||||||
|             unstable_path: "/_matrix/client/unstable/room_keys/version", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/room_keys/version", |         history: { | ||||||
|             rate_limited: true, |             unstable => "/_matrix/client/unstable/room_keys/version", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/room_keys/version", | ||||||
|             added: 1.1, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The algorithm used for storing backups.
 |     pub struct Request { | ||||||
|             #[ruma_api(body)] |         /// The algorithm used for storing backups.
 | ||||||
|             pub algorithm: Raw<BackupAlgorithm>, |         #[ruma_api(body)] | ||||||
|         } |         pub algorithm: Raw<BackupAlgorithm>, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// The backup version.
 |     pub struct Response { | ||||||
|             pub version: String, |         /// The backup version.
 | ||||||
|         } |         pub version: String, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl Request { |     impl Request { | ||||||
|  | |||||||
| @ -8,39 +8,41 @@ 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", |         rate_limited: true, | ||||||
|             unstable_path: "/_matrix/client/unstable/room_keys/keys", |         authentication: AccessToken, | ||||||
|             r0_path: "/_matrix/client/r0/room_keys/keys", |         history: { | ||||||
|             stable_path: "/_matrix/client/v3/room_keys/keys", |             unstable => "/_matrix/client/unstable/room_keys/keys", | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/room_keys/keys", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/room_keys/keys", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The backup version from which to delete keys.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(query)] |         /// The backup version from which to delete keys.
 | ||||||
|             pub version: &'a str, |         #[ruma_api(query)] | ||||||
|         } |         pub version: &'a str, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// An opaque string representing stored keys in the backup.
 |     pub struct Response { | ||||||
|             ///
 |         /// 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
 |         ///
 | ||||||
|             /// key storage request.
 |         /// Clients can compare it with the etag value they received in the request of their last
 | ||||||
|             pub etag: String, |         /// key storage request.
 | ||||||
|  |         pub etag: String, | ||||||
| 
 | 
 | ||||||
|             /// The number of keys stored in the backup.
 |         /// The number of keys stored in the backup.
 | ||||||
|             pub count: UInt, |         pub count: UInt, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -6,43 +6,45 @@ 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", |         rate_limited: true, | ||||||
|             unstable_path: "/_matrix/client/unstable/room_keys/keys/:room_id", |         authentication: AccessToken, | ||||||
|             r0_path: "/_matrix/client/r0/room_keys/keys/:room_id", |         history: { | ||||||
|             stable_path: "/_matrix/client/v3/room_keys/keys/:room_id", |             unstable => "/_matrix/client/unstable/room_keys/keys/:room_id", | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/room_keys/keys/:room_id", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/room_keys/keys/:room_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The backup version from which to delete keys.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(query)] |         /// The backup version from which to delete keys.
 | ||||||
|             pub version: &'a str, |         #[ruma_api(query)] | ||||||
|  |         pub version: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// The ID of the room to delete keys from.
 |         /// The ID of the room to delete keys from.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub room_id: &'a RoomId, |         pub room_id: &'a RoomId, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// An opaque string representing stored keys in the backup.
 |     pub struct Response { | ||||||
|             ///
 |         /// 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
 |         ///
 | ||||||
|             /// key storage request.
 |         /// Clients can compare it with the etag value they received in the request of their last
 | ||||||
|             pub etag: String, |         /// key storage request.
 | ||||||
|  |         pub etag: String, | ||||||
| 
 | 
 | ||||||
|             /// The number of keys stored in the backup.
 |         /// The number of keys stored in the backup.
 | ||||||
|             pub count: UInt, |         pub count: UInt, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -6,47 +6,49 @@ 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", |         rate_limited: true, | ||||||
|             unstable_path: "/_matrix/client/unstable/room_keys/keys/:room_id/:session_id", |         authentication: AccessToken, | ||||||
|             r0_path: "/_matrix/client/r0/room_keys/keys/:room_id/:session_id", |         history: { | ||||||
|             stable_path: "/_matrix/client/v3/room_keys/keys/:room_id/:session_id", |             unstable => "/_matrix/client/unstable/room_keys/keys/:room_id/:session_id", | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/room_keys/keys/:room_id/:session_id", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/room_keys/keys/:room_id/:session_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The backup version from which to delete keys.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(query)] |         /// The backup version from which to delete keys.
 | ||||||
|             pub version: &'a str, |         #[ruma_api(query)] | ||||||
|  |         pub version: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// The ID of the room to delete keys from.
 |         /// The ID of the room to delete keys from.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub room_id: &'a RoomId, |         pub room_id: &'a RoomId, | ||||||
| 
 | 
 | ||||||
|             /// The ID of the megolm session to delete keys from.
 |         /// The ID of the megolm session to delete keys from.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub session_id: &'a str, |         pub session_id: &'a str, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// An opaque string representing stored keys in the backup.
 |     pub struct Response { | ||||||
|             ///
 |         /// 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
 |         ///
 | ||||||
|             /// key storage request.
 |         /// Clients can compare it with  the etag value they received in the request of their last
 | ||||||
|             pub etag: String, |         /// key storage request.
 | ||||||
|  |         pub etag: String, | ||||||
| 
 | 
 | ||||||
|             /// The number of keys stored in the backup.
 |         /// The number of keys stored in the backup.
 | ||||||
|             pub count: UInt, |         pub count: UInt, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -7,33 +7,35 @@ 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", |         rate_limited: true, | ||||||
|             unstable_path: "/_matrix/client/unstable/room_keys/version/:version", |         authentication: AccessToken, | ||||||
|             r0_path: "/_matrix/client/r0/room_keys/version/:version", |         history: { | ||||||
|             stable_path: "/_matrix/client/v3/room_keys/version/:version", |             unstable => "/_matrix/client/unstable/room_keys/version/:version", | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/room_keys/version/:version", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/room_keys/version/:version", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The backup version to delete.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The backup version to delete.
 | ||||||
|             pub version: &'a str, |         #[ruma_api(path)] | ||||||
|         } |         pub version: &'a str, | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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(version: &'a str) -> Self { |         pub fn new(version: &'a str) -> Self { | ||||||
|  | |||||||
| @ -8,49 +8,52 @@ 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", |         rate_limited: true, | ||||||
|             unstable_path: "/_matrix/client/unstable/room_keys/version/:version", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/room_keys/version/:version", |         history: { | ||||||
|             rate_limited: true, |             unstable => "/_matrix/client/unstable/room_keys/version/:version", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/room_keys/version/:version", | ||||||
|             added: 1.1, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The backup version to retrieve info from.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The backup version to retrieve info from.
 | ||||||
|             pub version: &'a str, |         #[ruma_api(path)] | ||||||
|         } |         pub version: &'a str, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         #[ruma_api(manual_body_serde)] |     #[response(error = crate::Error)] | ||||||
|         response: { |     #[ruma_api(manual_body_serde)] | ||||||
|             /// The algorithm used for storing backups.
 |     pub struct Response { | ||||||
|             pub algorithm: Raw<BackupAlgorithm>, |         /// The algorithm used for storing backups.
 | ||||||
|  |         pub algorithm: Raw<BackupAlgorithm>, | ||||||
| 
 | 
 | ||||||
|             /// The number of keys stored in the backup.
 |         /// The number of keys stored in the backup.
 | ||||||
|             pub count: UInt, |         pub count: UInt, | ||||||
| 
 | 
 | ||||||
|             /// 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
 | ||||||
|             /// key storage request.
 |         /// key storage request.
 | ||||||
|             pub etag: String, |         pub etag: String, | ||||||
| 
 | 
 | ||||||
|             /// The backup version.
 |         /// The backup version.
 | ||||||
|             pub version: String, |         pub version: String, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -9,35 +9,37 @@ 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", |         rate_limited: true, | ||||||
|             unstable_path: "/_matrix/client/unstable/room_keys/keys", |         authentication: AccessToken, | ||||||
|             r0_path: "/_matrix/client/r0/room_keys/keys", |         history: { | ||||||
|             stable_path: "/_matrix/client/v3/room_keys/keys", |             unstable => "/_matrix/client/unstable/room_keys/keys", | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/room_keys/keys", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/room_keys/keys", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The backup version to retrieve keys from.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(query)] |         /// The backup version to retrieve keys from.
 | ||||||
|             pub version: &'a str, |         #[ruma_api(query)] | ||||||
|         } |         pub version: &'a str, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// A map from room IDs to session IDs to key data.
 |     pub struct Response { | ||||||
|             pub rooms: BTreeMap<OwnedRoomId, RoomKeyBackup>, |         /// A map from room IDs to session IDs to key data.
 | ||||||
|         } |         pub rooms: BTreeMap<OwnedRoomId, RoomKeyBackup>, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -7,39 +7,43 @@ 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", |         rate_limited: true, | ||||||
|             unstable_path: "/_matrix/client/unstable/room_keys/keys/:room_id", |         authentication: AccessToken, | ||||||
|             r0_path: "/_matrix/client/r0/room_keys/keys/:room_id", |         history: { | ||||||
|             stable_path: "/_matrix/client/v3/room_keys/keys/:room_id", |             unstable => "/_matrix/client/unstable/room_keys/keys/:room_id", | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/room_keys/keys/:room_id", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/room_keys/keys/:room_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The backup version to retrieve keys from.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(query)] |         /// The backup version to retrieve keys from.
 | ||||||
|             pub version: &'a str, |         #[ruma_api(query)] | ||||||
|  |         pub version: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// The ID of the room that the requested key is for.
 |         /// The ID of the room that the requested key is for.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub room_id: &'a RoomId, |         pub room_id: &'a RoomId, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// A map of session IDs to key data.
 |     pub struct Response { | ||||||
|             pub sessions: BTreeMap<String, Raw<KeyBackupData>>, |         /// A map of session IDs to key data.
 | ||||||
|         } |         pub sessions: BTreeMap<String, Raw<KeyBackupData>>, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -5,44 +5,48 @@ 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", |         rate_limited: true, | ||||||
|             unstable_path: "/_matrix/client/unstable/room_keys/keys/:room_id/:session_id", |         authentication: AccessToken, | ||||||
|             r0_path: "/_matrix/client/r0/room_keys/keys/:room_id/:session_id", |         history: { | ||||||
|             stable_path: "/_matrix/client/v3/room_keys/keys/:room_id/:session_id", |             unstable => "/_matrix/client/unstable/room_keys/keys/:room_id/:session_id", | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/room_keys/keys/:room_id/:session_id", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/room_keys/keys/:room_id/:session_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The backup version to retrieve keys from.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(query)] |         /// The backup version to retrieve keys from.
 | ||||||
|             pub version: &'a str, |         #[ruma_api(query)] | ||||||
|  |         pub version: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// The ID of the room that the requested key is for.
 |         /// The ID of the room that the requested key is for.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub room_id: &'a RoomId, |         pub room_id: &'a RoomId, | ||||||
| 
 | 
 | ||||||
|             /// The ID of the megolm session whose key is requested.
 |         /// The ID of the megolm session whose key is requested.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub session_id: &'a str, |         pub session_id: &'a str, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// Information about the requested backup key.
 |     pub struct Response { | ||||||
|             #[ruma_api(body)] |         /// Information about the requested backup key.
 | ||||||
|             pub key_data: Raw<KeyBackupData>, |         #[ruma_api(body)] | ||||||
|         } |         pub key_data: Raw<KeyBackupData>, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -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,41 +19,40 @@ 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", |         rate_limited: true, | ||||||
|             unstable_path: "/_matrix/client/unstable/room_keys/version", |         authentication: AccessToken, | ||||||
|             r0_path: "/_matrix/client/r0/room_keys/version", |         history: { | ||||||
|             stable_path: "/_matrix/client/v3/room_keys/version", |             unstable => "/_matrix/client/unstable/room_keys/version", | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/room_keys/version", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/room_keys/version", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[request(error = crate::Error)] | ||||||
|         request: {} |     #[derive(Default)] | ||||||
|  |     pub struct Request {} | ||||||
| 
 | 
 | ||||||
|         #[ruma_api(manual_body_serde)] |     #[response(error = crate::Error)] | ||||||
|         response: { |     #[ruma_api(manual_body_serde)] | ||||||
|             /// The algorithm used for storing backups.
 |     pub struct Response { | ||||||
|             pub algorithm: Raw<BackupAlgorithm>, |         /// The algorithm used for storing backups.
 | ||||||
|  |         pub algorithm: Raw<BackupAlgorithm>, | ||||||
| 
 | 
 | ||||||
|             /// The number of keys stored in the backup.
 |         /// The number of keys stored in the backup.
 | ||||||
|             pub count: UInt, |         pub count: UInt, | ||||||
| 
 | 
 | ||||||
|             /// 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
 | ||||||
|             /// key storage request.
 |         /// key storage request.
 | ||||||
|             pub etag: String, |         pub etag: String, | ||||||
| 
 | 
 | ||||||
|             /// The backup version.
 |         /// The backup version.
 | ||||||
|             pub version: String, |         pub version: String, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl Request { |     impl Request { | ||||||
|  | |||||||
| @ -5,38 +5,41 @@ 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", |         rate_limited: true, | ||||||
|             unstable_path: "/_matrix/client/unstable/room_keys/version/:version", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/room_keys/version/:version", |         history: { | ||||||
|             rate_limited: true, |             unstable => "/_matrix/client/unstable/room_keys/version/:version", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/room_keys/version/:version", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The backup version.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The backup version.
 | ||||||
|             pub version: &'a str, |         #[ruma_api(path)] | ||||||
|  |         pub version: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// 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>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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.
 | ||||||
|         pub fn new(version: &'a str, algorithm: Raw<BackupAlgorithm>) -> Self { |         pub fn new(version: &'a str, algorithm: Raw<BackupAlgorithm>) -> Self { | ||||||
|  | |||||||
| @ -6,40 +6,43 @@ 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.", |         method: GET, | ||||||
|             name: "get_global_account_data", |         name: "get_global_account_data", | ||||||
|             method: GET, |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/user/:user_id/account_data/:event_type", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/user/:user_id/account_data/:event_type", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/user/:user_id/account_data/:event_type", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/user/:user_id/account_data/:event_type", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// User ID of user for whom to retrieve data.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// User ID of user for whom to retrieve data.
 | ||||||
|             pub user_id: &'a UserId, |         #[ruma_api(path)] | ||||||
|  |         pub user_id: &'a UserId, | ||||||
| 
 | 
 | ||||||
|             /// Type of data to retrieve.
 |         /// Type of data to retrieve.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub event_type: &'a str, |         pub event_type: &'a str, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// Account data content for the given type.
 |     pub struct Response { | ||||||
|             ///
 |         /// Account data content for the given type.
 | ||||||
|             /// Use [`Raw::deserialize_content`] for deserialization.
 |         ///
 | ||||||
|             #[ruma_api(body)] |         /// Use [`Raw::deserialize_content`] for deserialization.
 | ||||||
|             pub account_data: Raw<AnyGlobalAccountDataEventContent>, |         #[ruma_api(body)] | ||||||
|         } |         pub account_data: Raw<AnyGlobalAccountDataEventContent>, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -6,44 +6,47 @@ 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", |         method: GET, | ||||||
|             name: "get_room_account_data", |         name: "get_room_account_data", | ||||||
|             method: GET, |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/user/:user_id/rooms/:room_id/account_data/:event_type", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/user/:user_id/rooms/:room_id/account_data/:event_type", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/user/:user_id/rooms/:room_id/account_data/:event_type", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/user/:user_id/rooms/:room_id/account_data/:event_type", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// User ID of user for whom to retrieve data.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// User ID of user for whom to retrieve data.
 | ||||||
|             pub user_id: &'a UserId, |         #[ruma_api(path)] | ||||||
|  |         pub user_id: &'a UserId, | ||||||
| 
 | 
 | ||||||
|             /// Room ID for which to retrieve data.
 |         /// Room ID for which to retrieve data.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub room_id: &'a RoomId, |         pub room_id: &'a RoomId, | ||||||
| 
 | 
 | ||||||
|             /// Type of data to retrieve.
 |         /// Type of data to retrieve.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub event_type: &'a str, |         pub event_type: &'a str, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// Account data content for the given type.
 |     pub struct Response { | ||||||
|             ///
 |         /// Account data content for the given type.
 | ||||||
|             /// Use [`Raw::deserialize_content`] for deserialization.
 |         ///
 | ||||||
|             #[ruma_api(body)] |         /// Use [`Raw::deserialize_content`] for deserialization.
 | ||||||
|             pub account_data: Raw<AnyRoomAccountDataEventContent>, |         #[ruma_api(body)] | ||||||
|         } |         pub account_data: Raw<AnyRoomAccountDataEventContent>, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -6,54 +6,54 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/user/:user_id/account_data/:event_type", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/user/:user_id/account_data/:event_type", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/user/:user_id/account_data/:event_type", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/user/:user_id/account_data/:event_type", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The ID of the user to set account_data for.
 |     pub struct Request<'a> { | ||||||
|             ///
 |         /// The ID of the user to set account_data for.
 | ||||||
|             /// The access token must be authorized to make requests for this user ID.
 |         ///
 | ||||||
|             #[ruma_api(path)] |         /// The access token must be authorized to make requests for this user ID.
 | ||||||
|             pub user_id: &'a UserId, |         #[ruma_api(path)] | ||||||
|  |         pub user_id: &'a UserId, | ||||||
| 
 | 
 | ||||||
|             /// The event type of the account_data to set.
 |         /// The event type of the account_data to set.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Custom types should be namespaced to avoid clashes.
 |         /// Custom types should be namespaced to avoid clashes.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub event_type: GlobalAccountDataEventType, |         pub event_type: GlobalAccountDataEventType, | ||||||
| 
 | 
 | ||||||
|             /// Arbitrary JSON to store as config data.
 |         /// Arbitrary JSON to store as config data.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// To create a `RawJsonValue`, use `serde_json::value::to_raw_value`.
 |         /// To create a `RawJsonValue`, use `serde_json::value::to_raw_value`.
 | ||||||
|             #[ruma_api(body)] |         #[ruma_api(body)] | ||||||
|             pub data: Raw<AnyGlobalAccountDataEventContent>, |         pub data: Raw<AnyGlobalAccountDataEventContent>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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,57 +6,57 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/user/:user_id/rooms/:room_id/account_data/:event_type", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/user/:user_id/rooms/:room_id/account_data/:event_type", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/user/:user_id/rooms/:room_id/account_data/:event_type", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/user/:user_id/rooms/:room_id/account_data/:event_type", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The ID of the user to set account_data for.
 |     pub struct Request<'a> { | ||||||
|             ///
 |         /// The ID of the user to set account_data for.
 | ||||||
|             /// The access token must be authorized to make requests for this user ID.
 |         ///
 | ||||||
|             #[ruma_api(path)] |         /// The access token must be authorized to make requests for this user ID.
 | ||||||
|             pub user_id: &'a UserId, |         #[ruma_api(path)] | ||||||
|  |         pub user_id: &'a UserId, | ||||||
| 
 | 
 | ||||||
|             /// The ID of the room to set account_data on.
 |         /// The ID of the room to set account_data on.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub room_id: &'a RoomId, |         pub room_id: &'a RoomId, | ||||||
| 
 | 
 | ||||||
|             /// The event type of the account_data to set.
 |         /// The event type of the account_data to set.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Custom types should be namespaced to avoid clashes.
 |         /// Custom types should be namespaced to avoid clashes.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub event_type: RoomAccountDataEventType, |         pub event_type: RoomAccountDataEventType, | ||||||
| 
 | 
 | ||||||
|             /// Arbitrary JSON to store as config data.
 |         /// Arbitrary JSON to store as config data.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// To create a `RawJsonValue`, use `serde_json::value::to_raw_value`.
 |         /// To create a `RawJsonValue`, use `serde_json::value::to_raw_value`.
 | ||||||
|             #[ruma_api(body)] |         #[ruma_api(body)] | ||||||
|             pub data: Raw<AnyRoomAccountDataEventContent>, |         pub data: Raw<AnyRoomAccountDataEventContent>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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,82 +7,82 @@ 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, |         name: "get_context", | ||||||
|             r0_path: "/_matrix/client/r0/rooms/:room_id/context/:event_id", |         rate_limited: false, | ||||||
|             stable_path: "/_matrix/client/v3/rooms/:room_id/context/:event_id", |         authentication: AccessToken, | ||||||
|             name: "get_context", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/rooms/:room_id/context/:event_id", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/rooms/:room_id/context/:event_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The room to get events from.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The room to get events from.
 | ||||||
|             pub room_id: &'a RoomId, |         #[ruma_api(path)] | ||||||
|  |         pub room_id: &'a RoomId, | ||||||
| 
 | 
 | ||||||
|             /// The event to get context around.
 |         /// The event to get context around.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub event_id: &'a EventId, |         pub event_id: &'a EventId, | ||||||
| 
 | 
 | ||||||
|             /// The maximum number of events to return.
 |         /// The maximum number of events to return.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Defaults to 10.
 |         /// Defaults to 10.
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             #[serde(default = "default_limit", skip_serializing_if = "is_default_limit")] |         #[serde(default = "default_limit", skip_serializing_if = "is_default_limit")] | ||||||
|             pub limit: UInt, |         pub limit: UInt, | ||||||
| 
 | 
 | ||||||
|             /// A RoomEventFilter to filter returned events with.
 |         /// A RoomEventFilter to filter returned events with.
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             #[serde(
 |         #[serde(
 | ||||||
|                 with = "ruma_common::serde::json_string", |             with = "ruma_common::serde::json_string", | ||||||
|                 default, |             default, | ||||||
|                 skip_serializing_if = "RoomEventFilter::is_empty" |             skip_serializing_if = "RoomEventFilter::is_empty" | ||||||
|             )] |         )] | ||||||
|             pub filter: RoomEventFilter<'a>, |         pub filter: RoomEventFilter<'a>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[response(error = crate::Error)] | ||||||
|         response: { |     #[derive(Default)] | ||||||
|             /// A token that can be used to paginate backwards with.
 |     pub struct Response { | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         /// A token that can be used to paginate backwards with.
 | ||||||
|             pub start: Option<String>, |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|  |         pub start: Option<String>, | ||||||
| 
 | 
 | ||||||
|             /// A token that can be used to paginate forwards with.
 |         /// A token that can be used to paginate forwards with.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub end: Option<String>, |         pub end: Option<String>, | ||||||
| 
 | 
 | ||||||
|             /// A list of room events that happened just before the requested event,
 |         /// A list of room events that happened just before the requested event,
 | ||||||
|             /// in reverse-chronological order.
 |         /// in reverse-chronological order.
 | ||||||
|             #[serde(default, skip_serializing_if = "Vec::is_empty")] |         #[serde(default, skip_serializing_if = "Vec::is_empty")] | ||||||
|             pub events_before: Vec<Raw<AnyTimelineEvent>>, |         pub events_before: Vec<Raw<AnyTimelineEvent>>, | ||||||
| 
 | 
 | ||||||
|             /// Details of the requested event.
 |         /// Details of the requested event.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub event: Option<Raw<AnyTimelineEvent>>, |         pub event: Option<Raw<AnyTimelineEvent>>, | ||||||
| 
 | 
 | ||||||
|             /// A list of room events that happened just after the requested event,
 |         /// A list of room events that happened just after the requested event,
 | ||||||
|             /// in chronological order.
 |         /// in chronological order.
 | ||||||
|             #[serde(default, skip_serializing_if = "Vec::is_empty")] |         #[serde(default, skip_serializing_if = "Vec::is_empty")] | ||||||
|             pub events_after: Vec<Raw<AnyTimelineEvent>>, |         pub events_after: Vec<Raw<AnyTimelineEvent>>, | ||||||
| 
 | 
 | ||||||
|             /// The state of the room at the last event returned.
 |         /// The state of the room at the last event returned.
 | ||||||
|             #[serde(default, skip_serializing_if = "Vec::is_empty")] |         #[serde(default, skip_serializing_if = "Vec::is_empty")] | ||||||
|             pub state: Vec<Raw<AnyStateEvent>>, |         pub state: Vec<Raw<AnyStateEvent>>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -5,38 +5,40 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/devices/:device_id", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/devices/:device_id", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/devices/:device_id", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/devices/:device_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = UiaaResponse)] | ||||||
|             /// The device to delete.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The device to delete.
 | ||||||
|             pub device_id: &'a DeviceId, |         #[ruma_api(path)] | ||||||
|  |         pub device_id: &'a DeviceId, | ||||||
| 
 | 
 | ||||||
|             /// 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>>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: UiaaResponse |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = UiaaResponse)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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,37 +5,39 @@ 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, |         name: "delete_devices", | ||||||
|             r0_path: "/_matrix/client/r0/delete_devices", |         rate_limited: false, | ||||||
|             stable_path: "/_matrix/client/v3/delete_devices", |         authentication: AccessToken, | ||||||
|             name: "delete_devices", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/delete_devices", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/delete_devices", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = UiaaResponse)] | ||||||
|             /// List of devices to delete.
 |     pub struct Request<'a> { | ||||||
|             pub devices: &'a [OwnedDeviceId], |         /// List of devices to delete.
 | ||||||
|  |         pub devices: &'a [OwnedDeviceId], | ||||||
| 
 | 
 | ||||||
|             /// 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>>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: UiaaResponse |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = UiaaResponse)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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.
 | ||||||
|         pub fn new(devices: &'a [OwnedDeviceId]) -> Self { |         pub fn new(devices: &'a [OwnedDeviceId]) -> Self { | ||||||
|  | |||||||
| @ -5,35 +5,37 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/devices/:device_id", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/devices/:device_id", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/devices/:device_id", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/devices/:device_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The device to retrieve.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The device to retrieve.
 | ||||||
|             pub device_id: &'a DeviceId, |         #[ruma_api(path)] | ||||||
|         } |         pub device_id: &'a DeviceId, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// Information about the device.
 |     pub struct Response { | ||||||
|             #[ruma_api(body)] |         /// Information about the device.
 | ||||||
|             pub device: Device, |         #[ruma_api(body)] | ||||||
|         } |         pub device: Device, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -5,31 +5,33 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/devices", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/devices", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/devices", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/devices", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[request(error = crate::Error)] | ||||||
|         request: {} |     #[derive(Default)] | ||||||
|  |     pub struct Request {} | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// A list of all registered devices for this user
 |     pub struct Response { | ||||||
|             pub devices: Vec<Device>, |         /// A list of all registered devices for this user
 | ||||||
|         } |         pub devices: Vec<Device>, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl Request { |     impl Request { | ||||||
|  | |||||||
| @ -5,38 +5,40 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/devices/:device_id", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/devices/:device_id", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/devices/:device_id", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/devices/:device_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The device to update.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The device to update.
 | ||||||
|             pub device_id: &'a DeviceId, |         #[ruma_api(path)] | ||||||
|  |         pub device_id: &'a DeviceId, | ||||||
| 
 | 
 | ||||||
|             /// The new display name for this device.
 |         /// The new display name for this device.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// If this is `None`, the display name won't be changed.
 |         /// If this is `None`, the display name won't be changed.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub display_name: Option<&'a str>, |         pub display_name: Option<&'a str>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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 { | ||||||
|  | |||||||
| @ -6,58 +6,61 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/publicRooms", |         authentication: None, | ||||||
|             stable_path: "/_matrix/client/v3/publicRooms", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/publicRooms", | ||||||
|             authentication: None, |             1.1 => "/_matrix/client/v3/publicRooms", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[request(error = crate::Error)] | ||||||
|         request: { |     #[derive(Default)] | ||||||
|             /// Limit for the number of results to return.
 |     pub struct Request<'a> { | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         /// Limit for the number of results to return.
 | ||||||
|             #[ruma_api(query)] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub limit: Option<UInt>, |         #[ruma_api(query)] | ||||||
|  |         pub limit: Option<UInt>, | ||||||
| 
 | 
 | ||||||
|             /// Pagination token from a previous request.
 |         /// Pagination token from a previous request.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             pub since: Option<&'a str>, |         pub since: Option<&'a str>, | ||||||
| 
 | 
 | ||||||
|             /// 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.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             pub server: Option<&'a ServerName>, |         pub server: Option<&'a ServerName>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// A paginated chunk of public rooms.
 |     pub struct Response { | ||||||
|             pub chunk: Vec<PublicRoomsChunk>, |         /// A paginated chunk of public rooms.
 | ||||||
|  |         pub chunk: Vec<PublicRoomsChunk>, | ||||||
| 
 | 
 | ||||||
|             /// A pagination token for the response.
 |         /// A pagination token for the response.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub next_batch: Option<String>, |         pub next_batch: Option<String>, | ||||||
| 
 | 
 | ||||||
|             /// A pagination token that allows fetching previous results.
 |         /// A pagination token that allows fetching previous results.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub prev_batch: Option<String>, |         pub prev_batch: Option<String>, | ||||||
| 
 | 
 | ||||||
|             /// An estimate on the total number of public rooms, if the server has an estimate.
 |         /// An estimate on the total number of public rooms, if the server has an estimate.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             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> { | ||||||
|  | |||||||
| @ -7,68 +7,67 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/publicRooms", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/publicRooms", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/publicRooms", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/publicRooms", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[request(error = crate::Error)] | ||||||
|         request: { |     #[derive(Default)] | ||||||
|             /// The server to fetch the public room lists from.
 |     pub struct Request<'a> { | ||||||
|             ///
 |         /// The server to fetch the public room lists from.
 | ||||||
|             /// `None` means the server this request is sent to.
 |         ///
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         /// `None` means the server this request is sent to.
 | ||||||
|             #[ruma_api(query)] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub server: Option<&'a ServerName>, |         #[ruma_api(query)] | ||||||
|  |         pub server: Option<&'a ServerName>, | ||||||
| 
 | 
 | ||||||
|             /// 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")] | ||||||
|             pub limit: Option<UInt>, |         pub limit: Option<UInt>, | ||||||
| 
 | 
 | ||||||
|             /// Pagination token from a previous request.
 |         /// Pagination token from a previous request.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub since: Option<&'a str>, |         pub since: Option<&'a str>, | ||||||
| 
 | 
 | ||||||
|             /// Filter to apply to the results.
 |         /// Filter to apply to the results.
 | ||||||
|             #[serde(default, skip_serializing_if = "Filter::is_empty")] |         #[serde(default, skip_serializing_if = "Filter::is_empty")] | ||||||
|             pub filter: Filter<'a>, |         pub filter: Filter<'a>, | ||||||
| 
 | 
 | ||||||
|             /// Network to fetch the public room lists from.
 |         /// Network to fetch the public room lists from.
 | ||||||
|             #[serde(flatten, skip_serializing_if = "ruma_common::serde::is_default")] |         #[serde(flatten, skip_serializing_if = "ruma_common::serde::is_default")] | ||||||
|             pub room_network: RoomNetwork<'a>, |         pub room_network: RoomNetwork<'a>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[response(error = crate::Error)] | ||||||
|         response: { |     #[derive(Default)] | ||||||
|             /// A paginated chunk of public rooms.
 |     pub struct Response { | ||||||
|             pub chunk: Vec<PublicRoomsChunk>, |         /// A paginated chunk of public rooms.
 | ||||||
|  |         pub chunk: Vec<PublicRoomsChunk>, | ||||||
| 
 | 
 | ||||||
|             /// A pagination token for the response.
 |         /// A pagination token for the response.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub next_batch: Option<String>, |         pub next_batch: Option<String>, | ||||||
| 
 | 
 | ||||||
|             /// A pagination token that allows fetching previous results.
 |         /// A pagination token that allows fetching previous results.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub prev_batch: Option<String>, |         pub prev_batch: Option<String>, | ||||||
| 
 | 
 | ||||||
|             /// An estimate on the total number of public rooms, if the server has an estimate.
 |         /// An estimate on the total number of public rooms, if the server has an estimate.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub total_room_count_estimate: Option<UInt>, |         pub total_room_count_estimate: Option<UInt>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl Request<'_> { |     impl Request<'_> { | ||||||
|  | |||||||
| @ -5,34 +5,36 @@ 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.", |         method: GET, | ||||||
|             name: "get_room_visibility", |         name: "get_room_visibility", | ||||||
|             method: GET, |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/directory/list/room/:room_id", |         authentication: None, | ||||||
|             stable_path: "/_matrix/client/v3/directory/list/room/:room_id", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/directory/list/room/:room_id", | ||||||
|             authentication: None, |             1.1 => "/_matrix/client/v3/directory/list/room/:room_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The ID of the room of which to request the visibility.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The ID of the room of which to request the visibility.
 | ||||||
|             pub room_id: &'a RoomId, |         #[ruma_api(path)] | ||||||
|         } |         pub room_id: &'a RoomId, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// Visibility of the room.
 |     pub struct Response { | ||||||
|             pub visibility: Visibility, |         /// Visibility of the room.
 | ||||||
|         } |         pub visibility: Visibility, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -5,37 +5,39 @@ 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.", |         method: PUT, | ||||||
|             name: "set_room_visibility", |         name: "set_room_visibility", | ||||||
|             method: PUT, |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/directory/list/room/:room_id", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/directory/list/room/:room_id", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/directory/list/room/:room_id", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/directory/list/room/:room_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The ID of the room of which to set the visibility.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The ID of the room of which to set the visibility.
 | ||||||
|             pub room_id: &'a RoomId, |         #[ruma_api(path)] | ||||||
|  |         pub room_id: &'a RoomId, | ||||||
| 
 | 
 | ||||||
|             /// New visibility setting for the room.
 |         /// New visibility setting for the room.
 | ||||||
|             pub visibility: Visibility, |         pub visibility: Visibility, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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.
 | ||||||
|         pub fn new(room_id: &'a RoomId, visibility: Visibility) -> Self { |         pub fn new(room_id: &'a RoomId, visibility: Visibility) -> Self { | ||||||
|  | |||||||
| @ -2,52 +2,54 @@ | |||||||
| //!
 | //!
 | ||||||
| //! [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", |     rate_limited: false, | ||||||
|         stable_path: "/.well-known/matrix/client", |     authentication: None, | ||||||
|         rate_limited: false, |     history: { | ||||||
|         authentication: None, |         1.0 => "/.well-known/matrix/client", | ||||||
|         added: 1.0, |  | ||||||
|     } |     } | ||||||
|  | }; | ||||||
| 
 | 
 | ||||||
|     #[derive(Default)] | #[request(error = crate::Error)] | ||||||
|     request: {} | #[derive(Default)] | ||||||
|  | pub struct Request {} | ||||||
| 
 | 
 | ||||||
|     response: { | #[response(error = crate::Error)] | ||||||
|         /// Information about the homeserver to connect to.
 | pub struct Response { | ||||||
|         #[serde(rename = "m.homeserver")] |     /// Information about the homeserver to connect to.
 | ||||||
|         pub homeserver: HomeserverInfo, |     #[serde(rename = "m.homeserver")] | ||||||
|  |     pub homeserver: HomeserverInfo, | ||||||
| 
 | 
 | ||||||
|         /// Information about the identity server to connect to.
 |     /// Information about the identity server to connect to.
 | ||||||
|         #[serde(rename = "m.identity_server", skip_serializing_if = "Option::is_none")] |     #[serde(rename = "m.identity_server", skip_serializing_if = "Option::is_none")] | ||||||
|         pub identity_server: Option<IdentityServerInfo>, |     pub identity_server: Option<IdentityServerInfo>, | ||||||
| 
 | 
 | ||||||
|         /// Information about the tile server to use to display location data.
 |     /// Information about the tile server to use to display location data.
 | ||||||
|         #[cfg(feature = "unstable-msc3488")] |     #[cfg(feature = "unstable-msc3488")] | ||||||
|         #[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>, | ||||||
| 
 | 
 | ||||||
|         /// Information about the authentication server to connect to when using OpenID Connect.
 |     /// Information about the authentication server to connect to when using OpenID Connect.
 | ||||||
|         #[cfg(feature = "unstable-msc2965")] |     #[cfg(feature = "unstable-msc2965")] | ||||||
|         #[serde(
 |     #[serde(
 | ||||||
|             rename = "org.matrix.msc2965.authentication", |         rename = "org.matrix.msc2965.authentication", | ||||||
|             alias = "m.authentication", |         alias = "m.authentication", | ||||||
|             skip_serializing_if = "Option::is_none" |         skip_serializing_if = "Option::is_none" | ||||||
|         )] |     )] | ||||||
|         pub authentication: Option<AuthenticationServerInfo>, |     pub authentication: Option<AuthenticationServerInfo>, | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     error: crate::Error |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl Request { | impl Request { | ||||||
|  | |||||||
| @ -2,31 +2,33 @@ | |||||||
| //!
 | //!
 | ||||||
| //! [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", |     rate_limited: true, | ||||||
|         r0_path: "/_matrix/client/r0/capabilities", |     authentication: AccessToken, | ||||||
|         stable_path: "/_matrix/client/v3/capabilities", |     history: { | ||||||
|         rate_limited: true, |         1.0 => "/_matrix/client/r0/capabilities", | ||||||
|         authentication: AccessToken, |         1.1 => "/_matrix/client/v3/capabilities", | ||||||
|         added: 1.0, |  | ||||||
|     } |     } | ||||||
|  | }; | ||||||
| 
 | 
 | ||||||
|     #[derive(Default)] | #[request(error = crate::Error)] | ||||||
|     request: {} | #[derive(Default)] | ||||||
|  | pub struct Request {} | ||||||
| 
 | 
 | ||||||
|     response: { | #[response(error = crate::Error)] | ||||||
|         /// The capabilities the server supports
 | pub struct Response { | ||||||
|         pub capabilities: Capabilities, |     /// The capabilities the server supports
 | ||||||
|     } |     pub capabilities: Capabilities, | ||||||
| 
 |  | ||||||
|     error: crate::Error |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl Request { | impl Request { | ||||||
|  | |||||||
| @ -4,32 +4,34 @@ | |||||||
| 
 | 
 | ||||||
| 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", |     rate_limited: false, | ||||||
|         stable_path: "/_matrix/client/versions", |     authentication: None, | ||||||
|         rate_limited: false, |     history: { | ||||||
|         authentication: None, |         1.0 => "/_matrix/client/versions", | ||||||
|         added: 1.0, |  | ||||||
|     } |     } | ||||||
|  | }; | ||||||
| 
 | 
 | ||||||
|     #[derive(Default)] | #[request(error = crate::Error)] | ||||||
|     request: {} | #[derive(Default)] | ||||||
|  | pub struct Request {} | ||||||
| 
 | 
 | ||||||
|     response: { | #[response(error = crate::Error)] | ||||||
|         /// A list of Matrix client API protocol versions supported by the homeserver.
 | pub struct Response { | ||||||
|         pub versions: Vec<String>, |     /// A list of Matrix client API protocol versions supported by the homeserver.
 | ||||||
|  |     pub versions: Vec<String>, | ||||||
| 
 | 
 | ||||||
|         /// Experimental features supported by the server.
 |     /// Experimental features supported by the server.
 | ||||||
|         #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] |     #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] | ||||||
|         pub unstable_features: BTreeMap<String, bool>, |     pub unstable_features: BTreeMap<String, bool>, | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     error: crate::Error |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl Request { | impl Request { | ||||||
|  | |||||||
| @ -5,40 +5,42 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/user/:user_id/filter", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/user/:user_id/filter", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/user/:user_id/filter", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/user/:user_id/filter", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The ID of the user uploading the filter.
 |     pub struct Request<'a> { | ||||||
|             ///
 |         /// The ID of the user uploading the filter.
 | ||||||
|             /// The access token must be authorized to make requests for this user ID.
 |         ///
 | ||||||
|             #[ruma_api(path)] |         /// The access token must be authorized to make requests for this user ID.
 | ||||||
|             pub user_id: &'a UserId, |         #[ruma_api(path)] | ||||||
|  |         pub user_id: &'a UserId, | ||||||
| 
 | 
 | ||||||
|             /// The filter definition.
 |         /// The filter definition.
 | ||||||
|             #[ruma_api(body)] |         #[ruma_api(body)] | ||||||
|             pub filter: FilterDefinition<'a>, |         pub filter: FilterDefinition<'a>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// The ID of the filter that was created.
 |     pub struct Response { | ||||||
|             pub filter_id: String, |         /// The ID of the filter that was created.
 | ||||||
|         } |         pub filter_id: String, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -5,39 +5,41 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/user/:user_id/filter/:filter_id", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/user/:user_id/filter/:filter_id", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/user/:user_id/filter/:filter_id", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/user/:user_id/filter/:filter_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The user ID to download a filter for.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The user ID to download a filter for.
 | ||||||
|             pub user_id: &'a UserId, |         #[ruma_api(path)] | ||||||
|  |         pub user_id: &'a UserId, | ||||||
| 
 | 
 | ||||||
|             /// The ID of the filter to download.
 |         /// The ID of the filter to download.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub filter_id: &'a str, |         pub filter_id: &'a str, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// The filter definition.
 |     pub struct Response { | ||||||
|             #[ruma_api(body)] |         /// The filter definition.
 | ||||||
|             pub filter: IncomingFilterDefinition, |         #[ruma_api(body)] | ||||||
|         } |         pub filter: IncomingFilterDefinition, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -8,47 +8,49 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/keys/claim", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/keys/claim", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/keys/claim", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/keys/claim", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The time (in milliseconds) to wait when downloading keys from remote servers.
 |     pub struct Request { | ||||||
|             /// 10 seconds is the recommended default.
 |         /// The time (in milliseconds) to wait when downloading keys from remote servers.
 | ||||||
|             #[serde(
 |         /// 10 seconds is the recommended default.
 | ||||||
|                 with = "ruma_common::serde::duration::opt_ms", |         #[serde(
 | ||||||
|                 default, |             with = "ruma_common::serde::duration::opt_ms", | ||||||
|                 skip_serializing_if = "Option::is_none", |             default, | ||||||
|             )] |             skip_serializing_if = "Option::is_none" | ||||||
|             pub timeout: Option<Duration>, |         )] | ||||||
|  |         pub timeout: Option<Duration>, | ||||||
| 
 | 
 | ||||||
|             /// The keys to be claimed.
 |         /// The keys to be claimed.
 | ||||||
|             pub one_time_keys: BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceId, DeviceKeyAlgorithm>>, |         pub one_time_keys: BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceId, DeviceKeyAlgorithm>>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// If any remote homeservers could not be reached, they are recorded here.
 |     pub struct Response { | ||||||
|             /// The names of the properties are the names of the unreachable servers.
 |         /// If any remote homeservers could not be reached, they are recorded here.
 | ||||||
|             pub failures: BTreeMap<String, JsonValue>, |         /// The names of the properties are the names of the unreachable servers.
 | ||||||
|  |         pub failures: BTreeMap<String, JsonValue>, | ||||||
| 
 | 
 | ||||||
|             /// One-time keys for the queried devices.
 |         /// One-time keys for the queried devices.
 | ||||||
|             pub one_time_keys: BTreeMap<OwnedUserId, OneTimeKeys>, |         pub one_time_keys: BTreeMap<OwnedUserId, OneTimeKeys>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl Request { |     impl Request { | ||||||
|  | |||||||
| @ -5,45 +5,47 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/keys/changes", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/keys/changes", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/keys/changes", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/keys/changes", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The desired start point of the list.
 |     pub struct Request<'a> { | ||||||
|             ///
 |         /// The desired start point of the list.
 | ||||||
|             /// Should be the next_batch field from a response to an earlier call to /sync.
 |         ///
 | ||||||
|             #[ruma_api(query)] |         /// Should be the next_batch field from a response to an earlier call to /sync.
 | ||||||
|             pub from: &'a str, |         #[ruma_api(query)] | ||||||
|  |         pub from: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// The desired end point of the list.
 |         /// The desired end point of the list.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Should be the next_batch field from a recent call to /sync - typically the most recent
 |         /// Should be the next_batch field from a recent call to /sync - typically the most recent
 | ||||||
|             /// such call.
 |         /// such call.
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             pub to: &'a str, |         pub to: &'a str, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// The Matrix User IDs of all users who updated their device identity keys.
 |     pub struct Response { | ||||||
|             pub changed: Vec<OwnedUserId>, |         /// The Matrix User IDs of all users who updated their device identity keys.
 | ||||||
|  |         pub changed: Vec<OwnedUserId>, | ||||||
| 
 | 
 | ||||||
|             /// The Matrix User IDs of all users who may have left all the end-to-end
 |         /// The Matrix User IDs of all users who may have left all the end-to-end
 | ||||||
|             /// encrypted rooms they previously shared with the user.
 |         /// encrypted rooms they previously shared with the user.
 | ||||||
|             pub left: Vec<OwnedUserId>, |         pub left: Vec<OwnedUserId>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -8,77 +8,78 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/keys/query", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/keys/query", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/keys/query", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/keys/query", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[request(error = crate::Error)] | ||||||
|         request: { |     #[derive(Default)] | ||||||
|             /// The time (in milliseconds) to wait when downloading keys from remote servers.
 |     pub struct Request<'a> { | ||||||
|             ///
 |         /// The time (in milliseconds) to wait when downloading keys from remote servers.
 | ||||||
|             /// 10 seconds is the recommended default.
 |         ///
 | ||||||
|             #[serde(
 |         /// 10 seconds is the recommended default.
 | ||||||
|                 with = "ruma_common::serde::duration::opt_ms", |         #[serde(
 | ||||||
|                 default, |             with = "ruma_common::serde::duration::opt_ms", | ||||||
|                 skip_serializing_if = "Option::is_none", |             default, | ||||||
|             )] |             skip_serializing_if = "Option::is_none" | ||||||
|             pub timeout: Option<Duration>, |         )] | ||||||
|  |         pub timeout: Option<Duration>, | ||||||
| 
 | 
 | ||||||
|             /// The keys to be downloaded.
 |         /// The keys to be downloaded.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// An empty list indicates all devices for the corresponding user.
 |         /// An empty list indicates all devices for the corresponding user.
 | ||||||
|             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
 |         ///
 | ||||||
|             /// notification in that sync.
 |         /// This allows the server to ensure its response contains the keys advertised by the
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         /// notification in that sync.
 | ||||||
|             pub token: Option<&'a str>, |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|         } |         pub token: Option<&'a str>, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[response(error = crate::Error)] | ||||||
|         response: { |     #[derive(Default)] | ||||||
|             /// If any remote homeservers could not be reached, they are recorded here.
 |     pub struct Response { | ||||||
|             ///
 |         /// If any remote homeservers could not be reached, they are recorded here.
 | ||||||
|             /// The names of the properties are the names of the unreachable servers.
 |         ///
 | ||||||
|             #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] |         /// The names of the properties are the names of the unreachable servers.
 | ||||||
|             pub failures: BTreeMap<String, JsonValue>, |         #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] | ||||||
|  |         pub failures: BTreeMap<String, JsonValue>, | ||||||
| 
 | 
 | ||||||
|             /// Information on the queried devices.
 |         /// Information on the queried devices.
 | ||||||
|             #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] |         #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] | ||||||
|             pub device_keys: BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceId, Raw<DeviceKeys>>>, |         pub device_keys: BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceId, Raw<DeviceKeys>>>, | ||||||
| 
 | 
 | ||||||
|             /// Information on the master cross-signing keys of the queried users.
 |         /// Information on the master cross-signing keys of the queried users.
 | ||||||
|             #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] |         #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] | ||||||
|             pub master_keys: BTreeMap<OwnedUserId, Raw<CrossSigningKey>>, |         pub master_keys: BTreeMap<OwnedUserId, Raw<CrossSigningKey>>, | ||||||
| 
 | 
 | ||||||
|             /// Information on the self-signing keys of the queried users.
 |         /// Information on the self-signing keys of the queried users.
 | ||||||
|             #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] |         #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] | ||||||
|             pub self_signing_keys: BTreeMap<OwnedUserId, Raw<CrossSigningKey>>, |         pub self_signing_keys: BTreeMap<OwnedUserId, Raw<CrossSigningKey>>, | ||||||
| 
 | 
 | ||||||
|             /// Information on the user-signing keys of the queried users.
 |         /// Information on the user-signing keys of the queried users.
 | ||||||
|             #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] |         #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] | ||||||
|             pub user_signing_keys: BTreeMap<OwnedUserId, Raw<CrossSigningKey>>, |         pub user_signing_keys: BTreeMap<OwnedUserId, Raw<CrossSigningKey>>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl Request<'_> { |     impl Request<'_> { | ||||||
|  | |||||||
| @ -9,48 +9,48 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/keys/upload", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/keys/upload", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/keys/upload", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/keys/upload", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[request(error = crate::Error)] | ||||||
|         request: { |     #[derive(Default)] | ||||||
|             /// Identity keys for the device.
 |     pub struct Request { | ||||||
|             ///
 |         /// Identity keys for the device.
 | ||||||
|             /// May be absent if no new identity keys are required.
 |         ///
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         /// May be absent if no new identity keys are required.
 | ||||||
|             pub device_keys: Option<Raw<DeviceKeys>>, |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|  |         pub device_keys: Option<Raw<DeviceKeys>>, | ||||||
| 
 | 
 | ||||||
|             /// One-time public keys for "pre-key" messages.
 |         /// One-time public keys for "pre-key" messages.
 | ||||||
|             #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] |         #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] | ||||||
|             pub one_time_keys: BTreeMap<OwnedDeviceKeyId, Raw<OneTimeKey>>, |         pub one_time_keys: BTreeMap<OwnedDeviceKeyId, Raw<OneTimeKey>>, | ||||||
| 
 | 
 | ||||||
|             /// Fallback public keys for "pre-key" messages.
 |         /// Fallback public keys for "pre-key" messages.
 | ||||||
|             #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] |         #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] | ||||||
|             pub fallback_keys: BTreeMap<OwnedDeviceKeyId, Raw<OneTimeKey>>, |         pub fallback_keys: BTreeMap<OwnedDeviceKeyId, Raw<OneTimeKey>>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// For each key algorithm, the number of unclaimed one-time keys of that
 |     pub struct Response { | ||||||
|             /// type currently held on the server for this device.
 |         /// For each key algorithm, the number of unclaimed one-time keys of that
 | ||||||
|             pub one_time_key_counts: BTreeMap<DeviceKeyAlgorithm, UInt>, |         /// type currently held on the server for this device.
 | ||||||
|         } |         pub one_time_key_counts: BTreeMap<DeviceKeyAlgorithm, UInt>, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl Request { |     impl Request { | ||||||
|  | |||||||
| @ -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,31 +21,30 @@ 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", |         rate_limited: false, | ||||||
|             unstable_path: "/_matrix/client/unstable/keys/signatures/upload", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/keys/signatures/upload", |         history: { | ||||||
|             rate_limited: false, |             unstable => "/_matrix/client/unstable/keys/signatures/upload", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/keys/signatures/upload", | ||||||
|             added: 1.1, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// Signed keys.
 |     pub struct Request { | ||||||
|             #[ruma_api(body)] |         /// Signed keys.
 | ||||||
|             pub signed_keys: BTreeMap<OwnedUserId, SignedKeys>, |         #[ruma_api(body)] | ||||||
|         } |         pub signed_keys: BTreeMap<OwnedUserId, SignedKeys>, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[response(error = crate::Error)] | ||||||
|         response: { |     #[derive(Default)] | ||||||
|             /// Signature processing failures.
 |     pub struct Response { | ||||||
|             pub failures: BTreeMap<OwnedUserId, BTreeMap<String, Failure>>, |         /// Signature processing failures.
 | ||||||
|         } |         pub failures: BTreeMap<OwnedUserId, BTreeMap<String, Failure>>, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl Request { |     impl Request { | ||||||
|  | |||||||
| @ -5,53 +5,57 @@ 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", |         rate_limited: false, | ||||||
|             unstable_path: "/_matrix/client/unstable/keys/device_signing/upload", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/keys/device_signing/upload", |         history: { | ||||||
|             rate_limited: false, |             unstable => "/_matrix/client/unstable/keys/device_signing/upload", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/keys/device_signing/upload", | ||||||
|             added: 1.1, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[request(error = UiaaResponse)] | ||||||
|         request: { |     #[derive(Default)] | ||||||
|             /// Additional authentication information for the user-interactive authentication API.
 |     pub struct Request<'a> { | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         /// Additional authentication information for the user-interactive authentication API.
 | ||||||
|             pub auth: Option<AuthData<'a>>, |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|  |         pub auth: Option<AuthData<'a>>, | ||||||
| 
 | 
 | ||||||
|             /// The user's master key.
 |         /// The user's master key.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub master_key: Option<Raw<CrossSigningKey>>, |         pub master_key: Option<Raw<CrossSigningKey>>, | ||||||
| 
 | 
 | ||||||
|             /// The user's self-signing key.
 |         /// The user's self-signing key.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Must be signed with the accompanied master, or by the user's most recently uploaded
 |         /// Must be signed with the accompanied master, or by the user's most recently uploaded
 | ||||||
|             /// master key if no master key is included in the request.
 |         /// master key if no master key is included in the request.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub self_signing_key: Option<Raw<CrossSigningKey>>, |         pub self_signing_key: Option<Raw<CrossSigningKey>>, | ||||||
| 
 | 
 | ||||||
|             /// The user's user-signing key.
 |         /// The user's user-signing key.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Must be signed with the accompanied master, or by the user's most recently uploaded
 |         /// Must be signed with the accompanied master, or by the user's most recently uploaded
 | ||||||
|             /// master key if no master key is included in the request.
 |         /// master key if no master key is included in the request.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub user_signing_key: Option<Raw<CrossSigningKey>>, |         pub user_signing_key: Option<Raw<CrossSigningKey>>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: UiaaResponse |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = UiaaResponse)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     impl Request<'_> { |     impl Request<'_> { | ||||||
|         /// Creates an empty `Request`.
 |         /// Creates an empty `Request`.
 | ||||||
|         pub fn new() -> Self { |         pub fn new() -> Self { | ||||||
|  | |||||||
| @ -5,41 +5,45 @@ 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", |         rate_limited: true, | ||||||
|             unstable_path: "/_matrix/client/unstable/xyz.amorgan.knock/knock/:room_id_or_alias", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/knock/:room_id_or_alias", |         history: { | ||||||
|             rate_limited: true, |             unstable => "/_matrix/client/unstable/xyz.amorgan.knock/knock/:room_id_or_alias", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/knock/:room_id_or_alias", | ||||||
|             added: 1.1, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The room the user should knock on.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The room the user should knock on.
 | ||||||
|             pub room_id_or_alias: &'a RoomOrAliasId, |         #[ruma_api(path)] | ||||||
|  |         pub room_id_or_alias: &'a RoomOrAliasId, | ||||||
| 
 | 
 | ||||||
|             /// The reason for joining a room.
 |         /// The reason for joining a room.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub reason: Option<&'a str>, |         pub reason: Option<&'a str>, | ||||||
| 
 | 
 | ||||||
|             /// The servers to attempt to knock on the room through.
 |         /// The servers to attempt to knock on the room through.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// One of the servers must be participating in the room.
 |         /// One of the servers must be participating in the room.
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             #[serde(default, skip_serializing_if = "<[_]>::is_empty")] |         #[serde(default, skip_serializing_if = "<[_]>::is_empty")] | ||||||
|             pub server_name: &'a [OwnedServerName], |         pub server_name: &'a [OwnedServerName], | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// The room that the user knocked on.
 |     pub struct Response { | ||||||
|             pub room_id: OwnedRoomId, |         /// The room that the user knocked on.
 | ||||||
|         } |         pub room_id: OwnedRoomId, | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -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,66 +6,68 @@ 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", |         rate_limited: true, | ||||||
|             r0_path: "/_matrix/media/r0/upload", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/media/v3/upload", |         history: { | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/media/r0/upload", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/media/v3/upload", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The file contents to upload.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(raw_body)] |         /// The file contents to upload.
 | ||||||
|             pub file: &'a [u8], |         #[ruma_api(raw_body)] | ||||||
|  |         pub file: &'a [u8], | ||||||
| 
 | 
 | ||||||
|             /// The name of the file being uploaded.
 |         /// The name of the file being uploaded.
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub filename: Option<&'a str>, |         pub filename: Option<&'a str>, | ||||||
| 
 | 
 | ||||||
|             /// 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>, | ||||||
| 
 | 
 | ||||||
|             /// Should the server return a blurhash or not.
 |         /// Should the server return a blurhash or not.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// This uses the unstable prefix in
 |         /// This uses the unstable prefix in
 | ||||||
|             /// [MSC2448](https://github.com/matrix-org/matrix-spec-proposals/pull/2448).
 |         /// [MSC2448](https://github.com/matrix-org/matrix-spec-proposals/pull/2448).
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             #[cfg(feature = "unstable-msc2448")] |         #[cfg(feature = "unstable-msc2448")] | ||||||
|             #[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)] | ||||||
|             /// The MXC URI for the uploaded content.
 |     pub struct Response { | ||||||
|             pub content_uri: OwnedMxcUri, |         /// The MXC URI for the uploaded content.
 | ||||||
|  |         pub content_uri: OwnedMxcUri, | ||||||
| 
 | 
 | ||||||
|             /// The [BlurHash](https://blurha.sh) for the uploaded content.
 |         /// The [BlurHash](https://blurha.sh) for the uploaded content.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// This uses the unstable prefix in
 |         /// This uses the unstable prefix in
 | ||||||
|             /// [MSC2448](https://github.com/matrix-org/matrix-spec-proposals/pull/2448).
 |         /// [MSC2448](https://github.com/matrix-org/matrix-spec-proposals/pull/2448).
 | ||||||
|             #[cfg(feature = "unstable-msc2448")] |         #[cfg(feature = "unstable-msc2448")] | ||||||
|             #[serde(
 |         #[serde(
 | ||||||
|                 rename = "xyz.amorgan.blurhash", |             rename = "xyz.amorgan.blurhash", | ||||||
|                 alias = "blurhash", |             alias = "blurhash", | ||||||
|                 skip_serializing_if = "Option::is_none" |             skip_serializing_if = "Option::is_none" | ||||||
|             )] |         )] | ||||||
|             pub blurhash: Option<String>, |         pub blurhash: Option<String>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -6,43 +6,45 @@ 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", |         rate_limited: true, | ||||||
|             unstable_path: "/_matrix/media/unstable/fi.mau.msc2246/upload/:server_name/:media_id", |         authentication: AccessToken, | ||||||
|             rate_limited: true, |         history: { | ||||||
|             authentication: AccessToken, |             unstable => "/_matrix/media/unstable/fi.mau.msc2246/upload/:server_name/:media_id", | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The server name from the mxc:// URI (the authoritory component).
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The server name from the mxc:// URI (the authoritory component).
 | ||||||
|             pub server_name: &'a ServerName, |         #[ruma_api(path)] | ||||||
|  |         pub server_name: &'a ServerName, | ||||||
| 
 | 
 | ||||||
|             /// The media ID from the mxc:// URI (the path component).
 |         /// The media ID from the mxc:// URI (the path component).
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub media_id: &'a str, |         pub media_id: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// 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], | ||||||
| 
 | 
 | ||||||
|             /// 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: {} |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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(media_id: &'a str, server_name: &'a ServerName, file: &'a [u8]) -> Self { |         pub fn new(media_id: &'a str, server_name: &'a ServerName, file: &'a [u8]) -> Self { | ||||||
|  | |||||||
| @ -6,29 +6,33 @@ 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", |         rate_limited: true, | ||||||
|             unstable_path: "/_matrix/media/unstable/fi.mau.msc2246/create", |         authentication: AccessToken, | ||||||
|             rate_limited: true, |         history: { | ||||||
|             authentication: AccessToken, |             unstable => "/_matrix/media/unstable/fi.mau.msc2246/create", | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: {} |     #[request(error = crate::Error)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Request {} | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// The MXC URI for the about to be uploaded content.
 |     pub struct Response { | ||||||
|             pub content_uri: OwnedMxcUri, |         /// The MXC URI for the about to be uploaded content.
 | ||||||
|  |         pub content_uri: OwnedMxcUri, | ||||||
| 
 | 
 | ||||||
|             /// The time at which the URI will expire if an upload has not been started.
 |         /// The time at which the URI will expire if an upload has not been started.
 | ||||||
|             pub unused_expires_at: UInt, |         pub unused_expires_at: UInt, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl Response { |     impl Response { | ||||||
|  | |||||||
| @ -8,81 +8,85 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/media/r0/download/:server_name/:media_id", |         authentication: None, | ||||||
|             stable_path: "/_matrix/media/v3/download/:server_name/:media_id", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/media/r0/download/:server_name/:media_id", | ||||||
|             authentication: None, |             1.1 => "/_matrix/media/v3/download/:server_name/:media_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The server name from the mxc:// URI (the authoritory component).
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The server name from the mxc:// URI (the authoritory component).
 | ||||||
|             pub server_name: &'a ServerName, |         #[ruma_api(path)] | ||||||
|  |         pub server_name: &'a ServerName, | ||||||
| 
 | 
 | ||||||
|             /// The media ID from the mxc:// URI (the path component).
 |         /// The media ID from the mxc:// URI (the path component).
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub media_id: &'a str, |         pub media_id: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// Whether to fetch media deemed remote.
 |         /// Whether to fetch media deemed remote.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Used to prevent routing loops. Defaults to `true`.
 |         /// Used to prevent routing loops. Defaults to `true`.
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             #[serde(default = "ruma_common::serde::default_true", skip_serializing_if = "ruma_common::serde::is_true")] |         #[serde(
 | ||||||
|             pub allow_remote: bool, |             default = "ruma_common::serde::default_true", | ||||||
|  |             skip_serializing_if = "ruma_common::serde::is_true" | ||||||
|  |         )] | ||||||
|  |         pub allow_remote: bool, | ||||||
| 
 | 
 | ||||||
|  |         /// How long to wait for the media to be uploaded
 | ||||||
|  |         ///
 | ||||||
|  |         /// This uses the unstable prefix in
 | ||||||
|  |         /// [MSC2246](https://github.com/matrix-org/matrix-spec-proposals/pull/2246)
 | ||||||
|  |         #[ruma_api(query)] | ||||||
|  |         #[cfg(feature = "unstable-msc2246")] | ||||||
|  |         #[serde(
 | ||||||
|  |             default, | ||||||
|  |             skip_serializing_if = "ruma_common::serde::is_default", | ||||||
|  |             rename = "fi.mau.msc2246.max_stall_ms" | ||||||
|  |         )] | ||||||
|  |         pub max_stall_ms: Option<UInt>, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|             /// How long to wait for the media to be uploaded
 |     #[response(error = crate::Error)] | ||||||
|             ///
 |     pub struct Response { | ||||||
|             /// This uses the unstable prefix in
 |         /// The content that was previously uploaded.
 | ||||||
|             /// [MSC2246](https://github.com/matrix-org/matrix-spec-proposals/pull/2246)
 |         #[ruma_api(raw_body)] | ||||||
|             #[ruma_api(query)] |         pub file: Vec<u8>, | ||||||
|             #[cfg(feature = "unstable-msc2246")] |  | ||||||
|             #[serde(
 |  | ||||||
|                 default, |  | ||||||
|                 skip_serializing_if = "ruma_common::serde::is_default", |  | ||||||
|                 rename = "fi.mau.msc2246.max_stall_ms", |  | ||||||
|             )] |  | ||||||
|             pub max_stall_ms: Option<UInt>, |  | ||||||
|         } |  | ||||||
| 
 | 
 | ||||||
|         response: { |         /// The content type of the file that was previously uploaded.
 | ||||||
|             /// The content that was previously uploaded.
 |         #[ruma_api(header = CONTENT_TYPE)] | ||||||
|             #[ruma_api(raw_body)] |         pub content_type: Option<String>, | ||||||
|             pub file: Vec<u8>, |  | ||||||
| 
 | 
 | ||||||
|             /// The content type of the file that was previously uploaded.
 |         /// The value of the `Content-Disposition` HTTP header, possibly containing the name of the
 | ||||||
|             #[ruma_api(header = CONTENT_TYPE)] |         /// file that was previously uploaded.
 | ||||||
|             pub content_type: Option<String>, |         ///
 | ||||||
|  |         /// See [MDN] for the syntax.
 | ||||||
|  |         ///
 | ||||||
|  |         /// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#Syntax
 | ||||||
|  |         #[ruma_api(header = CONTENT_DISPOSITION)] | ||||||
|  |         pub content_disposition: Option<String>, | ||||||
| 
 | 
 | ||||||
|             /// The value of the `Content-Disposition` HTTP header, possibly containing the name of the
 |         /// The value of the `Cross-Origin-Resource-Policy` HTTP header.
 | ||||||
|             /// file that was previously uploaded.
 |         ///
 | ||||||
|             ///
 |         /// See [MDN] for the syntax.
 | ||||||
|             /// See [MDN] for the syntax.
 |         ///
 | ||||||
|             ///
 |         /// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Resource-Policy#syntax
 | ||||||
|             /// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#Syntax
 |         #[ruma_api(header = CROSS_ORIGIN_RESOURCE_POLICY)] | ||||||
|             #[ruma_api(header = CONTENT_DISPOSITION)] |         pub cross_origin_resource_policy: Option<String>, | ||||||
|             pub content_disposition: Option<String>, |  | ||||||
| 
 |  | ||||||
|             /// The value of the `Cross-Origin-Resource-Policy` HTTP header.
 |  | ||||||
|             ///
 |  | ||||||
|             /// See [MDN] for the syntax.
 |  | ||||||
|             ///
 |  | ||||||
|             /// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Resource-Policy#syntax
 |  | ||||||
|             #[ruma_api(header = CROSS_ORIGIN_RESOURCE_POLICY)] |  | ||||||
|             pub cross_origin_resource_policy: Option<String>, |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -6,71 +6,76 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/media/r0/download/:server_name/:media_id/:filename", |         authentication: None, | ||||||
|             stable_path: "/_matrix/media/v3/download/:server_name/:media_id/:filename", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/media/r0/download/:server_name/:media_id/:filename", | ||||||
|             authentication: None, |             1.1 => "/_matrix/media/v3/download/:server_name/:media_id/:filename", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The server name from the mxc:// URI (the authoritory component).
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The server name from the mxc:// URI (the authoritory component).
 | ||||||
|             pub server_name: &'a ServerName, |         #[ruma_api(path)] | ||||||
|  |         pub server_name: &'a ServerName, | ||||||
| 
 | 
 | ||||||
|             /// The media ID from the mxc:// URI (the path component).
 |         /// The media ID from the mxc:// URI (the path component).
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub media_id: &'a str, |         pub media_id: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// The filename to return in the `Content-Disposition` header.
 |         /// The filename to return in the `Content-Disposition` header.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub filename: &'a str, |         pub filename: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// Whether to fetch media deemed remote.
 |         /// Whether to fetch media deemed remote.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Used to prevent routing loops. Defaults to `true`.
 |         /// Used to prevent routing loops. Defaults to `true`.
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             #[serde(default = "ruma_common::serde::default_true", skip_serializing_if = "ruma_common::serde::is_true")] |         #[serde(
 | ||||||
|             pub allow_remote: bool, |             default = "ruma_common::serde::default_true", | ||||||
|         } |             skip_serializing_if = "ruma_common::serde::is_true" | ||||||
|  |         )] | ||||||
|  |         pub allow_remote: bool, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// The content that was previously uploaded.
 |     pub struct Response { | ||||||
|             #[ruma_api(raw_body)] |         /// The content that was previously uploaded.
 | ||||||
|             pub file: Vec<u8>, |         #[ruma_api(raw_body)] | ||||||
|  |         pub file: Vec<u8>, | ||||||
| 
 | 
 | ||||||
|             /// The content type of the file that was previously uploaded.
 |         /// The content type of the file that was previously uploaded.
 | ||||||
|             #[ruma_api(header = CONTENT_TYPE)] |         #[ruma_api(header = CONTENT_TYPE)] | ||||||
|             pub content_type: Option<String>, |         pub content_type: Option<String>, | ||||||
| 
 | 
 | ||||||
|             /// The value of the `Content-Disposition` HTTP header, possibly containing the name of the
 |         /// The value of the `Content-Disposition` HTTP header, possibly containing the name of the
 | ||||||
|             /// file that was previously uploaded.
 |         /// file that was previously uploaded.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// See [MDN] for the syntax.
 |         /// See [MDN] for the syntax.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#Syntax
 |         /// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#Syntax
 | ||||||
|             #[ruma_api(header = CONTENT_DISPOSITION)] |         #[ruma_api(header = CONTENT_DISPOSITION)] | ||||||
|             pub content_disposition: Option<String>, |         pub content_disposition: Option<String>, | ||||||
| 
 | 
 | ||||||
|             /// The value of the `Cross-Origin-Resource-Policy` HTTP header.
 |         /// The value of the `Cross-Origin-Resource-Policy` HTTP header.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// See [MDN] for the syntax.
 |         /// See [MDN] for the syntax.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Resource-Policy#syntax
 |         /// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Resource-Policy#syntax
 | ||||||
|             #[ruma_api(header = CROSS_ORIGIN_RESOURCE_POLICY)] |         #[ruma_api(header = CROSS_ORIGIN_RESOURCE_POLICY)] | ||||||
|             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> { | ||||||
|  | |||||||
| @ -7,88 +7,95 @@ 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", |         rate_limited: true, | ||||||
|             r0_path: "/_matrix/media/r0/thumbnail/:server_name/:media_id", |         authentication: None, | ||||||
|             stable_path: "/_matrix/media/v3/thumbnail/:server_name/:media_id", |         history: { | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/media/r0/thumbnail/:server_name/:media_id", | ||||||
|             authentication: None, |             1.1 => "/_matrix/media/v3/thumbnail/:server_name/:media_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The server name from the mxc:// URI (the authoritory component).
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The server name from the mxc:// URI (the authoritory component).
 | ||||||
|             pub server_name: &'a ServerName, |         #[ruma_api(path)] | ||||||
|  |         pub server_name: &'a ServerName, | ||||||
| 
 | 
 | ||||||
|             /// The media ID from the mxc:// URI (the path component).
 |         /// The media ID from the mxc:// URI (the path component).
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub media_id: &'a str, |         pub media_id: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// The desired resizing method.
 |         /// The desired resizing method.
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub method: Option<Method>, |         pub method: Option<Method>, | ||||||
| 
 | 
 | ||||||
|             /// The *desired* width of the thumbnail.
 |         /// The *desired* width of the thumbnail.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// The actual thumbnail may not match the size specified.
 |         /// The actual thumbnail may not match the size specified.
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             pub width: UInt, |         pub width: UInt, | ||||||
| 
 | 
 | ||||||
|             /// The *desired* height of the thumbnail.
 |         /// The *desired* height of the thumbnail.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// The actual thumbnail may not match the size specified.
 |         /// The actual thumbnail may not match the size specified.
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             pub height: UInt, |         pub height: UInt, | ||||||
| 
 | 
 | ||||||
|             /// Whether to fetch media deemed remote.
 |         /// Whether to fetch media deemed remote.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Used to prevent routing loops. Defaults to `true`.
 |         /// Used to prevent routing loops. Defaults to `true`.
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             #[serde(default = "ruma_common::serde::default_true", skip_serializing_if = "ruma_common::serde::is_true")] |         #[serde(
 | ||||||
|             pub allow_remote: bool, |             default = "ruma_common::serde::default_true", | ||||||
|  |             skip_serializing_if = "ruma_common::serde::is_true" | ||||||
|  |         )] | ||||||
|  |         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
 | ||||||
|             /// [MSC2246](https://github.com/matrix-org/matrix-spec-proposals/pull/2246)
 |         /// [MSC2246](https://github.com/matrix-org/matrix-spec-proposals/pull/2246)
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             #[cfg(feature = "unstable-msc2246")] |         #[cfg(feature = "unstable-msc2246")] | ||||||
|             #[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)] | ||||||
|             /// A thumbnail of the requested content.
 |     pub struct Response { | ||||||
|             #[ruma_api(raw_body)] |         /// A thumbnail of the requested content.
 | ||||||
|             pub file: Vec<u8>, |         #[ruma_api(raw_body)] | ||||||
|  |         pub file: Vec<u8>, | ||||||
| 
 | 
 | ||||||
|             /// The content type of the thumbnail.
 |         /// The content type of the thumbnail.
 | ||||||
|             #[ruma_api(header = CONTENT_TYPE)] |         #[ruma_api(header = CONTENT_TYPE)] | ||||||
|             pub content_type: Option<String>, |         pub content_type: Option<String>, | ||||||
| 
 | 
 | ||||||
|             /// The value of the `Cross-Origin-Resource-Policy` HTTP header.
 |         /// The value of the `Cross-Origin-Resource-Policy` HTTP header.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// See [MDN] for the syntax.
 |         /// See [MDN] for the syntax.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Resource-Policy#syntax
 |         /// [MDN]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Resource-Policy#syntax
 | ||||||
|             #[ruma_api(header = CROSS_ORIGIN_RESOURCE_POLICY)] |         #[ruma_api(header = CROSS_ORIGIN_RESOURCE_POLICY)] | ||||||
|             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> { | ||||||
|  | |||||||
| @ -6,30 +6,32 @@ 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, |         name: "get_media_config", | ||||||
|             r0_path: "/_matrix/media/r0/config", |         rate_limited: true, | ||||||
|             stable_path: "/_matrix/media/v3/config", |         authentication: AccessToken, | ||||||
|             name: "get_media_config", |         history: { | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/media/r0/config", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/media/v3/config", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[request(error = crate::Error)] | ||||||
|         request: {} |     #[derive(Default)] | ||||||
|  |     pub struct Request {} | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// Maximum size of upload in bytes.
 |     pub struct Response { | ||||||
|             #[serde(rename = "m.upload.size")] |         /// Maximum size of upload in bytes.
 | ||||||
|             pub upload_size: UInt, |         #[serde(rename = "m.upload.size")] | ||||||
|         } |         pub upload_size: UInt, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl Request { |     impl Request { | ||||||
|  | |||||||
| @ -5,43 +5,45 @@ 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.", |         method: GET, | ||||||
|             name: "get_media_preview", |         name: "get_media_preview", | ||||||
|             method: GET, |         rate_limited: true, | ||||||
|             r0_path: "/_matrix/media/r0/preview_url", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/media/v3/preview_url", |         history: { | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/media/r0/preview_url", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/media/v3/preview_url", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// URL to get a preview of.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(query)] |         /// URL to get a preview of.
 | ||||||
|             pub url: &'a str, |         #[ruma_api(query)] | ||||||
|  |         pub url: &'a str, | ||||||
| 
 | 
 | ||||||
|             /// Preferred point in time (in milliseconds) to return a preview for.
 |         /// Preferred point in time (in milliseconds) to return a preview for.
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             pub ts: MilliSecondsSinceUnixEpoch, |         pub ts: MilliSecondsSinceUnixEpoch, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[response(error = crate::Error)] | ||||||
|         response: { |     #[derive(Default)] | ||||||
|             /// OpenGraph-like data for the URL.
 |     pub struct Response { | ||||||
|             ///
 |         /// OpenGraph-like data for the URL.
 | ||||||
|             /// Differences from OpenGraph: the image size in bytes is added to the `matrix:image:size`
 |         ///
 | ||||||
|             /// field, and `og:image` returns the MXC URI to the image, if any.
 |         /// Differences from OpenGraph: the image size in bytes is added to the `matrix:image:size`
 | ||||||
|             #[ruma_api(body)] |         /// field, and `og:image` returns the MXC URI to the image, if any.
 | ||||||
|             pub data: Option<Box<RawJsonValue>>, |         #[ruma_api(body)] | ||||||
|         } |         pub data: Option<Box<RawJsonValue>>, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -5,39 +5,41 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/rooms/:room_id/ban", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/rooms/:room_id/ban", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/rooms/:room_id/ban", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/rooms/:room_id/ban", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The room to kick the user from.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The room to kick the user from.
 | ||||||
|             pub room_id: &'a RoomId, |         #[ruma_api(path)] | ||||||
|  |         pub room_id: &'a RoomId, | ||||||
| 
 | 
 | ||||||
|             /// The user to ban.
 |         /// The user to ban.
 | ||||||
|             pub user_id: &'a UserId, |         pub user_id: &'a UserId, | ||||||
| 
 | 
 | ||||||
|             /// The reason for banning the user.
 |         /// The reason for banning the user.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub reason: Option<&'a str>, |         pub reason: Option<&'a str>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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.
 | ||||||
|         pub fn new(room_id: &'a RoomId, user_id: &'a UserId) -> Self { |         pub fn new(room_id: &'a RoomId, user_id: &'a UserId) -> Self { | ||||||
|  | |||||||
| @ -5,32 +5,34 @@ 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", |         rate_limited: true, | ||||||
|             r0_path: "/_matrix/client/r0/rooms/:room_id/forget", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/rooms/:room_id/forget", |         history: { | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/rooms/:room_id/forget", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/rooms/:room_id/forget", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The room to forget.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The room to forget.
 | ||||||
|             pub room_id: &'a RoomId, |         #[ruma_api(path)] | ||||||
|         } |         pub room_id: &'a RoomId, | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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 { | ||||||
|  | |||||||
| @ -6,62 +6,62 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/rooms/:room_id/members", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/rooms/:room_id/members", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/rooms/:room_id/members", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/rooms/:room_id/members", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The room to get the member events for.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The room to get the member events for.
 | ||||||
|             pub room_id: &'a RoomId, |         #[ruma_api(path)] | ||||||
|  |         pub room_id: &'a RoomId, | ||||||
| 
 | 
 | ||||||
|             /// The point in time (pagination token) to return members for in the room.
 |         /// The point in time (pagination token) to return members for in the room.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// This token can be obtained from a prev_batch token returned for each room by the sync
 |         /// This token can be obtained from a prev_batch token returned for each room by the sync
 | ||||||
|             /// API.
 |         /// API.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             pub at: Option<&'a str>, |         pub at: Option<&'a str>, | ||||||
| 
 | 
 | ||||||
|             /// 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>, | ||||||
| 
 | 
 | ||||||
|             /// The kind of memberships to *exclude* from the results.
 |         /// The kind of memberships to *exclude* from the results.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Defaults to no filtering if unspecified.
 |         /// Defaults to no filtering if unspecified.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             pub not_membership: Option<MembershipEventFilter>, |         pub not_membership: Option<MembershipEventFilter>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// A list of member events.
 |     pub struct Response { | ||||||
|             pub chunk: Vec<Raw<RoomMemberEvent>>, |         /// A list of member events.
 | ||||||
|         } |         pub chunk: Vec<Raw<RoomMemberEvent>>, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -10,43 +10,47 @@ 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", |         rate_limited: true, | ||||||
|             r0_path: "/_matrix/client/r0/rooms/:room_id/invite", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/rooms/:room_id/invite", |         history: { | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/rooms/:room_id/invite", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/rooms/:room_id/invite", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The room where the user should be invited.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The room where the user should be invited.
 | ||||||
|             pub room_id: &'a RoomId, |         #[ruma_api(path)] | ||||||
|  |         pub room_id: &'a RoomId, | ||||||
| 
 | 
 | ||||||
|             /// The user to invite.
 |         /// The user to invite.
 | ||||||
|             #[serde(flatten)] |         #[serde(flatten)] | ||||||
|             pub recipient: InvitationRecipient<'a>, |         pub recipient: InvitationRecipient<'a>, | ||||||
| 
 | 
 | ||||||
|             /// Optional reason for inviting the user.
 |         /// Optional reason for inviting the user.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub reason: Option<&'a str>, |         pub reason: Option<&'a str>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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.
 | ||||||
|         pub fn new(room_id: &'a RoomId, recipient: InvitationRecipient<'a>) -> Self { |         pub fn new(room_id: &'a RoomId, recipient: InvitationRecipient<'a>) -> Self { | ||||||
|  | |||||||
| @ -5,43 +5,45 @@ 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", |         rate_limited: true, | ||||||
|             r0_path: "/_matrix/client/r0/rooms/:room_id/join", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/rooms/:room_id/join", |         history: { | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/rooms/:room_id/join", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/rooms/:room_id/join", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The room where the user should be invited.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The room where the user should be invited.
 | ||||||
|             pub room_id: &'a RoomId, |         #[ruma_api(path)] | ||||||
|  |         pub room_id: &'a RoomId, | ||||||
| 
 | 
 | ||||||
|             /// The signature of a `m.third_party_invite` token to prove that this user owns a third
 |         /// The signature of a `m.third_party_invite` token to prove that this user owns a third
 | ||||||
|             /// party identity which has been invited to the room.
 |         /// party identity which has been invited to the room.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub third_party_signed: Option<ThirdPartySigned<'a>>, |         pub third_party_signed: Option<ThirdPartySigned<'a>>, | ||||||
| 
 | 
 | ||||||
|             /// Optional reason for joining the room.
 |         /// Optional reason for joining the room.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub reason: Option<&'a str>, |         pub reason: Option<&'a str>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// The room that the user joined.
 |     pub struct Response { | ||||||
|             pub room_id: OwnedRoomId, |         /// The room that the user joined.
 | ||||||
|         } |         pub room_id: OwnedRoomId, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -5,50 +5,52 @@ 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", |         rate_limited: true, | ||||||
|             r0_path: "/_matrix/client/r0/join/:room_id_or_alias", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/join/:room_id_or_alias", |         history: { | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/join/:room_id_or_alias", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/join/:room_id_or_alias", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The room where the user should be invited.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The room where the user should be invited.
 | ||||||
|             pub room_id_or_alias: &'a RoomOrAliasId, |         #[ruma_api(path)] | ||||||
|  |         pub room_id_or_alias: &'a RoomOrAliasId, | ||||||
| 
 | 
 | ||||||
|             /// The servers to attempt to join the room through.
 |         /// The servers to attempt to join the room through.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// One of the servers  must be participating in the room.
 |         /// One of the servers  must be participating in the room.
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             #[serde(default, skip_serializing_if = "<[_]>::is_empty")] |         #[serde(default, skip_serializing_if = "<[_]>::is_empty")] | ||||||
|             pub server_name: &'a [OwnedServerName], |         pub server_name: &'a [OwnedServerName], | ||||||
| 
 | 
 | ||||||
|             /// The signature of a `m.third_party_invite` token to prove that this user owns a third
 |         /// The signature of a `m.third_party_invite` token to prove that this user owns a third
 | ||||||
|             /// party identity which has been invited to the room.
 |         /// party identity which has been invited to the room.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub third_party_signed: Option<ThirdPartySigned<'a>>, |         pub third_party_signed: Option<ThirdPartySigned<'a>>, | ||||||
| 
 | 
 | ||||||
|             /// Optional reason for joining the room.
 |         /// Optional reason for joining the room.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub reason: Option<&'a str>, |         pub reason: Option<&'a str>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// The room that the user joined.
 |     pub struct Response { | ||||||
|             pub room_id: OwnedRoomId, |         /// The room that the user joined.
 | ||||||
|         } |         pub room_id: OwnedRoomId, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -7,34 +7,36 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/rooms/:room_id/joined_members", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/rooms/:room_id/joined_members", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/rooms/:room_id/joined_members", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/rooms/:room_id/joined_members", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The room to get the members of.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The room to get the members of.
 | ||||||
|             pub room_id: &'a RoomId, |         #[ruma_api(path)] | ||||||
|         } |         pub room_id: &'a RoomId, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// A list of the rooms the user is in, i.e.
 |     pub struct Response { | ||||||
|             /// the ID of each room in which the user has joined membership.
 |         /// A list of the rooms the user is in, i.e.
 | ||||||
|             pub joined: BTreeMap<OwnedUserId, RoomMember>, |         /// the ID of each room in which the user has joined membership.
 | ||||||
|         } |         pub joined: BTreeMap<OwnedUserId, RoomMember>, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -5,30 +5,32 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/joined_rooms", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/joined_rooms", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/joined_rooms", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/joined_rooms", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[request(error = crate::Error)] | ||||||
|         request: {} |     #[derive(Default)] | ||||||
|  |     pub struct Request {} | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// A list of the rooms the user is in, i.e. the ID of each room in
 |     pub struct Response { | ||||||
|             /// which the user has joined membership.
 |         /// A list of the rooms the user is in, i.e. the ID of each room in
 | ||||||
|             pub joined_rooms: Vec<OwnedRoomId>, |         /// which the user has joined membership.
 | ||||||
|         } |         pub joined_rooms: Vec<OwnedRoomId>, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl Request { |     impl Request { | ||||||
|  | |||||||
| @ -5,39 +5,41 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/rooms/:room_id/kick", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/rooms/:room_id/kick", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/rooms/:room_id/kick", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/rooms/:room_id/kick", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The room to kick the user from.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The room to kick the user from.
 | ||||||
|             pub room_id: &'a RoomId, |         #[ruma_api(path)] | ||||||
|  |         pub room_id: &'a RoomId, | ||||||
| 
 | 
 | ||||||
|             /// The user to kick.
 |         /// The user to kick.
 | ||||||
|             pub user_id: &'a UserId, |         pub user_id: &'a UserId, | ||||||
| 
 | 
 | ||||||
|             /// The reason for kicking the user.
 |         /// The reason for kicking the user.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub reason: Option<&'a str>, |         pub reason: Option<&'a str>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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.
 | ||||||
|         pub fn new(room_id: &'a RoomId, user_id: &'a UserId) -> Self { |         pub fn new(room_id: &'a RoomId, user_id: &'a UserId) -> Self { | ||||||
|  | |||||||
| @ -5,36 +5,38 @@ 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", |         rate_limited: true, | ||||||
|             r0_path: "/_matrix/client/r0/rooms/:room_id/leave", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/rooms/:room_id/leave", |         history: { | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/rooms/:room_id/leave", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/rooms/:room_id/leave", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The room to leave.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The room to leave.
 | ||||||
|             pub room_id: &'a RoomId, |         #[ruma_api(path)] | ||||||
|  |         pub room_id: &'a RoomId, | ||||||
| 
 | 
 | ||||||
|             /// Optional reason to be included as the `reason` on the subsequent membership event.
 |         /// Optional reason to be included as the `reason` on the subsequent membership event.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub reason: Option<&'a str>, |         pub reason: Option<&'a str>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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,30 +5,33 @@ 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", |         rate_limited: true, | ||||||
|             unstable_path: "/_matrix/client/unstable/uk.half-shot.msc2666/user/mutual_rooms/:user_id", |         authentication: AccessToken, | ||||||
|             rate_limited: true, |         history: { | ||||||
|             authentication: AccessToken, |             unstable => "/_matrix/client/unstable/uk.half-shot.msc2666/user/mutual_rooms/:user_id", | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The user to search mutual rooms for.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The user to search mutual rooms for.
 | ||||||
|             pub user_id: &'a UserId, |         #[ruma_api(path)] | ||||||
|         } |         pub user_id: &'a UserId, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// A list of rooms the user is in together with the authenticated user.
 |     pub struct Response { | ||||||
|             pub joined: Vec<OwnedRoomId>, |         /// A list of rooms the user is in together with the authenticated user.
 | ||||||
|         } |         pub joined: Vec<OwnedRoomId>, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -5,39 +5,41 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/rooms/:room_id/unban", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/rooms/:room_id/unban", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/rooms/:room_id/unban", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/rooms/:room_id/unban", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The room to unban the user from.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The room to unban the user from.
 | ||||||
|             pub room_id: &'a RoomId, |         #[ruma_api(path)] | ||||||
|  |         pub room_id: &'a RoomId, | ||||||
| 
 | 
 | ||||||
|             /// The user to unban.
 |         /// The user to unban.
 | ||||||
|             pub user_id: &'a UserId, |         pub user_id: &'a UserId, | ||||||
| 
 | 
 | ||||||
|             /// Optional reason for unbanning the user.
 |         /// Optional reason for unbanning the user.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub reason: Option<&'a str>, |         pub reason: Option<&'a str>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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.
 | ||||||
|         pub fn new(room_id: &'a RoomId, user_id: &'a UserId) -> Self { |         pub fn new(room_id: &'a RoomId, user_id: &'a UserId) -> Self { | ||||||
|  | |||||||
| @ -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,83 +19,82 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/rooms/:room_id/messages", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/rooms/:room_id/messages", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/rooms/:room_id/messages", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/rooms/:room_id/messages", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The room to get events from.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The room to get events from.
 | ||||||
|             pub room_id: &'a RoomId, |         #[ruma_api(path)] | ||||||
|  |         pub room_id: &'a RoomId, | ||||||
| 
 | 
 | ||||||
|             /// The token to start returning events from.
 |         /// The token to start returning events from.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// This token can be obtained from a `prev_batch` token returned for each room by the
 |         /// This token can be obtained from a `prev_batch` token returned for each room by the
 | ||||||
|             /// sync endpoint, or from a `start` or `end` token returned by a previous request to
 |         /// sync endpoint, or from a `start` or `end` token returned by a previous request to
 | ||||||
|             /// this endpoint.
 |         /// this endpoint.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// If this is `None`, the server will return messages from the start or end of the
 |         /// If this is `None`, the server will return messages from the start or end of the
 | ||||||
|             /// history visible to the user, depending on the value of [`dir`][Self::dir].
 |         /// history visible to the user, depending on the value of [`dir`][Self::dir].
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             pub from: Option<&'a str>, |         pub from: Option<&'a str>, | ||||||
| 
 | 
 | ||||||
|             /// The token to stop returning events at.
 |         /// The token to stop returning events at.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// This token can be obtained from a `prev_batch` token returned for each room by the
 |         /// This token can be obtained from a `prev_batch` token returned for each room by the
 | ||||||
|             /// sync endpoint, or from a `start` or `end` token returned by a previous request to
 |         /// sync endpoint, or from a `start` or `end` token returned by a previous request to
 | ||||||
|             /// this endpoint.
 |         /// this endpoint.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             pub to: Option<&'a str>, |         pub to: Option<&'a str>, | ||||||
| 
 | 
 | ||||||
|             /// The direction to return events from.
 |         /// The direction to return events from.
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             pub dir: Direction, |         pub dir: Direction, | ||||||
| 
 | 
 | ||||||
|             /// The maximum number of events to return.
 |         /// The maximum number of events to return.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Default: `10`.
 |         /// Default: `10`.
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             #[serde(default = "default_limit", skip_serializing_if = "is_default_limit")] |         #[serde(default = "default_limit", skip_serializing_if = "is_default_limit")] | ||||||
|             pub limit: UInt, |         pub limit: UInt, | ||||||
| 
 | 
 | ||||||
|             /// A [`RoomEventFilter`] to filter returned events with.
 |         /// A [`RoomEventFilter`] to filter returned events with.
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             #[serde(
 |         #[serde(
 | ||||||
|                 with = "ruma_common::serde::json_string", |             with = "ruma_common::serde::json_string", | ||||||
|                 default, |             default, | ||||||
|                 skip_serializing_if = "RoomEventFilter::is_empty" |             skip_serializing_if = "RoomEventFilter::is_empty" | ||||||
|             )] |         )] | ||||||
|             pub filter: RoomEventFilter<'a>, |         pub filter: RoomEventFilter<'a>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[response(error = crate::Error)] | ||||||
|         response: { |     #[derive(Default)] | ||||||
|             /// The token the pagination starts from.
 |     pub struct Response { | ||||||
|             pub start: String, |         /// The token the pagination starts from.
 | ||||||
|  |         pub start: String, | ||||||
| 
 | 
 | ||||||
|             /// The token the pagination ends at.
 |         /// The token the pagination ends at.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub end: Option<String>, |         pub end: Option<String>, | ||||||
| 
 | 
 | ||||||
|             /// A list of room events.
 |         /// A list of room events.
 | ||||||
|             #[serde(default)] |         #[serde(default)] | ||||||
|             pub chunk: Vec<Raw<AnyTimelineEvent>>, |         pub chunk: Vec<Raw<AnyTimelineEvent>>, | ||||||
| 
 | 
 | ||||||
|             /// A list of state events relevant to showing the `chunk`.
 |         /// A list of state events relevant to showing the `chunk`.
 | ||||||
|             #[serde(default, skip_serializing_if = "Vec::is_empty")] |         #[serde(default, skip_serializing_if = "Vec::is_empty")] | ||||||
|             pub state: Vec<Raw<AnyStateEvent>>, |         pub state: Vec<Raw<AnyStateEvent>>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -6,68 +6,68 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/rooms/:room_id/send/:event_type/:txn_id", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/rooms/:room_id/send/:event_type/:txn_id", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/rooms/:room_id/send/:event_type/:txn_id", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/rooms/:room_id/send/:event_type/:txn_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The room to send the event to.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The room to send the event to.
 | ||||||
|             pub room_id: &'a RoomId, |         #[ruma_api(path)] | ||||||
|  |         pub room_id: &'a RoomId, | ||||||
| 
 | 
 | ||||||
|             /// The type of event to send.
 |         /// The type of event to send.
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub event_type: MessageLikeEventType, |         pub event_type: MessageLikeEventType, | ||||||
| 
 | 
 | ||||||
|             /// The transaction ID for this event.
 |         /// The transaction ID for this event.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Clients should generate a unique ID across requests within the
 |         /// Clients should generate a unique ID across requests within the
 | ||||||
|             /// same session. A session is identified by an access token, and
 |         /// same session. A session is identified by an access token, and
 | ||||||
|             /// persists when the [access token is refreshed].
 |         /// persists when the [access token is refreshed].
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// It will be used by the server to ensure idempotency of requests.
 |         /// It will be used by the server to ensure idempotency of requests.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// [access token is refreshed]: https://spec.matrix.org/v1.4/client-server-api/#refreshing-access-tokens
 |         /// [access token is refreshed]: https://spec.matrix.org/v1.4/client-server-api/#refreshing-access-tokens
 | ||||||
|             #[ruma_api(path)] |         #[ruma_api(path)] | ||||||
|             pub txn_id: &'a TransactionId, |         pub txn_id: &'a TransactionId, | ||||||
| 
 | 
 | ||||||
|             /// The event content to send.
 |         /// The event content to send.
 | ||||||
|             #[ruma_api(body)] |         #[ruma_api(body)] | ||||||
|             pub body: Raw<AnyMessageLikeEventContent>, |         pub body: Raw<AnyMessageLikeEventContent>, | ||||||
| 
 | 
 | ||||||
|             /// Timestamp to use for the `origin_server_ts` of the event.
 |         /// Timestamp to use for the `origin_server_ts` of the event.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// This is called [timestamp massaging] and can only be used by Appservices.
 |         /// This is called [timestamp massaging] and can only be used by Appservices.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// Note that this does not change the position of the event in the timeline.
 |         /// Note that this does not change the position of the event in the timeline.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// [timestamp massaging]: https://spec.matrix.org/v1.4/application-service-api/#timestamp-massaging
 |         /// [timestamp massaging]: https://spec.matrix.org/v1.4/application-service-api/#timestamp-massaging
 | ||||||
|             #[ruma_api(query)] |         #[ruma_api(query)] | ||||||
|             #[serde(skip_serializing_if = "Option::is_none", rename = "ts")] |         #[serde(skip_serializing_if = "Option::is_none", rename = "ts")] | ||||||
|             pub timestamp: Option<MilliSecondsSinceUnixEpoch>, |         pub timestamp: Option<MilliSecondsSinceUnixEpoch>, | ||||||
|         } |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// A unique identifier for the event.
 |     pub struct Response { | ||||||
|             pub event_id: OwnedEventId, |         /// A unique identifier for the event.
 | ||||||
|         } |         pub event_id: OwnedEventId, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -7,48 +7,52 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/presence/:user_id/status", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/presence/:user_id/status", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/presence/:user_id/status", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/presence/:user_id/status", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The user whose presence state will be retrieved.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The user whose presence state will be retrieved.
 | ||||||
|             pub user_id: &'a UserId, |         #[ruma_api(path)] | ||||||
|         } |         pub user_id: &'a UserId, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         response: { |     #[response(error = crate::Error)] | ||||||
|             /// The state message for this user if one was set.
 |     pub struct Response { | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         /// The state message for this user if one was set.
 | ||||||
|             pub status_msg: Option<String>, |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|  |         pub status_msg: Option<String>, | ||||||
| 
 | 
 | ||||||
|             /// Whether or not the user is currently active.
 |         /// Whether or not the user is currently active.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub currently_active: Option<bool>, |         pub currently_active: Option<bool>, | ||||||
| 
 | 
 | ||||||
|             /// The length of time in milliseconds since an action was performed by the user.
 |         /// The length of time in milliseconds since an action was performed by the user.
 | ||||||
|             #[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>, | ||||||
| 
 | 
 | ||||||
|             /// The user's presence state.
 |         /// The user's presence state.
 | ||||||
|             pub presence: PresenceState, |         pub presence: PresenceState, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -5,39 +5,43 @@ 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", |         rate_limited: true, | ||||||
|             r0_path: "/_matrix/client/r0/presence/:user_id/status", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/presence/:user_id/status", |         history: { | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/presence/:user_id/status", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/presence/:user_id/status", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The user whose presence state will be updated.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The user whose presence state will be updated.
 | ||||||
|             pub user_id: &'a UserId, |         #[ruma_api(path)] | ||||||
|  |         pub user_id: &'a UserId, | ||||||
| 
 | 
 | ||||||
|             /// The new presence state.
 |         /// The new presence state.
 | ||||||
|             pub presence: PresenceState, |         pub presence: PresenceState, | ||||||
| 
 | 
 | ||||||
|             /// The status message to attach to this state.
 |         /// The status message to attach to this state.
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|             pub status_msg: Option<&'a str>, |         pub status_msg: Option<&'a str>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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.
 | ||||||
|         pub fn new(user_id: &'a UserId, presence: PresenceState) -> Self { |         pub fn new(user_id: &'a UserId, presence: PresenceState) -> Self { | ||||||
|  | |||||||
| @ -5,49 +5,51 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/profile/:user_id/avatar_url", |         authentication: None, | ||||||
|             stable_path: "/_matrix/client/v3/profile/:user_id/avatar_url", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/profile/:user_id/avatar_url", | ||||||
|             authentication: None, |             1.1 => "/_matrix/client/v3/profile/:user_id/avatar_url", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The user whose avatar URL will be retrieved.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The user whose avatar URL will be retrieved.
 | ||||||
|             pub user_id: &'a UserId, |         #[ruma_api(path)] | ||||||
|         } |         pub user_id: &'a UserId, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[response(error = crate::Error)] | ||||||
|         response: { |     #[derive(Default)] | ||||||
|             /// The user's avatar URL, if set.
 |     pub struct Response { | ||||||
|             ///
 |         /// The user's avatar URL, if set.
 | ||||||
|             /// If you activate the `compat` feature, this field being an empty string in JSON will result
 |         ///
 | ||||||
|             /// in `None` here during deserialization.
 |         /// If you activate the `compat` feature, this field being an empty string in JSON will
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         /// result in `None` here during deserialization.
 | ||||||
|             #[cfg_attr(
 |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|                 feature = "compat", |         #[cfg_attr(
 | ||||||
|                 serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none") |             feature = "compat", | ||||||
|             )] |             serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none") | ||||||
|             pub avatar_url: Option<OwnedMxcUri>, |         )] | ||||||
|  |         pub avatar_url: Option<OwnedMxcUri>, | ||||||
| 
 | 
 | ||||||
|             /// 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`.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// This uses the unstable prefix in
 |         /// This uses the unstable prefix in
 | ||||||
|             /// [MSC2448](https://github.com/matrix-org/matrix-spec-proposals/pull/2448).
 |         /// [MSC2448](https://github.com/matrix-org/matrix-spec-proposals/pull/2448).
 | ||||||
|             #[cfg(feature = "unstable-msc2448")] |         #[cfg(feature = "unstable-msc2448")] | ||||||
|             #[serde(rename = "xyz.amorgan.blurhash", skip_serializing_if = "Option::is_none")] |         #[serde(rename = "xyz.amorgan.blurhash", skip_serializing_if = "Option::is_none")] | ||||||
|             pub blurhash: Option<String>, |         pub blurhash: Option<String>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -5,34 +5,36 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/profile/:user_id/displayname", |         authentication: None, | ||||||
|             stable_path: "/_matrix/client/v3/profile/:user_id/displayname", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/profile/:user_id/displayname", | ||||||
|             authentication: None, |             1.1 => "/_matrix/client/v3/profile/:user_id/displayname", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The user whose display name will be retrieved.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The user whose display name will be retrieved.
 | ||||||
|             pub user_id: &'a UserId, |         #[ruma_api(path)] | ||||||
|         } |         pub user_id: &'a UserId, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[response(error = crate::Error)] | ||||||
|         response: { |     #[derive(Default)] | ||||||
|             /// The user's display name, if set.
 |     pub struct Response { | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         /// The user's display name, if set.
 | ||||||
|             pub displayname: Option<String>, |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|         } |         pub displayname: Option<String>, | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -5,53 +5,55 @@ 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", |         rate_limited: false, | ||||||
|             r0_path: "/_matrix/client/r0/profile/:user_id", |         authentication: None, | ||||||
|             stable_path: "/_matrix/client/v3/profile/:user_id", |         history: { | ||||||
|             rate_limited: false, |             1.0 => "/_matrix/client/r0/profile/:user_id", | ||||||
|             authentication: None, |             1.1 => "/_matrix/client/v3/profile/:user_id", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The user whose profile will be retrieved.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The user whose profile will be retrieved.
 | ||||||
|             pub user_id: &'a UserId, |         #[ruma_api(path)] | ||||||
|         } |         pub user_id: &'a UserId, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|         #[derive(Default)] |     #[response(error = crate::Error)] | ||||||
|         response: { |     #[derive(Default)] | ||||||
|             /// The user's avatar URL, if set.
 |     pub struct Response { | ||||||
|             ///
 |         /// The user's avatar URL, if set.
 | ||||||
|             /// If you activate the `compat` feature, this field being an empty string in JSON will result
 |         ///
 | ||||||
|             /// in `None` here during deserialization.
 |         /// If you activate the `compat` feature, this field being an empty string in JSON will
 | ||||||
|             #[serde(skip_serializing_if = "Option::is_none")] |         /// result in `None` here during deserialization.
 | ||||||
|             #[cfg_attr(
 |         #[serde(skip_serializing_if = "Option::is_none")] | ||||||
|                 feature = "compat", |         #[cfg_attr(
 | ||||||
|                 serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none") |             feature = "compat", | ||||||
|             )] |             serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none") | ||||||
|             pub avatar_url: Option<OwnedMxcUri>, |         )] | ||||||
|  |         pub avatar_url: Option<OwnedMxcUri>, | ||||||
| 
 | 
 | ||||||
|             /// 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>, | ||||||
| 
 | 
 | ||||||
|             /// 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`.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// This uses the unstable prefix in
 |         /// This uses the unstable prefix in
 | ||||||
|             /// [MSC2448](https://github.com/matrix-org/matrix-spec-proposals/pull/2448).
 |         /// [MSC2448](https://github.com/matrix-org/matrix-spec-proposals/pull/2448).
 | ||||||
|             #[cfg(feature = "unstable-msc2448")] |         #[cfg(feature = "unstable-msc2448")] | ||||||
|             #[serde(rename = "xyz.amorgan.blurhash", skip_serializing_if = "Option::is_none")] |         #[serde(rename = "xyz.amorgan.blurhash", skip_serializing_if = "Option::is_none")] | ||||||
|             pub blurhash: Option<String>, |         pub blurhash: Option<String>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     impl<'a> Request<'a> { |     impl<'a> Request<'a> { | ||||||
|  | |||||||
| @ -5,60 +5,59 @@ 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", |         rate_limited: true, | ||||||
|             r0_path: "/_matrix/client/r0/profile/:user_id/avatar_url", |         authentication: AccessToken, | ||||||
|             stable_path: "/_matrix/client/v3/profile/:user_id/avatar_url", |         history: { | ||||||
|             rate_limited: true, |             1.0 => "/_matrix/client/r0/profile/:user_id/avatar_url", | ||||||
|             authentication: AccessToken, |             1.1 => "/_matrix/client/v3/profile/:user_id/avatar_url", | ||||||
|             added: 1.0, |  | ||||||
|         } |         } | ||||||
|  |     }; | ||||||
| 
 | 
 | ||||||
|         request: { |     #[request(error = crate::Error)] | ||||||
|             /// The user whose avatar URL will be set.
 |     pub struct Request<'a> { | ||||||
|             #[ruma_api(path)] |         /// The user whose avatar URL will be set.
 | ||||||
|             pub user_id: &'a UserId, |         #[ruma_api(path)] | ||||||
|  |         pub user_id: &'a UserId, | ||||||
| 
 | 
 | ||||||
|             /// The new avatar URL for the user.
 |         /// The new avatar URL for the user.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// `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( | ||||||
|                     default, |                 default, | ||||||
|                     deserialize_with = "ruma_common::serde::empty_string_as_none", |                 deserialize_with = "ruma_common::serde::empty_string_as_none", | ||||||
|                     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"), |         pub avatar_url: Option<&'a MxcUri>, | ||||||
|                 serde(skip_serializing_if = "Option::is_none") |  | ||||||
|             )] |  | ||||||
|             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`.
 | ||||||
|             ///
 |         ///
 | ||||||
|             /// This uses the unstable prefix in
 |         /// This uses the unstable prefix in
 | ||||||
|             /// [MSC2448](https://github.com/matrix-org/matrix-spec-proposals/pull/2448).
 |         /// [MSC2448](https://github.com/matrix-org/matrix-spec-proposals/pull/2448).
 | ||||||
|             #[cfg(feature = "unstable-msc2448")] |         #[cfg(feature = "unstable-msc2448")] | ||||||
|             #[serde(rename = "xyz.amorgan.blurhash", skip_serializing_if = "Option::is_none")] |         #[serde(rename = "xyz.amorgan.blurhash", skip_serializing_if = "Option::is_none")] | ||||||
|             pub blurhash: Option<&'a str>, |         pub blurhash: Option<&'a str>, | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         #[derive(Default)] |  | ||||||
|         response: {} |  | ||||||
| 
 |  | ||||||
|         error: crate::Error |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[response(error = crate::Error)] | ||||||
|  |     #[derive(Default)] | ||||||
|  |     pub struct Response {} | ||||||
|  | 
 | ||||||
|     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.
 | ||||||
|         pub fn new(user_id: &'a UserId, avatar_url: Option<&'a MxcUri>) -> Self { |         pub fn new(user_id: &'a UserId, avatar_url: Option<&'a MxcUri>) -> Self { | ||||||
|  | |||||||
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