Merge serde attributes and improve docs
This commit is contained in:
parent
271491732e
commit
aa5fdf9d22
@ -22,8 +22,10 @@ impl Parse for MetaValue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Like syn::MetaNameValue, but expects an identifier as the value. Also, we don't care about the
|
/// Like syn::MetaNameValue, but expects an identifier as the value.
|
||||||
/// the span of the equals sign, so we don't have the `eq_token` field from syn::MetaNameValue.
|
///
|
||||||
|
/// Also, we don't care about the the span of the equals sign, so we don't have the `eq_token` field
|
||||||
|
/// from syn::MetaNameValue.
|
||||||
pub struct MetaNameValue<V> {
|
pub struct MetaNameValue<V> {
|
||||||
/// The part left of the equals sign
|
/// The part left of the equals sign
|
||||||
pub name: Ident,
|
pub name: Ident,
|
||||||
@ -50,7 +52,9 @@ pub enum Meta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Meta {
|
impl Meta {
|
||||||
/// Check if the given attribute is a ruma_api attribute. If it is, parse it.
|
/// Check if the given attribute is a ruma_api attribute.
|
||||||
|
///
|
||||||
|
/// If it is, parse it.
|
||||||
pub fn from_attribute(attr: &syn::Attribute) -> syn::Result<Option<Self>> {
|
pub fn from_attribute(attr: &syn::Attribute) -> syn::Result<Option<Self>> {
|
||||||
if attr.path.is_ident("ruma_api") {
|
if attr.path.is_ident("ruma_api") {
|
||||||
attr.parse_args().map(Some)
|
attr.parse_args().map(Some)
|
||||||
|
@ -216,14 +216,16 @@ use error::{FromHttpRequestError, FromHttpResponseError, IntoHttpError};
|
|||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
#[allow(clippy::exhaustive_enums)]
|
#[allow(clippy::exhaustive_enums)]
|
||||||
pub enum SendAccessToken<'a> {
|
pub enum SendAccessToken<'a> {
|
||||||
/// Add the given access token to the request only if the `METADATA` on the request requires it
|
/// Add the given access token to the request only if the `METADATA` on the request requires
|
||||||
|
/// it.
|
||||||
IfRequired(&'a str),
|
IfRequired(&'a str),
|
||||||
|
|
||||||
/// Always add the access token
|
/// Always add the access token.
|
||||||
Always(&'a str),
|
Always(&'a str),
|
||||||
|
|
||||||
/// Don't add an access token. This will lead to an error if the request endpoint requires
|
/// Don't add an access token.
|
||||||
/// authentication
|
///
|
||||||
|
/// This will lead to an error if the request endpoint requires authentication
|
||||||
None,
|
None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,9 @@ pub struct Registration {
|
|||||||
/// A list of users, aliases and rooms namespaces that the application service controls.
|
/// A list of users, aliases and rooms namespaces that the application service controls.
|
||||||
pub namespaces: Namespaces,
|
pub namespaces: Namespaces,
|
||||||
|
|
||||||
/// Whether requests from masqueraded users are rate-limited. The sender is excluded.
|
/// Whether requests from masqueraded users are rate-limited.
|
||||||
|
///
|
||||||
|
/// The sender is excluded.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub rate_limited: Option<bool>,
|
pub rate_limited: Option<bool>,
|
||||||
|
|
||||||
@ -123,7 +125,9 @@ pub struct RegistrationInit {
|
|||||||
/// A list of users, aliases and rooms namespaces that the application service controls.
|
/// A list of users, aliases and rooms namespaces that the application service controls.
|
||||||
pub namespaces: Namespaces,
|
pub namespaces: Namespaces,
|
||||||
|
|
||||||
/// Whether requests from masqueraded users are rate-limited. The sender is excluded.
|
/// Whether requests from masqueraded users are rate-limited.
|
||||||
|
///
|
||||||
|
/// The sender is excluded.
|
||||||
pub rate_limited: Option<bool>,
|
pub rate_limited: Option<bool>,
|
||||||
|
|
||||||
/// The external protocols which the application service provides (e.g. IRC).
|
/// The external protocols which the application service provides (e.g. IRC).
|
||||||
|
@ -15,7 +15,9 @@ use serde_json::{from_slice as from_json_slice, Value as JsonValue};
|
|||||||
/// Separate module because it's a lot of code.
|
/// Separate module because it's a lot of code.
|
||||||
mod kind_serde;
|
mod kind_serde;
|
||||||
|
|
||||||
/// An enum for the error kind. Items may contain additional information.
|
/// An enum for the error kind.
|
||||||
|
///
|
||||||
|
/// Items may contain additional information.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub enum ErrorKind {
|
pub enum ErrorKind {
|
||||||
@ -25,7 +27,9 @@ pub enum ErrorKind {
|
|||||||
/// M_UNKNOWN_TOKEN
|
/// M_UNKNOWN_TOKEN
|
||||||
UnknownToken {
|
UnknownToken {
|
||||||
/// If this is `true`, the client can acquire a new access token by specifying the device
|
/// If this is `true`, the client can acquire a new access token by specifying the device
|
||||||
/// ID it is already using to the login API. For more information, see [the spec].
|
/// ID it is already using to the login API.
|
||||||
|
///
|
||||||
|
/// For more information, see [the spec].
|
||||||
///
|
///
|
||||||
/// [the spec]: https://matrix.org/docs/spec/client_server/r0.6.1#soft-logout
|
/// [the spec]: https://matrix.org/docs/spec/client_server/r0.6.1#soft-logout
|
||||||
soft_logout: bool,
|
soft_logout: bool,
|
||||||
|
@ -30,9 +30,10 @@ ruma_api! {
|
|||||||
#[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. Deprecated since r0.6.0.
|
/// Optional identity server hostname and access token.
|
||||||
#[serde(flatten)]
|
///
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
/// Deprecated since r0.6.0.
|
||||||
|
#[serde(flatten, skip_serializing_if = "Option::is_none")]
|
||||||
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,10 +41,12 @@ ruma_api! {
|
|||||||
/// The session identifier given by the identity server.
|
/// The session identifier given by the identity server.
|
||||||
pub sid: SessionIdBox,
|
pub sid: SessionIdBox,
|
||||||
|
|
||||||
/// URL to submit validation token to. If omitted, verification happens without client.
|
/// URL to submit validation token to.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will give
|
/// If omitted, verification happens without client.
|
||||||
/// you `None` here.
|
///
|
||||||
|
/// 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")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "compat",
|
feature = "compat",
|
||||||
|
@ -33,9 +33,10 @@ ruma_api! {
|
|||||||
#[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. Deprecated since r0.6.0.
|
/// Optional identity server hostname and access token.
|
||||||
#[serde(flatten)]
|
///
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
/// Deprecated since r0.6.0.
|
||||||
|
#[serde(flatten, skip_serializing_if = "Option::is_none")]
|
||||||
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,10 +44,12 @@ ruma_api! {
|
|||||||
/// The session identifier given by the identity server.
|
/// The session identifier given by the identity server.
|
||||||
pub sid: SessionIdBox,
|
pub sid: SessionIdBox,
|
||||||
|
|
||||||
/// URL to submit validation token to. If omitted, verification happens without client.
|
/// URL to submit validation token to.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will give
|
/// If omitted, verification happens without client.
|
||||||
/// you `None` here.
|
///
|
||||||
|
/// 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")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "compat",
|
feature = "compat",
|
||||||
|
@ -30,9 +30,10 @@ ruma_api! {
|
|||||||
#[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. Deprecated since r0.6.0.
|
/// Optional identity server hostname and access token.
|
||||||
#[serde(flatten)]
|
///
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
/// Deprecated since r0.6.0.
|
||||||
|
#[serde(flatten, skip_serializing_if = "Option::is_none")]
|
||||||
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,10 +41,12 @@ ruma_api! {
|
|||||||
/// The session identifier given by the identity server.
|
/// The session identifier given by the identity server.
|
||||||
pub sid: SessionIdBox,
|
pub sid: SessionIdBox,
|
||||||
|
|
||||||
/// URL to submit validation token to. If omitted, verification happens without client.
|
/// URL to submit validation token to.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will give
|
/// If omitted, verification happens without client.
|
||||||
/// you `None` here.
|
///
|
||||||
|
/// 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")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "compat",
|
feature = "compat",
|
||||||
|
@ -36,10 +36,12 @@ ruma_api! {
|
|||||||
/// The session identifier given by the identity server.
|
/// The session identifier given by the identity server.
|
||||||
pub sid: SessionIdBox,
|
pub sid: SessionIdBox,
|
||||||
|
|
||||||
/// URL to submit validation token to. If omitted, verification happens without client.
|
/// URL to submit validation token to.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will give
|
/// If omitted, verification happens without client.
|
||||||
/// you `None` here.
|
///
|
||||||
|
/// 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")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "compat",
|
feature = "compat",
|
||||||
|
@ -30,9 +30,10 @@ ruma_api! {
|
|||||||
#[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. Deprecated since r0.6.0.
|
/// Optional identity server hostname and access token.
|
||||||
#[serde(flatten)]
|
///
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
/// Deprecated since r0.6.0.
|
||||||
|
#[serde(flatten, skip_serializing_if = "Option::is_none")]
|
||||||
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,10 +41,12 @@ ruma_api! {
|
|||||||
/// The session identifier given by the identity server.
|
/// The session identifier given by the identity server.
|
||||||
pub sid: SessionIdBox,
|
pub sid: SessionIdBox,
|
||||||
|
|
||||||
/// URL to submit validation token to. If omitted, verification happens without client.
|
/// URL to submit validation token to.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will give
|
/// If omitted, verification happens without client.
|
||||||
/// you `None` here.
|
///
|
||||||
|
/// 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")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "compat",
|
feature = "compat",
|
||||||
|
@ -33,9 +33,10 @@ ruma_api! {
|
|||||||
#[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. Deprecated since r0.6.0.
|
/// Optional identity server hostname and access token.
|
||||||
#[serde(flatten)]
|
///
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
/// Deprecated since r0.6.0.
|
||||||
|
#[serde(flatten, skip_serializing_if = "Option::is_none")]
|
||||||
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
pub identity_server_info: Option<IdentityServerInfo<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,10 +44,12 @@ ruma_api! {
|
|||||||
/// The session identifier given by the identity server.
|
/// The session identifier given by the identity server.
|
||||||
pub sid: SessionIdBox,
|
pub sid: SessionIdBox,
|
||||||
|
|
||||||
/// URL to submit validation token to. If omitted, verification happens without client.
|
/// URL to submit validation token to.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will give
|
/// If omitted, verification happens without client.
|
||||||
/// you `None` here.
|
///
|
||||||
|
/// 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")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "compat",
|
feature = "compat",
|
||||||
|
@ -17,7 +17,9 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
request: {
|
request: {
|
||||||
/// The backup version. Must be the current backup.
|
/// The backup version.
|
||||||
|
///
|
||||||
|
/// Must be the current backup.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub version: &'a str,
|
pub version: &'a str,
|
||||||
|
|
||||||
@ -35,8 +37,10 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
/// An opaque string representing stored keys in the backup. Clients can compare it with
|
/// An opaque string representing stored keys in the backup.
|
||||||
/// 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
|
||||||
|
/// key storage request.
|
||||||
pub etag: String,
|
pub etag: String,
|
||||||
|
|
||||||
/// The number of keys stored in the backup.
|
/// The number of keys stored in the backup.
|
||||||
|
@ -19,7 +19,9 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
request: {
|
request: {
|
||||||
/// The backup version. Must be the current backup.
|
/// The backup version.
|
||||||
|
///
|
||||||
|
/// Must be the current backup.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub version: &'a str,
|
pub version: &'a str,
|
||||||
|
|
||||||
@ -32,8 +34,10 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
/// An opaque string representing stored keys in the backup. Clients can compare it with
|
/// An opaque string representing stored keys in the backup.
|
||||||
/// 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
|
||||||
|
/// key storage request.
|
||||||
pub etag: String,
|
pub etag: String,
|
||||||
|
|
||||||
/// The number of keys stored in the backup.
|
/// The number of keys stored in the backup.
|
||||||
|
@ -19,7 +19,9 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
request: {
|
request: {
|
||||||
/// The backup version. Must be the current backup.
|
/// The backup version.
|
||||||
|
///
|
||||||
|
/// Must be the current backup.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub version: &'a str,
|
pub version: &'a str,
|
||||||
|
|
||||||
@ -28,8 +30,10 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
/// An opaque string representing stored keys in the backup. Clients can compare it with
|
/// An opaque string representing stored keys in the backup.
|
||||||
/// 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
|
||||||
|
/// key storage request.
|
||||||
pub etag: String,
|
pub etag: String,
|
||||||
|
|
||||||
/// The number of keys stored in the backup.
|
/// The number of keys stored in the backup.
|
||||||
|
@ -21,7 +21,7 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
/// The backup version. This is an opaque string.
|
/// The backup version.
|
||||||
pub version: String,
|
pub version: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,9 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
request: {
|
request: {
|
||||||
/// The backup version. Must be the current backup.
|
/// The backup version.
|
||||||
|
///
|
||||||
|
/// Must be the current backup.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub version: &'a str,
|
pub version: &'a str,
|
||||||
|
|
||||||
@ -29,8 +31,10 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
/// An opaque string representing stored keys in the backup. Clients can compare it with
|
/// An opaque string representing stored keys in the backup.
|
||||||
/// 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
|
||||||
|
/// key storage request.
|
||||||
pub etag: String,
|
pub etag: String,
|
||||||
|
|
||||||
/// The number of keys stored in the backup.
|
/// The number of keys stored in the backup.
|
||||||
|
@ -15,7 +15,9 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
request: {
|
request: {
|
||||||
/// The backup version. Must be the current backup.
|
/// The backup version.
|
||||||
|
///
|
||||||
|
/// Must be the current backup.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub version: &'a str,
|
pub version: &'a str,
|
||||||
|
|
||||||
@ -25,8 +27,10 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
/// An opaque string representing stored keys in the backup. Clients can compare it with
|
/// An opaque string representing stored keys in the backup.
|
||||||
/// 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
|
||||||
|
/// key storage request.
|
||||||
pub etag: String,
|
pub etag: String,
|
||||||
|
|
||||||
/// The number of keys stored in the backup.
|
/// The number of keys stored in the backup.
|
||||||
|
@ -14,14 +14,18 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
request: {
|
request: {
|
||||||
/// The backup version. Must be the current backup.
|
/// The backup version.
|
||||||
|
///
|
||||||
|
/// Must be the current backup.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub version: &'a str,
|
pub version: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
/// An opaque string representing stored keys in the backup. Clients can compare it with
|
/// An opaque string representing stored keys in the backup.
|
||||||
/// 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
|
||||||
|
/// key storage request.
|
||||||
pub etag: String,
|
pub etag: String,
|
||||||
|
|
||||||
/// The number of keys stored in the backup.
|
/// The number of keys stored in the backup.
|
||||||
|
@ -29,11 +29,13 @@ ruma_api! {
|
|||||||
/// 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. Clients can compare it with
|
/// An opaque string representing stored keys in the backup.
|
||||||
/// 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
|
||||||
|
/// key storage request.
|
||||||
pub etag: String,
|
pub etag: String,
|
||||||
|
|
||||||
/// The backup version. This is an opaque string.
|
/// The backup version.
|
||||||
pub version: String,
|
pub version: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,9 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
request: {
|
request: {
|
||||||
/// The backup version. Must be the current backup.
|
/// The backup version.
|
||||||
|
///
|
||||||
|
/// Must be the current backup.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub version: &'a str,
|
pub version: &'a str,
|
||||||
|
|
||||||
|
@ -18,7 +18,9 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
request: {
|
request: {
|
||||||
/// The backup version. Must be the current backup.
|
/// The backup version
|
||||||
|
///
|
||||||
|
/// Must be the current backup.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub version: &'a str,
|
pub version: &'a str,
|
||||||
|
|
||||||
|
@ -18,7 +18,9 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
request: {
|
request: {
|
||||||
/// The backup version. Must be the current backup.
|
/// The backup version.
|
||||||
|
///
|
||||||
|
/// Must be the current backup.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub version: &'a str,
|
pub version: &'a str,
|
||||||
}
|
}
|
||||||
|
@ -26,11 +26,13 @@ ruma_api! {
|
|||||||
/// 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 represetning stored keys in the backup. Clients can compare it with
|
/// An opaque string representing stored keys in the backup.
|
||||||
/// 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
|
||||||
|
/// key storage request.
|
||||||
pub etag: String,
|
pub etag: String,
|
||||||
|
|
||||||
/// The backup version. This is an opaque string.
|
/// The backup version.
|
||||||
pub version: String,
|
pub version: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,9 @@ ruma_api! {
|
|||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub device_id: &'a DeviceId,
|
pub device_id: &'a DeviceId,
|
||||||
|
|
||||||
/// The new display name for this device. If this is `None`, the display name won't be
|
/// The new display name for this device.
|
||||||
/// 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<String>,
|
pub display_name: Option<String>,
|
||||||
}
|
}
|
||||||
|
@ -47,8 +47,8 @@ pub struct PublicRoomsChunk {
|
|||||||
|
|
||||||
/// The URL for the room's avatar, if one is set.
|
/// The URL for the room's avatar, if one is set.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will give
|
/// If you activate the `compat` feature, this field being an empty string in JSON will result
|
||||||
/// you `None` here.
|
/// 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",
|
||||||
|
@ -13,8 +13,10 @@ pub enum LazyLoadOptions {
|
|||||||
|
|
||||||
/// Enables lazy-loading of events.
|
/// Enables lazy-loading of events.
|
||||||
Enabled {
|
Enabled {
|
||||||
/// If `true`, sends all membership events for all events, even if they have
|
/// If `true`, sends all membership events for all events, even if they have already been
|
||||||
/// already been sent to the client. Defaults to `false`.
|
/// sent to the client.
|
||||||
|
///
|
||||||
|
/// Defaults to `false`.
|
||||||
include_redundant_members: bool,
|
include_redundant_members: bool,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,9 @@ ruma_api! {
|
|||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
request: {
|
request: {
|
||||||
/// The time (in milliseconds) to wait when downloading keys from remote
|
/// The time (in milliseconds) to wait when downloading keys from remote servers.
|
||||||
/// servers. 10 seconds is the recommended default.
|
///
|
||||||
|
/// 10 seconds is the recommended default.
|
||||||
#[serde(
|
#[serde(
|
||||||
with = "ruma_serde::duration::opt_ms",
|
with = "ruma_serde::duration::opt_ms",
|
||||||
default,
|
default,
|
||||||
@ -31,24 +32,25 @@ ruma_api! {
|
|||||||
)]
|
)]
|
||||||
pub timeout: Option<Duration>,
|
pub timeout: Option<Duration>,
|
||||||
|
|
||||||
/// The keys to be downloaded. An empty list indicates all devices for
|
/// The keys to be downloaded.
|
||||||
/// the corresponding user.
|
///
|
||||||
|
/// An empty list indicates all devices for the corresponding user.
|
||||||
pub device_keys: BTreeMap<UserId, Vec<DeviceIdBox>>,
|
pub device_keys: BTreeMap<UserId, Vec<DeviceIdBox>>,
|
||||||
|
|
||||||
/// If the client is fetching keys as a result of a device update
|
/// If the client is fetching keys as a result of a device update received in a sync
|
||||||
/// received in a sync request, this should be the 'since' token of that
|
/// request, this should be the 'since' token of that sync request, or any later sync token.
|
||||||
/// sync request, or any later sync token. This allows the server to
|
///
|
||||||
/// ensure its response contains the keys advertised by the notification
|
/// This allows the server to ensure its response contains the keys advertised by the
|
||||||
/// in that sync.
|
/// notification in that sync.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub token: Option<&'a str>,
|
pub token: Option<&'a str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
response: {
|
response: {
|
||||||
/// If any remote homeservers could not be reached, they are recorded
|
/// If any remote homeservers could not be reached, they are recorded here.
|
||||||
/// here. The names of the properties are the names of the unreachable
|
///
|
||||||
/// servers.
|
/// The names of the properties are the names of the unreachable servers.
|
||||||
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
||||||
pub failures: BTreeMap<String, JsonValue>,
|
pub failures: BTreeMap<String, JsonValue>,
|
||||||
|
|
||||||
|
@ -19,7 +19,9 @@ ruma_api! {
|
|||||||
|
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
request: {
|
request: {
|
||||||
/// Identity keys for the device. May be absent if no new identity keys are required.
|
/// Identity keys for the device.
|
||||||
|
///
|
||||||
|
/// May be absent if no new identity keys are required.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub device_keys: Option<DeviceKeys>,
|
pub device_keys: Option<DeviceKeys>,
|
||||||
|
|
||||||
|
@ -27,13 +27,17 @@ ruma_api! {
|
|||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub master_key: Option<CrossSigningKey>,
|
pub master_key: Option<CrossSigningKey>,
|
||||||
|
|
||||||
/// The user's self-signing key. Must be signed with the accompanied master, or by the
|
/// The user's self-signing key.
|
||||||
/// user's most recently uploaded master key if no master key is included in the request.
|
///
|
||||||
|
/// 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.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub self_signing_key: Option<CrossSigningKey>,
|
pub self_signing_key: Option<CrossSigningKey>,
|
||||||
|
|
||||||
/// The user's user-signing key. Must be signed with the accompanied master, or by the
|
/// The user's user-signing key.
|
||||||
/// user's most recently uploaded master key if no master key is included in the request.
|
///
|
||||||
|
/// 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.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub user_signing_key: Option<CrossSigningKey>,
|
pub user_signing_key: Option<CrossSigningKey>,
|
||||||
}
|
}
|
||||||
|
@ -46,8 +46,7 @@ ruma_api! {
|
|||||||
/// This uses the unstable prefix in
|
/// This uses the unstable prefix in
|
||||||
/// [MSC2448](https://github.com/matrix-org/matrix-doc/pull/2448).
|
/// [MSC2448](https://github.com/matrix-org/matrix-doc/pull/2448).
|
||||||
#[cfg(feature = "unstable-pre-spec")]
|
#[cfg(feature = "unstable-pre-spec")]
|
||||||
#[serde(rename = "xyz.amorgan.blurhash")]
|
#[serde(rename = "xyz.amorgan.blurhash", skip_serializing_if = "Option::is_none")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub blurhash: Option<String>,
|
pub blurhash: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,13 +29,15 @@ ruma_api! {
|
|||||||
#[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 actual thumbnail may not match the size
|
/// The *desired* width of the thumbnail.
|
||||||
/// 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 actual thumbnail may not match the size
|
/// The *desired* height of the thumbnail.
|
||||||
/// specified.
|
///
|
||||||
|
/// The actual thumbnail may not match the size specified.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
pub height: UInt,
|
pub height: UInt,
|
||||||
|
|
||||||
|
@ -20,21 +20,26 @@ ruma_api! {
|
|||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub room_id: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
|
|
||||||
/// The point in time (pagination token) to return members for in the room. This token can
|
/// The point in time (pagination token) to return members for in the room.
|
||||||
/// be obtained from a prev_batch token returned for each room by the sync API.
|
///
|
||||||
|
/// This token can be obtained from a prev_batch token returned for each room by the sync
|
||||||
|
/// 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. Defaults to no filtering if unspecified. When
|
/// The kind of memberships to filter for.
|
||||||
/// specified alongside not_membership, the two parameters create an 'or' condition: either
|
///
|
||||||
/// the membership is the same as membership or is not the same as not_membership.
|
/// 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
|
||||||
|
/// 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. Defaults to no filtering if
|
/// The kind of memberships to *exclude* from the results.
|
||||||
/// 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>,
|
||||||
|
@ -20,8 +20,9 @@ ruma_api! {
|
|||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub room_id_or_alias: &'a RoomIdOrAliasId,
|
pub room_id_or_alias: &'a RoomIdOrAliasId,
|
||||||
|
|
||||||
/// The servers to attempt to join the room through. One of the servers
|
/// The servers to attempt to join the room through.
|
||||||
/// 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 [ServerNameBox],
|
pub server_name: &'a [ServerNameBox],
|
||||||
|
@ -55,8 +55,8 @@ pub struct RoomMember {
|
|||||||
|
|
||||||
/// The mxc avatar url of the user.
|
/// The mxc avatar url of the user.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will give
|
/// If you activate the `compat` feature, this field being an empty string in JSON will result
|
||||||
/// you `None` here.
|
/// 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",
|
||||||
|
@ -23,8 +23,8 @@ ruma_api! {
|
|||||||
response: {
|
response: {
|
||||||
/// The user's avatar URL, if set.
|
/// The user's avatar URL, if set.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will give
|
/// If you activate the `compat` feature, this field being an empty string in JSON will result
|
||||||
/// you `None` here.
|
/// 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",
|
||||||
@ -37,8 +37,7 @@ ruma_api! {
|
|||||||
/// This uses the unstable prefix in
|
/// This uses the unstable prefix in
|
||||||
/// [MSC2448](https://github.com/matrix-org/matrix-doc/pull/2448).
|
/// [MSC2448](https://github.com/matrix-org/matrix-doc/pull/2448).
|
||||||
#[cfg(feature = "unstable-pre-spec")]
|
#[cfg(feature = "unstable-pre-spec")]
|
||||||
#[serde(rename = "xyz.amorgan.blurhash")]
|
#[serde(rename = "xyz.amorgan.blurhash", skip_serializing_if = "Option::is_none")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub blurhash: Option<String>,
|
pub blurhash: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@ ruma_api! {
|
|||||||
response: {
|
response: {
|
||||||
/// The user's avatar URL, if set.
|
/// The user's avatar URL, if set.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will give
|
/// If you activate the `compat` feature, this field being an empty string in JSON will result
|
||||||
/// you `None` here.
|
/// 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",
|
||||||
@ -41,8 +41,7 @@ ruma_api! {
|
|||||||
/// This uses the unstable prefix in
|
/// This uses the unstable prefix in
|
||||||
/// [MSC2448](https://github.com/matrix-org/matrix-doc/pull/2448).
|
/// [MSC2448](https://github.com/matrix-org/matrix-doc/pull/2448).
|
||||||
#[cfg(feature = "unstable-pre-spec")]
|
#[cfg(feature = "unstable-pre-spec")]
|
||||||
#[serde(rename = "xyz.amorgan.blurhash")]
|
#[serde(rename = "xyz.amorgan.blurhash", skip_serializing_if = "Option::is_none")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub blurhash: Option<String>,
|
pub blurhash: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ ruma_api! {
|
|||||||
///
|
///
|
||||||
/// `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 give
|
/// If you activate the `compat` feature, this field being an empty string in JSON will result
|
||||||
/// you `None` here.
|
/// in `None` here during deserialization.
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "compat",
|
feature = "compat",
|
||||||
serde(
|
serde(
|
||||||
@ -43,8 +43,7 @@ ruma_api! {
|
|||||||
/// This uses the unstable prefix in
|
/// This uses the unstable prefix in
|
||||||
/// [MSC2448](https://github.com/matrix-org/matrix-doc/pull/2448).
|
/// [MSC2448](https://github.com/matrix-org/matrix-doc/pull/2448).
|
||||||
#[cfg(feature = "unstable-pre-spec")]
|
#[cfg(feature = "unstable-pre-spec")]
|
||||||
#[serde(rename = "xyz.amorgan.blurhash")]
|
#[serde(rename = "xyz.amorgan.blurhash", skip_serializing_if = "Option::is_none")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub blurhash: Option<&'a str>,
|
pub blurhash: Option<&'a str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ pub mod set_pushrule;
|
|||||||
pub mod set_pushrule_actions;
|
pub mod set_pushrule_actions;
|
||||||
pub mod set_pushrule_enabled;
|
pub mod set_pushrule_enabled;
|
||||||
|
|
||||||
/// Like `SimplePushRule`, but may represent any kind of push rule
|
/// Like `SimplePushRule`, but may represent any kind of push rule thanks to `pattern` and
|
||||||
/// thanks to `pattern` and `conditions` being optional.
|
/// `conditions` being optional.
|
||||||
///
|
///
|
||||||
/// To create an instance of this type, use one of its `From` implementations.
|
/// To create an instance of this type, use one of its `From` implementations.
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
@ -41,13 +41,15 @@ pub struct PushRule {
|
|||||||
pub rule_id: String,
|
pub rule_id: String,
|
||||||
|
|
||||||
/// The conditions that must hold true for an event in order for a rule to be applied to an
|
/// The conditions that must hold true for an event in order for a rule to be applied to an
|
||||||
/// event. A rule with no conditions always matches.
|
/// event.
|
||||||
///
|
///
|
||||||
/// Only applicable to underride and override rules.
|
/// A rule with no conditions always matches. Only applicable to underride and override rules.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub conditions: Option<Vec<PushCondition>>,
|
pub conditions: Option<Vec<PushCondition>>,
|
||||||
|
|
||||||
/// The glob-style pattern to match against. Only applicable to content rules.
|
/// The glob-style pattern to match against.
|
||||||
|
///
|
||||||
|
/// Only applicable to content rules.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub pattern: Option<String>,
|
pub pattern: Option<String>,
|
||||||
}
|
}
|
||||||
|
@ -30,16 +30,20 @@ ruma_api! {
|
|||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub limit: Option<UInt>,
|
pub limit: Option<UInt>,
|
||||||
|
|
||||||
/// Allows basic filtering of events returned. Supply "highlight" to return only events
|
/// Allows basic filtering of events returned.
|
||||||
/// where the notification had the 'highlight' tweak set.
|
///
|
||||||
|
/// Supply "highlight" to return only events where the notification had the 'highlight'
|
||||||
|
/// tweak set.
|
||||||
#[ruma_api(query)]
|
#[ruma_api(query)]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub only: Option<&'a str>,
|
pub only: Option<&'a str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
/// The token to supply in the from param of the next /notifications request in order
|
/// The token to supply in the from param of the next /notifications request in order to
|
||||||
/// to request more events. If this is absent, there are no more results.
|
/// request more events.
|
||||||
|
///
|
||||||
|
/// If this is absent, there are no more results.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub next_token: Option<String>,
|
pub next_token: Option<String>,
|
||||||
|
|
||||||
|
@ -42,12 +42,16 @@ ruma_api! {
|
|||||||
pub actions: &'a [Action],
|
pub actions: &'a [Action],
|
||||||
|
|
||||||
/// The conditions that must hold true for an event in order for a rule to be applied to an
|
/// The conditions that must hold true for an event in order for a rule to be applied to an
|
||||||
/// event. A rule with no conditions always matches. Only applicable to underride and
|
/// event.
|
||||||
/// override rules, empty Vec otherwise.
|
///
|
||||||
|
/// A rule with no conditions always matches. Only applicable to underride and override
|
||||||
|
/// rules, empty Vec otherwise.
|
||||||
#[serde(default, skip_serializing_if = "<[_]>::is_empty")]
|
#[serde(default, skip_serializing_if = "<[_]>::is_empty")]
|
||||||
pub conditions: &'a [PushCondition],
|
pub conditions: &'a [PushCondition],
|
||||||
|
|
||||||
/// The glob-style pattern to match against. Only applicable to content rules.
|
/// The glob-style pattern to match against.
|
||||||
|
///
|
||||||
|
/// Only applicable to content rules.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub pattern: Option<&'a str>,
|
pub pattern: Option<&'a str>,
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,9 @@ ruma_api! {
|
|||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub room_alias_name: Option<&'a str>,
|
pub room_alias_name: Option<&'a str>,
|
||||||
|
|
||||||
/// Room version to set for the room. Defaults to homeserver's default if not specified.
|
/// Room version to set for the room.
|
||||||
|
///
|
||||||
|
/// Defaults to homeserver's default if not specified.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub room_version: Option<&'a RoomVersionId>,
|
pub room_version: Option<&'a RoomVersionId>,
|
||||||
|
|
||||||
@ -80,10 +82,10 @@ ruma_api! {
|
|||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub topic: Option<&'a str>,
|
pub topic: Option<&'a str>,
|
||||||
|
|
||||||
/// A public visibility indicates that the room will be shown in the published room
|
/// A public visibility indicates that the room will be shown in the published room list.
|
||||||
/// list. A private visibility will hide the room from the published room list.
|
|
||||||
///
|
///
|
||||||
/// Defaults to `Private`.
|
/// A private visibility will hide the room from the published room list. Defaults to
|
||||||
|
/// `Private`.
|
||||||
#[serde(default, skip_serializing_if = "ruma_serde::is_default")]
|
#[serde(default, skip_serializing_if = "ruma_serde::is_default")]
|
||||||
pub visibility: Visibility,
|
pub visibility: Visibility,
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,9 @@ ruma_api! {
|
|||||||
/// Integer between -100 and 0 rating offensivness.
|
/// Integer between -100 and 0 rating offensivness.
|
||||||
pub score: Int,
|
pub score: Int,
|
||||||
|
|
||||||
/// Reason to report content. May be blank.
|
/// Reason to report content.
|
||||||
|
///
|
||||||
|
/// May be blank.
|
||||||
pub reason: &'a str,
|
pub reason: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,9 @@ pub struct Criteria<'a> {
|
|||||||
/// The string to search events for.
|
/// The string to search events for.
|
||||||
pub search_term: &'a str,
|
pub search_term: &'a str,
|
||||||
|
|
||||||
/// The keys to search for. Defaults to all keys.
|
/// The keys to search for.
|
||||||
|
///
|
||||||
|
/// Defaults to all keys.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub keys: Option<&'a [SearchKeys]>,
|
pub keys: Option<&'a [SearchKeys]>,
|
||||||
|
|
||||||
@ -357,7 +359,9 @@ pub struct ResultRoomEvents {
|
|||||||
pub groups: BTreeMap<GroupingKey, BTreeMap<RoomIdOrUserId, ResultGroup>>,
|
pub groups: BTreeMap<GroupingKey, BTreeMap<RoomIdOrUserId, ResultGroup>>,
|
||||||
|
|
||||||
/// Token that can be used to get the next batch of results, by passing as the `next_batch`
|
/// Token that can be used to get the next batch of results, by passing as the `next_batch`
|
||||||
/// parameter to the next call. If this field is absent, there are no more results.
|
/// parameter to the next call.
|
||||||
|
///
|
||||||
|
/// If this field is absent, there are no more results.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub next_batch: Option<String>,
|
pub next_batch: Option<String>,
|
||||||
|
|
||||||
@ -365,8 +369,9 @@ pub struct ResultRoomEvents {
|
|||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
pub results: Vec<SearchResult>,
|
pub results: Vec<SearchResult>,
|
||||||
|
|
||||||
/// The current state for every room in the results. This is included if the request had the
|
/// The current state for every room in the results.
|
||||||
/// `include_state` key set with a value of `true`.
|
///
|
||||||
|
/// This is included if the request had the `include_state` key set with a value of `true`.
|
||||||
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
||||||
pub state: BTreeMap<RoomId, Vec<Raw<AnyStateEvent>>>,
|
pub state: BTreeMap<RoomId, Vec<Raw<AnyStateEvent>>>,
|
||||||
|
|
||||||
@ -398,8 +403,9 @@ impl ResultRoomEvents {
|
|||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct ResultGroup {
|
pub struct ResultGroup {
|
||||||
/// Token that can be used to get the next batch of results in the group, by passing as the
|
/// Token that can be used to get the next batch of results in the group, by passing as the
|
||||||
/// `next_batch` parameter to the next call. If this field is absent, there are no more
|
/// `next_batch` parameter to the next call.
|
||||||
/// results in this group.
|
///
|
||||||
|
/// If this field is absent, there are no more results in this group.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub next_batch: Option<String>,
|
pub next_batch: Option<String>,
|
||||||
|
|
||||||
@ -432,7 +438,9 @@ pub struct SearchResult {
|
|||||||
#[serde(skip_serializing_if = "EventContextResult::is_empty")]
|
#[serde(skip_serializing_if = "EventContextResult::is_empty")]
|
||||||
pub context: EventContextResult,
|
pub context: EventContextResult,
|
||||||
|
|
||||||
/// A number that describes how closely this result matches the search. Higher is closer.
|
/// A number that describes how closely this result matches the search.
|
||||||
|
///
|
||||||
|
/// Higher is closer.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub rank: Option<UInt>,
|
pub rank: Option<UInt>,
|
||||||
|
|
||||||
@ -459,8 +467,8 @@ impl SearchResult {
|
|||||||
pub struct UserProfile {
|
pub struct UserProfile {
|
||||||
/// The user's avatar URL, if set.
|
/// The user's avatar URL, if set.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will give
|
/// If you activate the `compat` feature, this field being an empty string in JSON will result
|
||||||
/// you `None` here.
|
/// 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",
|
||||||
|
@ -32,8 +32,9 @@ ruma_api! {
|
|||||||
#[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. Ignored if device_id corresponds
|
/// A display name to assign to the newly-created device.
|
||||||
/// 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>,
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,10 @@ ruma_api! {
|
|||||||
|
|
||||||
response: {
|
response: {
|
||||||
/// If the user is a member of the room this will be the current state of the room as a
|
/// If the user is a member of the room this will be the current state of the room as a
|
||||||
/// list of events. If the user has left the room then this will be the state of the
|
/// list of events.
|
||||||
/// room when they left as a list of events.
|
///
|
||||||
|
/// If the user has left the room then this will be the state of the room when they left as
|
||||||
|
/// a list of events.
|
||||||
#[ruma_api(body)]
|
#[ruma_api(body)]
|
||||||
pub room_state: Vec<Raw<AnyStateEvent>>,
|
pub room_state: Vec<Raw<AnyStateEvent>>,
|
||||||
}
|
}
|
||||||
|
@ -247,8 +247,7 @@ pub struct JoinedRoom {
|
|||||||
#[serde(default, skip_serializing_if = "RoomAccountData::is_empty")]
|
#[serde(default, skip_serializing_if = "RoomAccountData::is_empty")]
|
||||||
pub account_data: RoomAccountData,
|
pub account_data: RoomAccountData,
|
||||||
|
|
||||||
/// The ephemeral events in the room that aren't recorded in the timeline or state of the
|
/// The ephemeral events in the room that aren't recorded in the timeline or state of the room.
|
||||||
/// room. e.g. typing.
|
|
||||||
#[serde(default, skip_serializing_if = "Ephemeral::is_empty")]
|
#[serde(default, skip_serializing_if = "Ephemeral::is_empty")]
|
||||||
pub ephemeral: Ephemeral,
|
pub ephemeral: Ephemeral,
|
||||||
}
|
}
|
||||||
@ -433,8 +432,9 @@ impl Ephemeral {
|
|||||||
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
|
||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct RoomSummary {
|
pub struct RoomSummary {
|
||||||
/// Users which can be used to generate a room name if the room does not have
|
/// Users which can be used to generate a room name if the room does not have one.
|
||||||
/// one. Required if room name or canonical aliases are not set or empty.
|
///
|
||||||
|
/// Required if room name or canonical aliases are not set or empty.
|
||||||
#[serde(rename = "m.heroes", default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(rename = "m.heroes", default, skip_serializing_if = "Vec::is_empty")]
|
||||||
pub heroes: Vec<String>,
|
pub heroes: Vec<String>,
|
||||||
|
|
||||||
|
@ -80,8 +80,8 @@ pub struct User {
|
|||||||
|
|
||||||
/// The avatar url, as an MXC, if one exists.
|
/// The avatar url, as an MXC, if one exists.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will give
|
/// If you activate the `compat` feature, this field being an empty string in JSON will result
|
||||||
/// you `None` here.
|
/// in `None` here during deserialization.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "compat",
|
feature = "compat",
|
||||||
|
@ -51,8 +51,8 @@ pub struct PublicRoomsChunk {
|
|||||||
|
|
||||||
/// The URL for the room's avatar, if one is set.
|
/// The URL for the room's avatar, if one is set.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will give
|
/// If you activate the `compat` feature, this field being an empty string in JSON will result
|
||||||
/// you `None` here.
|
/// 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",
|
||||||
|
@ -11,10 +11,14 @@ use serde::{Deserialize, Serialize};
|
|||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct DeviceKeys {
|
pub struct DeviceKeys {
|
||||||
/// The ID of the user the device belongs to. Must match the user ID used when logging in.
|
/// The ID of the user the device belongs to.
|
||||||
|
///
|
||||||
|
/// Must match the user ID used when logging in.
|
||||||
pub user_id: UserId,
|
pub user_id: UserId,
|
||||||
|
|
||||||
/// The ID of the device these keys belong to. Must match the device ID used when logging in.
|
/// The ID of the device these keys belong to.
|
||||||
|
///
|
||||||
|
/// Must match the device ID used when logging in.
|
||||||
pub device_id: DeviceIdBox,
|
pub device_id: DeviceIdBox,
|
||||||
|
|
||||||
/// The encryption algorithms supported by this device.
|
/// The encryption algorithms supported by this device.
|
||||||
@ -113,17 +117,20 @@ pub struct CrossSigningKey {
|
|||||||
/// What the key is used for.
|
/// What the key is used for.
|
||||||
pub usage: Vec<KeyUsage>,
|
pub usage: Vec<KeyUsage>,
|
||||||
|
|
||||||
/// The public key. The object must have exactly one property.
|
/// The public key.
|
||||||
|
///
|
||||||
|
/// The object must have exactly one property.
|
||||||
pub keys: BTreeMap<String, String>,
|
pub keys: BTreeMap<String, String>,
|
||||||
|
|
||||||
/// Signatures of the key. Only optional for master key.
|
/// Signatures of the key.
|
||||||
|
///
|
||||||
|
/// Only optional for master key.
|
||||||
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
||||||
pub signatures: CrossSigningKeySignatures,
|
pub signatures: CrossSigningKeySignatures,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CrossSigningKey {
|
impl CrossSigningKey {
|
||||||
/// Creates a new `CrossSigningKey` with the given user ID, usage, keys and
|
/// Creates a new `CrossSigningKey` with the given user ID, usage, keys and signatures.
|
||||||
/// signatures.
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
user_id: UserId,
|
user_id: UserId,
|
||||||
usage: Vec<KeyUsage>,
|
usage: Vec<KeyUsage>,
|
||||||
|
@ -392,7 +392,9 @@ impl Equivalent<PatternedPushRule> for str {
|
|||||||
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
|
||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct PusherData {
|
pub struct PusherData {
|
||||||
/// Required if the pusher's kind is http. The URL to use to send notifications to.
|
/// The URL to use to send notifications to.
|
||||||
|
///
|
||||||
|
/// Required if the pusher's kind is http.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub url: Option<String>,
|
pub url: Option<String>,
|
||||||
|
|
||||||
|
@ -209,10 +209,11 @@ impl ConditionalPushRule {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Matches any encrypted event sent in a room with exactly two members. Unlike other push
|
/// Matches any encrypted event sent in a room with exactly two members.
|
||||||
/// rules, this rule cannot be matched against the content of the event by nature of it being
|
///
|
||||||
/// encrypted. This causes the rule to be an "all or nothing" match where it either matches all
|
/// Unlike other push rules, this rule cannot be matched against the content of the event by
|
||||||
/// events that are encrypted (in 1:1 rooms) or none.
|
/// nature of it being encrypted. This causes the rule to be an "all or nothing" match where it
|
||||||
|
/// either matches all events that are encrypted (in 1:1 rooms) or none.
|
||||||
pub fn encrypted_room_one_to_one() -> Self {
|
pub fn encrypted_room_one_to_one() -> Self {
|
||||||
Self {
|
Self {
|
||||||
rule_id: ".m.rules.encrypted_room_one_to_one".into(),
|
rule_id: ".m.rules.encrypted_room_one_to_one".into(),
|
||||||
@ -259,10 +260,11 @@ impl ConditionalPushRule {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Matches all encrypted events. Unlike other push rules, this rule cannot be matched against
|
/// Matches all encrypted events.
|
||||||
/// the content of the event by nature of it being encrypted. This causes the rule to be an
|
///
|
||||||
/// "all or nothing" match where it either matches all events that are encrypted (in group
|
/// Unlike other push rules, this rule cannot be matched against the content of the event by
|
||||||
/// rooms) or none.
|
/// nature of it being encrypted. This causes the rule to be an "all or nothing" match where it
|
||||||
|
/// either matches all events that are encrypted (in group rooms) or none.
|
||||||
pub fn encrypted() -> Self {
|
pub fn encrypted() -> Self {
|
||||||
Self {
|
Self {
|
||||||
rule_id: ".m.rules.encrypted".into(),
|
rule_id: ".m.rules.encrypted".into(),
|
||||||
|
@ -25,8 +25,8 @@ pub struct Protocol {
|
|||||||
|
|
||||||
/// A content URI representing an icon for the third party protocol.
|
/// A content URI representing an icon for the third party protocol.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being absent in JSON will give you an
|
/// If you activate the `compat` feature, this field being absent in JSON will result in an
|
||||||
/// empty string here.
|
/// empty string here during deserialization.
|
||||||
#[cfg_attr(feature = "compat", serde(default))]
|
#[cfg_attr(feature = "compat", serde(default))]
|
||||||
pub icon: String,
|
pub icon: String,
|
||||||
|
|
||||||
|
@ -13,7 +13,9 @@ use super::SessionDescription;
|
|||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
#[ruma_event(type = "m.call.answer", kind = Message)]
|
#[ruma_event(type = "m.call.answer", kind = Message)]
|
||||||
pub struct CallAnswerEventContent {
|
pub struct CallAnswerEventContent {
|
||||||
/// The VoIP session description object. The session description type must be *answer*.
|
/// The VoIP session description object.
|
||||||
|
///
|
||||||
|
/// The session description type must be *answer*.
|
||||||
pub answer: SessionDescription,
|
pub answer: SessionDescription,
|
||||||
|
|
||||||
/// The ID of the call this event relates to.
|
/// The ID of the call this event relates to.
|
||||||
|
@ -16,12 +16,15 @@ pub struct CallInviteEventContent {
|
|||||||
/// A unique identifier for the call.
|
/// A unique identifier for the call.
|
||||||
pub call_id: String,
|
pub call_id: String,
|
||||||
|
|
||||||
/// The time in milliseconds that the invite is valid for. Once the invite age exceeds this
|
/// The time in milliseconds that the invite is valid for.
|
||||||
/// value, clients should discard it. They should also no longer show the call as awaiting an
|
///
|
||||||
/// answer in the UI.
|
/// Once the invite age exceeds this value, clients should discard it. They should also no
|
||||||
|
/// longer show the call as awaiting an answer in the UI.
|
||||||
pub lifetime: UInt,
|
pub lifetime: UInt,
|
||||||
|
|
||||||
/// The session description object. The session description type must be *offer*.
|
/// The session description object.
|
||||||
|
///
|
||||||
|
/// The session description type must be *offer*.
|
||||||
pub offer: SessionDescription,
|
pub offer: SessionDescription,
|
||||||
|
|
||||||
/// The version of the VoIP specification this messages adheres to.
|
/// The version of the VoIP specification this messages adheres to.
|
||||||
|
@ -78,8 +78,9 @@ pub enum CancelCode {
|
|||||||
#[ruma_enum(rename = "m.user")]
|
#[ruma_enum(rename = "m.user")]
|
||||||
User,
|
User,
|
||||||
|
|
||||||
/// The verification process timed out. Verification processes can define their own timeout
|
/// The verification process timed out.
|
||||||
/// parameters.
|
///
|
||||||
|
/// Verification processes can define their own timeout parameters.
|
||||||
#[ruma_enum(rename = "m.timeout")]
|
#[ruma_enum(rename = "m.timeout")]
|
||||||
Timeout,
|
Timeout,
|
||||||
|
|
||||||
|
@ -11,8 +11,10 @@ pub mod user;
|
|||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct PolicyRuleEventContent {
|
pub struct PolicyRuleEventContent {
|
||||||
/// The entity affected by this rule. Glob characters * and ? can be used to match zero or more
|
/// The entity affected by this rule.
|
||||||
/// and one or more characters respectively.
|
///
|
||||||
|
/// Glob characters `*` and `?` can be used to match zero or more and one or more characters
|
||||||
|
/// respectively.
|
||||||
pub entity: String,
|
pub entity: String,
|
||||||
|
|
||||||
/// The suggested action to take.
|
/// The suggested action to take.
|
||||||
|
@ -30,8 +30,8 @@ pub struct PresenceEvent {
|
|||||||
pub struct PresenceEventContent {
|
pub struct PresenceEventContent {
|
||||||
/// The current avatar URL for this user.
|
/// The current avatar URL for this user.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will give
|
/// If you activate the `compat` feature, this field being an empty string in JSON will result
|
||||||
/// you `None` here.
|
/// 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",
|
||||||
|
@ -52,11 +52,15 @@ pub struct ImageInfo {
|
|||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub thumbnail_info: Option<Box<ThumbnailInfo>>,
|
pub thumbnail_info: Option<Box<ThumbnailInfo>>,
|
||||||
|
|
||||||
/// The URL to the thumbnail of the image. Only present if the thumbnail is unencrypted.
|
/// The URL to the thumbnail of the image.
|
||||||
|
///
|
||||||
|
/// Only present if the thumbnail is unencrypted.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub thumbnail_url: Option<MxcUri>,
|
pub thumbnail_url: Option<MxcUri>,
|
||||||
|
|
||||||
/// Information on the encrypted thumbnail image. Only present if the thumbnail is encrypted.
|
/// Information on the encrypted thumbnail image.
|
||||||
|
///
|
||||||
|
/// Only present if the thumbnail is encrypted.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub thumbnail_file: Option<Box<EncryptedFile>>,
|
pub thumbnail_file: Option<Box<EncryptedFile>>,
|
||||||
|
|
||||||
@ -65,8 +69,7 @@ pub struct ImageInfo {
|
|||||||
/// This uses the unstable prefix in
|
/// This uses the unstable prefix in
|
||||||
/// [MSC2448](https://github.com/matrix-org/matrix-doc/pull/2448).
|
/// [MSC2448](https://github.com/matrix-org/matrix-doc/pull/2448).
|
||||||
#[cfg(feature = "unstable-pre-spec")]
|
#[cfg(feature = "unstable-pre-spec")]
|
||||||
#[serde(rename = "xyz.amorgan.blurhash")]
|
#[serde(rename = "xyz.amorgan.blurhash", skip_serializing_if = "Option::is_none")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub blurhash: Option<String>,
|
pub blurhash: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +129,9 @@ pub struct EncryptedFile {
|
|||||||
/// Clients should support the SHA-256 hash, which uses the key sha256.
|
/// Clients should support the SHA-256 hash, which uses the key sha256.
|
||||||
pub hashes: BTreeMap<String, String>,
|
pub hashes: BTreeMap<String, String>,
|
||||||
|
|
||||||
/// Version of the encrypted attachments protocol. Must be `v2`.
|
/// Version of the encrypted attachments protocol.
|
||||||
|
///
|
||||||
|
/// Must be `v2`.
|
||||||
pub v: String,
|
pub v: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +156,9 @@ pub struct EncryptedFileInit {
|
|||||||
/// Clients should support the SHA-256 hash, which uses the key sha256.
|
/// Clients should support the SHA-256 hash, which uses the key sha256.
|
||||||
pub hashes: BTreeMap<String, String>,
|
pub hashes: BTreeMap<String, String>,
|
||||||
|
|
||||||
/// Version of the encrypted attachments protocol. Must be `v2`.
|
/// Version of the encrypted attachments protocol.
|
||||||
|
///
|
||||||
|
/// Must be `v2`.
|
||||||
pub v: String,
|
pub v: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,13 +176,19 @@ impl From<EncryptedFileInit> for EncryptedFile {
|
|||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct JsonWebKey {
|
pub struct JsonWebKey {
|
||||||
/// Key type. Must be `oct`.
|
/// Key type.
|
||||||
|
///
|
||||||
|
/// Must be `oct`.
|
||||||
pub kty: String,
|
pub kty: String,
|
||||||
|
|
||||||
/// Key operations. Must at least contain `encrypt` and `decrypt`.
|
/// Key operations.
|
||||||
|
///
|
||||||
|
/// Must at least contain `encrypt` and `decrypt`.
|
||||||
pub key_ops: Vec<String>,
|
pub key_ops: Vec<String>,
|
||||||
|
|
||||||
/// Required. Algorithm. Must be `A256CTR`.
|
/// Algorithm.
|
||||||
|
///
|
||||||
|
/// Must be `A256CTR`.
|
||||||
pub alg: String,
|
pub alg: String,
|
||||||
|
|
||||||
/// The key, encoded as url-safe unpadded base64.
|
/// The key, encoded as url-safe unpadded base64.
|
||||||
@ -195,13 +208,19 @@ pub struct JsonWebKey {
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[allow(clippy::exhaustive_structs)]
|
#[allow(clippy::exhaustive_structs)]
|
||||||
pub struct JsonWebKeyInit {
|
pub struct JsonWebKeyInit {
|
||||||
/// Key type. Must be `oct`.
|
/// Key type.
|
||||||
|
///
|
||||||
|
/// Must be `oct`.
|
||||||
pub kty: String,
|
pub kty: String,
|
||||||
|
|
||||||
/// Key operations. Must at least contain `encrypt` and `decrypt`.
|
/// Key operations.
|
||||||
|
///
|
||||||
|
/// Must at least contain `encrypt` and `decrypt`.
|
||||||
pub key_ops: Vec<String>,
|
pub key_ops: Vec<String>,
|
||||||
|
|
||||||
/// Required. Algorithm. Must be `A256CTR`.
|
/// Algorithm.
|
||||||
|
///
|
||||||
|
/// Must be `A256CTR`.
|
||||||
pub alg: String,
|
pub alg: String,
|
||||||
|
|
||||||
/// The key, encoded as url-safe unpadded base64.
|
/// The key, encoded as url-safe unpadded base64.
|
||||||
|
@ -85,8 +85,7 @@ pub struct ImageInfo {
|
|||||||
/// This uses the unstable prefix in
|
/// This uses the unstable prefix in
|
||||||
/// [MSC2448](https://github.com/matrix-org/matrix-doc/pull/2448).
|
/// [MSC2448](https://github.com/matrix-org/matrix-doc/pull/2448).
|
||||||
#[cfg(feature = "unstable-pre-spec")]
|
#[cfg(feature = "unstable-pre-spec")]
|
||||||
#[serde(rename = "xyz.amorgan.blurhash")]
|
#[serde(rename = "xyz.amorgan.blurhash", skip_serializing_if = "Option::is_none")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub blurhash: Option<String>,
|
pub blurhash: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,9 @@ use serde::{Deserialize, Serialize};
|
|||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
#[ruma_event(type = "m.room.create", kind = State)]
|
#[ruma_event(type = "m.room.create", kind = State)]
|
||||||
pub struct RoomCreateEventContent {
|
pub struct RoomCreateEventContent {
|
||||||
/// The `user_id` of the room creator. This is set by the homeserver.
|
/// The `user_id` of the room creator.
|
||||||
|
///
|
||||||
|
/// This is set by the homeserver.
|
||||||
#[ruma_event(skip_redaction)]
|
#[ruma_event(skip_redaction)]
|
||||||
pub creator: UserId,
|
pub creator: UserId,
|
||||||
|
|
||||||
@ -26,7 +28,9 @@ pub struct RoomCreateEventContent {
|
|||||||
)]
|
)]
|
||||||
pub federate: bool,
|
pub federate: bool,
|
||||||
|
|
||||||
/// The version of the room. Defaults to "1" if the key does not exist.
|
/// The version of the room.
|
||||||
|
///
|
||||||
|
/// Defaults to `RoomVersionId::Version1`.
|
||||||
#[serde(default = "default_room_version_id")]
|
#[serde(default = "default_room_version_id")]
|
||||||
pub room_version: RoomVersionId,
|
pub room_version: RoomVersionId,
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
/// The content of an `m.room.history_visibility` event.
|
/// The content of an `m.room.history_visibility` event.
|
||||||
///
|
///
|
||||||
/// This event controls whether a member of a room can see the events that happened in a room
|
/// This event controls whether a member of a room can see the events that happened in a room from
|
||||||
/// from before they joined.
|
/// before they joined.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
#[derive(Clone, Debug, Deserialize, Serialize, EventContent)]
|
||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
#[ruma_event(type = "m.room.history_visibility", kind = State)]
|
#[ruma_event(type = "m.room.history_visibility", kind = State)]
|
||||||
@ -33,21 +33,26 @@ impl RoomHistoryVisibilityEventContent {
|
|||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub enum HistoryVisibility {
|
pub enum HistoryVisibility {
|
||||||
/// Previous events are accessible to newly joined members from the point they were invited
|
/// Previous events are accessible to newly joined members from the point they were invited
|
||||||
/// onwards. Events stop being accessible when the member's state changes to something other
|
/// onwards.
|
||||||
/// than *invite* or *join*.
|
///
|
||||||
|
/// Events stop being accessible when the member's state changes to something other than
|
||||||
|
/// *invite* or *join*.
|
||||||
Invited,
|
Invited,
|
||||||
|
|
||||||
/// Previous events are accessible to newly joined members from the point they joined the room
|
/// Previous events are accessible to newly joined members from the point they joined the room
|
||||||
/// onwards. Events stop being accessible when the member's state changes to something other
|
/// onwards.
|
||||||
/// than *join*.
|
/// Events stop being accessible when the member's state changes to something other than
|
||||||
|
/// *join*.
|
||||||
Joined,
|
Joined,
|
||||||
|
|
||||||
/// Previous events are always accessible to newly joined members. All events in the room are
|
/// Previous events are always accessible to newly joined members.
|
||||||
/// accessible, even those sent when the member was not a part of the room.
|
///
|
||||||
|
/// All events in the room are accessible, even those sent when the member was not a part of
|
||||||
|
/// the room.
|
||||||
Shared,
|
Shared,
|
||||||
|
|
||||||
/// All events while this is the `HistoryVisibility` value may be shared by any
|
/// All events while this is the `HistoryVisibility` value may be shared by any participating
|
||||||
/// participating homeserver with anyone, regardless of whether they have ever joined the room.
|
/// homeserver with anyone, regardless of whether they have ever joined the room.
|
||||||
WorldReadable,
|
WorldReadable,
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -40,10 +40,10 @@ use crate::{StrippedStateEvent, SyncStateEvent};
|
|||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
#[ruma_event(type = "m.room.member", kind = State)]
|
#[ruma_event(type = "m.room.member", kind = State)]
|
||||||
pub struct RoomMemberEventContent {
|
pub struct RoomMemberEventContent {
|
||||||
/// The avatar URL for this user, if any. This is added by the homeserver.
|
/// The avatar URL for this user, if any.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will give
|
/// This is added by the homeserver. If you activate the `compat` feature, this field being an
|
||||||
/// you `None` here.
|
/// empty string in JSON will result in `None` here during deserialization.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "compat",
|
feature = "compat",
|
||||||
@ -51,7 +51,9 @@ pub struct RoomMemberEventContent {
|
|||||||
)]
|
)]
|
||||||
pub avatar_url: Option<MxcUri>,
|
pub avatar_url: Option<MxcUri>,
|
||||||
|
|
||||||
/// The display name for this user, if any. This is added by the homeserver.
|
/// The display name for this user, if any.
|
||||||
|
///
|
||||||
|
/// This is added by the homeserver.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub displayname: Option<String>,
|
pub displayname: Option<String>,
|
||||||
|
|
||||||
@ -74,8 +76,7 @@ pub struct RoomMemberEventContent {
|
|||||||
/// This uses the unstable prefix in
|
/// This uses the unstable prefix in
|
||||||
/// [MSC2448](https://github.com/matrix-org/matrix-doc/pull/2448).
|
/// [MSC2448](https://github.com/matrix-org/matrix-doc/pull/2448).
|
||||||
#[cfg(feature = "unstable-pre-spec")]
|
#[cfg(feature = "unstable-pre-spec")]
|
||||||
#[serde(rename = "xyz.amorgan.blurhash")]
|
#[serde(rename = "xyz.amorgan.blurhash", skip_serializing_if = "Option::is_none")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub blurhash: Option<String>,
|
pub blurhash: Option<String>,
|
||||||
|
|
||||||
/// User-supplied text for why their membership has changed.
|
/// User-supplied text for why their membership has changed.
|
||||||
@ -302,7 +303,9 @@ fn membership_change(
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl RoomMemberEvent {
|
impl RoomMemberEvent {
|
||||||
/// Helper function for membership change. Check [the specification][spec] for details.
|
/// Helper function for membership change.
|
||||||
|
///
|
||||||
|
/// Check [the specification][spec] for details.
|
||||||
///
|
///
|
||||||
/// [spec]: https://matrix.org/docs/spec/client_server/r0.6.1#m-room-member
|
/// [spec]: https://matrix.org/docs/spec/client_server/r0.6.1#m-room-member
|
||||||
pub fn membership_change(&self) -> MembershipChange {
|
pub fn membership_change(&self) -> MembershipChange {
|
||||||
@ -311,7 +314,9 @@ impl RoomMemberEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl SyncStateEvent<RoomMemberEventContent> {
|
impl SyncStateEvent<RoomMemberEventContent> {
|
||||||
/// Helper function for membership change. Check [the specification][spec] for details.
|
/// Helper function for membership change.
|
||||||
|
///
|
||||||
|
/// Check [the specification][spec] for details.
|
||||||
///
|
///
|
||||||
/// [spec]: https://matrix.org/docs/spec/client_server/r0.6.1#m-room-member
|
/// [spec]: https://matrix.org/docs/spec/client_server/r0.6.1#m-room-member
|
||||||
pub fn membership_change(&self) -> MembershipChange {
|
pub fn membership_change(&self) -> MembershipChange {
|
||||||
@ -320,7 +325,9 @@ impl SyncStateEvent<RoomMemberEventContent> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl StrippedStateEvent<RoomMemberEventContent> {
|
impl StrippedStateEvent<RoomMemberEventContent> {
|
||||||
/// Helper function for membership change. Check [the specification][spec] for details.
|
/// Helper function for membership change.
|
||||||
|
///
|
||||||
|
/// Check [the specification][spec] for details.
|
||||||
///
|
///
|
||||||
/// [spec]: https://matrix.org/docs/spec/client_server/r0.6.1#m-room-member
|
/// [spec]: https://matrix.org/docs/spec/client_server/r0.6.1#m-room-member
|
||||||
pub fn membership_change(&self) -> MembershipChange {
|
pub fn membership_change(&self) -> MembershipChange {
|
||||||
|
@ -867,13 +867,11 @@ pub struct VideoInfo {
|
|||||||
pub duration: Option<UInt>,
|
pub duration: Option<UInt>,
|
||||||
|
|
||||||
/// The height of the video in pixels.
|
/// The height of the video in pixels.
|
||||||
#[serde(rename = "h")]
|
#[serde(rename = "h", skip_serializing_if = "Option::is_none")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub height: Option<UInt>,
|
pub height: Option<UInt>,
|
||||||
|
|
||||||
/// The width of the video in pixels.
|
/// The width of the video in pixels.
|
||||||
#[serde(rename = "w")]
|
#[serde(rename = "w", skip_serializing_if = "Option::is_none")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub width: Option<UInt>,
|
pub width: Option<UInt>,
|
||||||
|
|
||||||
/// The mimetype of the video, e.g. "video/mp4".
|
/// The mimetype of the video, e.g. "video/mp4".
|
||||||
@ -905,8 +903,7 @@ pub struct VideoInfo {
|
|||||||
/// This uses the unstable prefix in
|
/// This uses the unstable prefix in
|
||||||
/// [MSC2448](https://github.com/matrix-org/matrix-doc/pull/2448).
|
/// [MSC2448](https://github.com/matrix-org/matrix-doc/pull/2448).
|
||||||
#[cfg(feature = "unstable-pre-spec")]
|
#[cfg(feature = "unstable-pre-spec")]
|
||||||
#[serde(rename = "xyz.amorgan.blurhash")]
|
#[serde(rename = "xyz.amorgan.blurhash", skip_serializing_if = "Option::is_none")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub blurhash: Option<String>,
|
pub blurhash: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,22 +16,22 @@ use serde::{Deserialize, Serialize};
|
|||||||
pub struct RoomThirdPartyInviteEventContent {
|
pub struct RoomThirdPartyInviteEventContent {
|
||||||
/// A user-readable string which represents the user who has been invited.
|
/// A user-readable string which represents the user who has been invited.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being absent in JSON will give you an
|
/// If you activate the `compat` feature, this field being absent in JSON will result in an
|
||||||
/// empty string here.
|
/// empty string here during deserialization.
|
||||||
#[cfg_attr(feature = "compat", serde(default))]
|
#[cfg_attr(feature = "compat", serde(default))]
|
||||||
pub display_name: String,
|
pub display_name: String,
|
||||||
|
|
||||||
/// A URL which can be fetched to validate whether the key has been revoked.
|
/// A URL which can be fetched to validate whether the key has been revoked.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being absent in JSON will give you an
|
/// If you activate the `compat` feature, this field being absent in JSON will result in an
|
||||||
/// empty string here.
|
/// empty string here during deserialization.
|
||||||
#[cfg_attr(feature = "compat", serde(default))]
|
#[cfg_attr(feature = "compat", serde(default))]
|
||||||
pub key_validity_url: String,
|
pub key_validity_url: String,
|
||||||
|
|
||||||
/// A Base64-encoded Ed25519 key with which the token must be signed.
|
/// A Base64-encoded Ed25519 key with which the token must be signed.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being absent in JSON will give you an
|
/// If you activate the `compat` feature, this field being absent in JSON will result in an
|
||||||
/// empty string here.
|
/// empty string here during deserialization.
|
||||||
#[cfg_attr(feature = "compat", serde(default))]
|
#[cfg_attr(feature = "compat", serde(default))]
|
||||||
pub public_key: String,
|
pub public_key: String,
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ use serde::{Deserialize, Serialize};
|
|||||||
pub struct RoomTombstoneEventContent {
|
pub struct RoomTombstoneEventContent {
|
||||||
/// A server-defined message.
|
/// A server-defined message.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being absent in JSON will give you an
|
/// If you activate the `compat` feature, this field being absent in JSON will result in an
|
||||||
/// empty string here.
|
/// empty string here during deserialization.
|
||||||
#[cfg_attr(feature = "compat", serde(default))]
|
#[cfg_attr(feature = "compat", serde(default))]
|
||||||
pub body: String,
|
pub body: String,
|
||||||
|
|
||||||
|
@ -13,15 +13,16 @@ use crate::room::ImageInfo;
|
|||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
#[ruma_event(type = "m.sticker", kind = Message)]
|
#[ruma_event(type = "m.sticker", kind = Message)]
|
||||||
pub struct StickerEventContent {
|
pub struct StickerEventContent {
|
||||||
/// A textual representation or associated description of the sticker image. This could
|
/// A textual representation or associated description of the sticker image.
|
||||||
/// be the alt text of the original image, or a message to accompany and further
|
///
|
||||||
|
/// This could be the alt text of the original image, or a message to accompany and further
|
||||||
/// describe the sticker.
|
/// describe the sticker.
|
||||||
pub body: String,
|
pub body: String,
|
||||||
|
|
||||||
/// Metadata about the image referred to in `url` including a thumbnail representation.
|
/// Metadata about the image referred to in `url` including a thumbnail representation.
|
||||||
pub info: ImageInfo,
|
pub info: ImageInfo,
|
||||||
|
|
||||||
/// The URL to the sticker image. This must be a valid `mxc://` URI.
|
/// The URL to the sticker image.
|
||||||
pub url: MxcUri,
|
pub url: MxcUri,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,8 +75,9 @@ impl Error for InvalidUserTagName {}
|
|||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub enum TagName {
|
pub enum TagName {
|
||||||
/// `m.favourite`: The user's favorite rooms. These should be shown with higher precedence
|
/// `m.favourite`: The user's favorite rooms.
|
||||||
/// than other rooms.
|
///
|
||||||
|
/// These should be shown with higher precedence than other rooms.
|
||||||
Favorite,
|
Favorite,
|
||||||
|
|
||||||
/// `m.lowpriority`: These should be shown with lower precedence than others.
|
/// `m.lowpriority`: These should be shown with lower precedence than others.
|
||||||
|
@ -17,7 +17,9 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
request: {
|
request: {
|
||||||
/// The user ID to retrieve devices for. Must be a user local to the receiving homeserver.
|
/// The user ID to retrieve devices for.
|
||||||
|
///
|
||||||
|
/// Must be a user local to the receiving homeserver.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub user_id: &'a UserId,
|
pub user_id: &'a UserId,
|
||||||
}
|
}
|
||||||
@ -26,12 +28,13 @@ ruma_api! {
|
|||||||
/// The user ID devices were requested for.
|
/// The user ID devices were requested for.
|
||||||
pub user_id: UserId,
|
pub user_id: UserId,
|
||||||
|
|
||||||
/// A unique ID for a given user_id which describes the version of the returned device
|
/// A unique ID for a given user_id which describes the version of the returned device list.
|
||||||
/// list. This is matched with the `stream_id` field in `m.device_list_update` EDUs in
|
///
|
||||||
/// order to incrementally update the returned device_list.
|
/// This is matched with the `stream_id` field in `m.device_list_update` EDUs in order to
|
||||||
|
/// incrementally update the returned device_list.
|
||||||
pub stream_id: UInt,
|
pub stream_id: UInt,
|
||||||
|
|
||||||
/// The user's devices. May be empty.
|
/// The user's devices.
|
||||||
pub devices: Vec<UserDevice>,
|
pub devices: Vec<UserDevice>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,12 +59,14 @@ pub struct ServerSigningKeys {
|
|||||||
/// Public keys that the homeserver used to use and when it stopped using them.
|
/// Public keys that the homeserver used to use and when it stopped using them.
|
||||||
pub old_verify_keys: BTreeMap<ServerSigningKeyId, OldVerifyKey>,
|
pub old_verify_keys: BTreeMap<ServerSigningKeyId, OldVerifyKey>,
|
||||||
|
|
||||||
/// Digital signatures of this object signed using the verify_keys. Map of
|
/// Digital signatures of this object signed using the verify_keys.
|
||||||
/// server name to keys by key ID
|
///
|
||||||
|
/// Map of server name to keys by key ID
|
||||||
pub signatures: BTreeMap<ServerNameBox, BTreeMap<ServerSigningKeyId, String>>,
|
pub signatures: BTreeMap<ServerNameBox, BTreeMap<ServerSigningKeyId, String>>,
|
||||||
|
|
||||||
/// Timestamp when the keys should be refreshed. This field MUST be ignored in room
|
/// Timestamp when the keys should be refreshed.
|
||||||
/// versions 1, 2, 3, and 4.
|
///
|
||||||
|
/// This field MUST be ignored in room versions 1, 2, 3, and 4.
|
||||||
pub valid_until_ts: MilliSecondsSinceUnixEpoch,
|
pub valid_until_ts: MilliSecondsSinceUnixEpoch,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,9 @@ pub struct Server {
|
|||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
|
|
||||||
/// Version of this implementation. The version format depends on the implementation.
|
/// Version of this implementation.
|
||||||
|
///
|
||||||
|
/// The version format depends on the implementation.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub version: Option<String>,
|
pub version: Option<String>,
|
||||||
}
|
}
|
||||||
|
@ -21,15 +21,21 @@ ruma_api! {
|
|||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub room_id: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
|
|
||||||
/// The maximum number of events to retrieve. Defaults to 10.
|
/// The maximum number of events to retrieve.
|
||||||
|
///
|
||||||
|
/// Defaults to 10.
|
||||||
#[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,
|
||||||
|
|
||||||
/// The minimum depth of events to retrieve. Defaults to 0.
|
/// The minimum depth of events to retrieve.
|
||||||
|
///
|
||||||
|
/// Defaults to 0.
|
||||||
#[serde(default, skip_serializing_if = "ruma_serde::is_default")]
|
#[serde(default, skip_serializing_if = "ruma_serde::is_default")]
|
||||||
pub min_depth: UInt,
|
pub min_depth: UInt,
|
||||||
|
|
||||||
/// The latest event IDs that the sender already has. These are skipped when retrieving the previous events of `latest_events`.
|
/// The latest event IDs that the sender already has.
|
||||||
|
///
|
||||||
|
/// These are skipped when retrieving the previous events of `latest_events`.
|
||||||
pub earliest_events: &'a [EventId],
|
pub earliest_events: &'a [EventId],
|
||||||
|
|
||||||
/// The event IDs to retrieve the previous events for.
|
/// The event IDs to retrieve the previous events for.
|
||||||
|
@ -19,8 +19,9 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
request: {
|
request: {
|
||||||
/// The keys to be downloaded. Gives all keys for a given user if the list of device ids is
|
/// The keys to be downloaded.
|
||||||
/// empty.
|
///
|
||||||
|
/// Gives all keys for a given user if the list of device ids is empty.
|
||||||
pub device_keys: BTreeMap<UserId, Vec<DeviceIdBox>>,
|
pub device_keys: BTreeMap<UserId, Vec<DeviceIdBox>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,12 +26,15 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
/// The version of the room where the server is trying to leave. If not provided, the room
|
/// The version of the room where the server is trying to leave.
|
||||||
/// version is assumed to be either "1" or "2".
|
///
|
||||||
|
/// If not provided, the room version is assumed to be either "1" or "2".
|
||||||
pub room_version: Option<RoomVersionId>,
|
pub room_version: Option<RoomVersionId>,
|
||||||
|
|
||||||
/// An unsigned template event. Note that events have a different format depending on the
|
/// An unsigned template event.
|
||||||
/// room version - check the room version specification for precise event formats.
|
///
|
||||||
|
/// Note that events have a different format depending on the room version - check the room
|
||||||
|
/// version specification for precise event formats.
|
||||||
pub event: Box<RawJsonValue>,
|
pub event: Box<RawJsonValue>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,8 @@ ruma_api! {
|
|||||||
|
|
||||||
/// Avatar URL for the user's avatar.
|
/// Avatar URL for the user's avatar.
|
||||||
///
|
///
|
||||||
/// If you activate the `compat` feature, this field being an empty string in JSON will give
|
/// If you activate the `compat` feature, this field being an empty string in JSON will result
|
||||||
/// you `None` here.
|
/// in `None` here during deserialization.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "compat",
|
feature = "compat",
|
||||||
@ -47,8 +47,7 @@ ruma_api! {
|
|||||||
/// This uses the unstable prefix in
|
/// This uses the unstable prefix in
|
||||||
/// [MSC2448](https://github.com/matrix-org/matrix-doc/pull/2448).
|
/// [MSC2448](https://github.com/matrix-org/matrix-doc/pull/2448).
|
||||||
#[cfg(feature = "unstable-pre-spec")]
|
#[cfg(feature = "unstable-pre-spec")]
|
||||||
#[serde(rename = "xyz.amorgan.blurhash")]
|
#[serde(rename = "xyz.amorgan.blurhash", skip_serializing_if = "Option::is_none")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub blurhash: Option<String>,
|
pub blurhash: Option<String>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,9 @@ impl<'a> Request<'a> {
|
|||||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct ThirdPartyInvite {
|
pub struct ThirdPartyInvite {
|
||||||
/// The type of third party invite issues. Currently only "email" is used.
|
/// The type of third party invite issues.
|
||||||
|
///
|
||||||
|
/// Currently only `Medium::Email` is used.
|
||||||
pub medium: Medium,
|
pub medium: Medium,
|
||||||
|
|
||||||
/// The third party identifier that received the invite.
|
/// The third party identifier that received the invite.
|
||||||
|
@ -19,7 +19,9 @@ ruma_api! {
|
|||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub room_id: &'a RoomId,
|
pub room_id: &'a RoomId,
|
||||||
|
|
||||||
/// The event type. Must be `m.room.member`.
|
/// The event type.
|
||||||
|
///
|
||||||
|
/// Must be `EventType::RoomMember`.
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub kind: EventType,
|
pub kind: EventType,
|
||||||
|
|
||||||
|
@ -107,7 +107,9 @@ pub struct PresenceUpdate {
|
|||||||
/// The number of milliseconds that have elapsed since the user last did something.
|
/// The number of milliseconds that have elapsed since the user last did something.
|
||||||
pub last_active_ago: UInt,
|
pub last_active_ago: UInt,
|
||||||
|
|
||||||
/// Whether or not the user is currently active. Defaults to false.
|
/// Whether or not the user is currently active.
|
||||||
|
///
|
||||||
|
/// Defaults to false.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub currently_active: bool,
|
pub currently_active: bool,
|
||||||
}
|
}
|
||||||
@ -206,15 +208,17 @@ pub struct DeviceListUpdateContent {
|
|||||||
/// The ID of the device whose details are changing.
|
/// The ID of the device whose details are changing.
|
||||||
pub device_id: DeviceIdBox,
|
pub device_id: DeviceIdBox,
|
||||||
|
|
||||||
/// The public human-readable name of this device. Will be absent if the device has no name.
|
/// The public human-readable name of this device.
|
||||||
|
///
|
||||||
|
/// Will be absent if the device has no name.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub device_display_name: Option<String>,
|
pub device_display_name: Option<String>,
|
||||||
|
|
||||||
/// An ID sent by the server for this update, unique for a given user_id.
|
/// An ID sent by the server for this update, unique for a given user_id.
|
||||||
pub stream_id: UInt,
|
pub stream_id: UInt,
|
||||||
|
|
||||||
/// The stream_ids of any prior m.device_list_update EDUs sent for this user
|
/// The stream_ids of any prior m.device_list_update EDUs sent for this user which have not
|
||||||
/// which have not been referred to already in an EDU's prev_id field.
|
/// been referred to already in an EDU's prev_id field.
|
||||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||||
pub prev_id: Vec<UInt>,
|
pub prev_id: Vec<UInt>,
|
||||||
|
|
||||||
|
@ -51,11 +51,10 @@ impl fmt::Debug for EventId {
|
|||||||
|
|
||||||
impl EventId {
|
impl EventId {
|
||||||
/// Attempts to generate an `EventId` for the given origin server with a localpart consisting
|
/// Attempts to generate an `EventId` for the given origin server with a localpart consisting
|
||||||
/// of 18 random ASCII characters. This should only be used for events in the original format
|
/// of 18 random ASCII characters.
|
||||||
/// as used by Matrix room versions 1 and 2.
|
|
||||||
///
|
///
|
||||||
/// Does not currently ever fail, but may fail in the future if the homeserver cannot be parsed
|
/// This should only be used for events in the original format as used by Matrix room versions
|
||||||
/// parsed as a valid host.
|
/// 1 and 2.
|
||||||
#[cfg(feature = "rand")]
|
#[cfg(feature = "rand")]
|
||||||
pub fn new(server_name: &ServerName) -> Self {
|
pub fn new(server_name: &ServerName) -> Self {
|
||||||
use crate::generate_localpart;
|
use crate::generate_localpart;
|
||||||
@ -65,9 +64,11 @@ impl EventId {
|
|||||||
Self { full_id, colon_idx: NonZeroU8::new(19) }
|
Self { full_id, colon_idx: NonZeroU8::new(19) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the event's unique ID. For the original event format as used by Matrix room
|
/// Returns the event's unique ID.
|
||||||
/// versions 1 and 2, this is the "localpart" that precedes the homeserver. For later formats,
|
///
|
||||||
/// this is the entire ID without the leading $ sigil.
|
/// For the original event format as used by Matrix room versions 1 and 2, this is the
|
||||||
|
/// "localpart" that precedes the homeserver. For later formats, this is the entire ID without
|
||||||
|
/// the leading `$` sigil.
|
||||||
pub fn localpart(&self) -> &str {
|
pub fn localpart(&self) -> &str {
|
||||||
let idx = match self.colon_idx {
|
let idx = match self.colon_idx {
|
||||||
Some(idx) => idx.get() as usize,
|
Some(idx) => idx.get() as usize,
|
||||||
|
@ -32,7 +32,9 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
/// The session ID. Session IDs are opaque strings generated by the identity server.
|
/// The session ID.
|
||||||
|
///
|
||||||
|
/// Session IDs are opaque strings generated by the identity server.
|
||||||
pub sid: SessionIdBox,
|
pub sid: SessionIdBox,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,9 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
/// The session ID. Session IDs are opaque strings generated by the identity server.
|
/// The session ID.
|
||||||
|
///
|
||||||
|
/// Session IDs are opaque strings generated by the identity server.
|
||||||
pub sid: SessionIdBox,
|
pub sid: SessionIdBox,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,15 +20,16 @@ ruma_api! {
|
|||||||
///
|
///
|
||||||
/// If this is not provided, the request must be signed by the homeserver which controls
|
/// If this is not provided, the request must be signed by the homeserver which controls
|
||||||
/// the `mxid`.
|
/// the `mxid`.
|
||||||
#[serde(flatten)]
|
#[serde(flatten, skip_serializing_if = "Option::is_none")]
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub threepid_ownership_proof: Option<&'a ThreePidOwnershipProof>,
|
pub threepid_ownership_proof: Option<&'a ThreePidOwnershipProof>,
|
||||||
|
|
||||||
/// The Matrix user ID to remove from the 3PIDs.
|
/// The Matrix user ID to remove from the 3PIDs.
|
||||||
pub mxid: &'a UserId,
|
pub mxid: &'a UserId,
|
||||||
|
|
||||||
/// The 3PID to remove. Must match the 3PID used to generate the session if using `sid` and
|
/// The 3PID to remove.
|
||||||
/// `client_secret` to authenticate this request.
|
///
|
||||||
|
/// Must match the 3PID used to generate the session if using `sid` and `client_secret` to
|
||||||
|
/// authenticate this request.
|
||||||
pub threepid: &'a ThirdPartyId,
|
pub threepid: &'a ThirdPartyId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,15 +17,18 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
request: {
|
request: {
|
||||||
/// An access token the consumer may use to verify the identity of the
|
/// An access token the consumer may use to verify the identity of the person who generated
|
||||||
/// person who generated the token. This is given to the federation API
|
/// the token.
|
||||||
/// GET /openid/userinfo to verify the user's identity.
|
///
|
||||||
|
/// This is given to the federation API `GET /openid/userinfo` to verify the user's
|
||||||
|
/// identity.
|
||||||
pub access_token: &'a str,
|
pub access_token: &'a str,
|
||||||
|
|
||||||
/// The string `Bearer`.
|
/// The string `Bearer`.
|
||||||
pub token_type: TokenType,
|
pub token_type: TokenType,
|
||||||
|
|
||||||
/// The homeserver domain the consumer should use when attempting to verify the user's identity.
|
/// The homeserver domain the consumer should use when attempting to verify the user's
|
||||||
|
/// identity.
|
||||||
pub matrix_server_name: &'a ServerName,
|
pub matrix_server_name: &'a ServerName,
|
||||||
|
|
||||||
/// The number of seconds before this token expires and a new one must be generated.
|
/// The number of seconds before this token expires and a new one must be generated.
|
||||||
@ -34,7 +37,8 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
/// An opaque string representing the token to authenticate future requests to the identity server with.
|
/// An opaque string representing the token to authenticate future requests to the identity
|
||||||
|
/// server with.
|
||||||
pub token: String,
|
pub token: String,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,15 +64,18 @@ ruma_api! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
/// The generated token. Must be a string consisting of the characters `[0-9a-zA-Z.=_-]`.
|
/// The generated token.
|
||||||
///
|
///
|
||||||
/// Its length must not exceed 255 characters and it must not be empty.
|
/// Must be a string consisting of the characters `[0-9a-zA-Z.=_-]`. Its length must not
|
||||||
|
/// exceed 255 characters and it must not be empty.
|
||||||
pub token: String,
|
pub token: String,
|
||||||
|
|
||||||
/// A list of [server's long-term public key, generated ephemeral public key].
|
/// A list of [server's long-term public key, generated ephemeral public key].
|
||||||
pub public_keys: PublicKeys,
|
pub public_keys: PublicKeys,
|
||||||
|
|
||||||
/// The generated (redacted) display_name. An example is `f...@b...`.
|
/// The generated (redacted) display_name.
|
||||||
|
///
|
||||||
|
/// An example is `f...@b...`.
|
||||||
pub display_name: String,
|
pub display_name: String,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,9 @@ ruma_api! {
|
|||||||
/// Servers SHOULD rotate this string often.
|
/// Servers SHOULD rotate this string often.
|
||||||
pub lookup_pepper: String,
|
pub lookup_pepper: String,
|
||||||
|
|
||||||
/// The algorithms the server supports. Must contain at least `sha256`.
|
/// The algorithms the server supports.
|
||||||
|
///
|
||||||
|
/// Must contain at least `sha256`.
|
||||||
pub algorithms: Vec<IdentifierHashingAlgorithm>,
|
pub algorithms: Vec<IdentifierHashingAlgorithm>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,15 +26,18 @@ ruma_api! {
|
|||||||
/// make use of it.
|
/// make use of it.
|
||||||
pub pepper: &'a str,
|
pub pepper: &'a str,
|
||||||
|
|
||||||
/// The addresses to look up. The format of the entries here depend on the `algorithm`
|
/// The addresses to look up.
|
||||||
/// used. Note that queries which have been incorrectly hashed or formatted will lead to no
|
///
|
||||||
/// matches.
|
/// The format of the entries here depend on the `algorithm` used. Note that queries which
|
||||||
|
/// have been incorrectly hashed or formatted will lead to no matches.
|
||||||
pub addresses: &'a [String],
|
pub addresses: &'a [String],
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
/// Any applicable mappings of `addresses` to Matrix User IDs. Addresses which do not have
|
/// Any applicable mappings of `addresses` to Matrix User IDs.
|
||||||
/// associations will not be included, which can make this property be an empty object.
|
///
|
||||||
|
/// Addresses which do not have associations will not be included, which can make this
|
||||||
|
/// property be an empty object.
|
||||||
pub mappings: BTreeMap<String, UserId>,
|
pub mappings: BTreeMap<String, UserId>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,14 +204,16 @@ pub struct Device {
|
|||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub pushkey_ts: Option<SecondsSinceUnixEpoch>,
|
pub pushkey_ts: Option<SecondsSinceUnixEpoch>,
|
||||||
|
|
||||||
/// A dictionary of additional pusher-specific data. For 'http' pushers,
|
/// A dictionary of additional pusher-specific data.
|
||||||
/// this is the data dictionary passed in at pusher creation minus the `url`
|
///
|
||||||
/// key.
|
/// For 'http' pushers, this is the data dictionary passed in at pusher creation minus the
|
||||||
|
/// `url` key.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub data: Option<PusherData>,
|
pub data: Option<PusherData>,
|
||||||
|
|
||||||
/// A dictionary of customisations made to the way this notification is to
|
/// A dictionary of customisations made to the way this notification is to be presented.
|
||||||
/// be presented. These are added by push rules.
|
///
|
||||||
|
/// These are added by push rules.
|
||||||
#[serde(with = "tweak_serde", skip_serializing_if = "Vec::is_empty")]
|
#[serde(with = "tweak_serde", skip_serializing_if = "Vec::is_empty")]
|
||||||
pub tweaks: Vec<Tweak>,
|
pub tweaks: Vec<Tweak>,
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,10 @@ mod serialize_as_ref_str;
|
|||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
/// Derive the `Outgoing` trait, possibly generating an 'Incoming' version of the struct this
|
/// Derive the `Outgoing` trait, possibly generating an 'Incoming' version of the struct this
|
||||||
/// derive macro is used on. Specifically, if no lifetime variables are used on any of the fields
|
/// derive macro is used on.
|
||||||
/// of the struct, this simple implementation will be generated:
|
///
|
||||||
|
/// Specifically, if no lifetime variables are used on any of the fields of the struct, this simple
|
||||||
|
/// implementation will be generated:
|
||||||
///
|
///
|
||||||
/// ```ignore
|
/// ```ignore
|
||||||
/// # // TODO: "ignore" this doctest until it is more extensively documented. (See #541)
|
/// # // TODO: "ignore" this doctest until it is more extensively documented. (See #541)
|
||||||
|
@ -767,8 +767,10 @@ pub fn redact(
|
|||||||
Ok(event)
|
Ok(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extracts the server names to check signatures for given event. It will return the sender's
|
/// Extracts the server names to check signatures for given event.
|
||||||
/// server (unless it's a third party invite) and the event id server (on v1 and v2 room versions)
|
///
|
||||||
|
/// It will return the sender's server (unless it's a third party invite) and the event id server
|
||||||
|
/// (on v1 and v2 room versions)
|
||||||
fn servers_to_check_signatures(
|
fn servers_to_check_signatures(
|
||||||
object: &CanonicalJsonObject,
|
object: &CanonicalJsonObject,
|
||||||
version: &RoomVersionId,
|
version: &RoomVersionId,
|
||||||
|
@ -33,8 +33,10 @@ pub type StateMap<T> = HashMap<(EventType, String), T>;
|
|||||||
/// A mapping of `EventId` to `T`, usually a `ServerPdu`.
|
/// A mapping of `EventId` to `T`, usually a `ServerPdu`.
|
||||||
type EventMap<T> = HashMap<EventId, T>;
|
type EventMap<T> = HashMap<EventId, T>;
|
||||||
|
|
||||||
/// Resolve sets of state events as they come in. Internally `StateResolution` builds a graph and an
|
/// Resolve sets of state events as they come in.
|
||||||
/// auth chain to allow for state conflict resolution.
|
///
|
||||||
|
/// Internally `StateResolution` builds a graph and an auth chain to allow for state conflict
|
||||||
|
/// resolution.
|
||||||
///
|
///
|
||||||
/// ## Arguments
|
/// ## Arguments
|
||||||
///
|
///
|
||||||
|
@ -79,8 +79,9 @@ impl Package {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the changes for the version. If `update` is `true`, update the changelog for the release
|
/// Get the changes for the version.
|
||||||
/// of the given version.
|
///
|
||||||
|
/// If `update` is `true`, update the changelog for the release of the given version.
|
||||||
pub fn changes(&self, update: bool) -> Result<String> {
|
pub fn changes(&self, update: bool) -> Result<String> {
|
||||||
let mut changelog_path = self.manifest_path.clone();
|
let mut changelog_path = self.manifest_path.clone();
|
||||||
changelog_path.set_file_name("CHANGELOG.md");
|
changelog_path.set_file_name("CHANGELOG.md");
|
||||||
|
@ -2,7 +2,9 @@ use std::io::{stdin, stdout, BufRead, Write};
|
|||||||
|
|
||||||
use crate::Result;
|
use crate::Result;
|
||||||
|
|
||||||
/// Ask the user the given yes or no question and wait for their input. Returns `true` for yes.
|
/// Ask the user the given yes or no question and wait for their input.
|
||||||
|
///
|
||||||
|
/// Returns `true` for yes.
|
||||||
pub fn ask_yes_no(question: &str) -> Result<bool> {
|
pub fn ask_yes_no(question: &str) -> Result<bool> {
|
||||||
let mut input = String::new();
|
let mut input = String::new();
|
||||||
let stdin = stdin();
|
let stdin = stdin();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user