Compact more serde attributes
This commit is contained in:
parent
71fc531897
commit
4e319ae27e
@ -85,13 +85,12 @@ pub struct AuthenticationData {
|
||||
|
||||
/// The kind of account being registered.
|
||||
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum RegistrationKind {
|
||||
/// A guest account
|
||||
///
|
||||
/// These accounts may have limited permissions and may not be supported by all servers.
|
||||
#[serde(rename = "guest")]
|
||||
Guest,
|
||||
/// A regular user account
|
||||
#[serde(rename = "user")]
|
||||
User,
|
||||
}
|
||||
|
@ -9,12 +9,11 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Format to use for returned events
|
||||
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum EventFormat {
|
||||
/// Client format, as described in the Client API.
|
||||
#[serde(rename = "client")]
|
||||
Client,
|
||||
/// Raw events from federation.
|
||||
#[serde(rename = "federation")]
|
||||
Federation,
|
||||
}
|
||||
|
||||
@ -26,15 +25,13 @@ pub struct RoomEventFilter {
|
||||
/// If this list is absent then no event types are excluded. A matching type will be excluded
|
||||
/// even if it is listed in the 'types' filter. A '*' can be used as a wildcard to match any
|
||||
/// sequence of characters.
|
||||
#[serde(skip_serializing_if = "Vec::is_empty")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub not_types: Vec<String>,
|
||||
/// A list of room IDs to exclude.
|
||||
///
|
||||
/// If this list is absent then no rooms are excluded. A matching room will be excluded even if
|
||||
/// it is listed in the 'rooms' filter.
|
||||
#[serde(skip_serializing_if = "Vec::is_empty")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub not_rooms: Vec<String>,
|
||||
/// The maximum number of events to return.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
@ -42,28 +39,24 @@ pub struct RoomEventFilter {
|
||||
/// A list of room IDs to include.
|
||||
///
|
||||
/// If this list is absent then all rooms are included.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub rooms: Option<Vec<RoomId>>,
|
||||
/// A list of sender IDs to exclude.
|
||||
///
|
||||
/// If this list is absent then no senders are excluded. A matching sender will be excluded even
|
||||
/// if it is listed in the 'senders' filter.
|
||||
#[serde(skip_serializing_if = "Vec::is_empty")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub not_senders: Vec<UserId>,
|
||||
/// A list of senders IDs to include.
|
||||
///
|
||||
/// If this list is absent then all senders are included.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub senders: Option<Vec<UserId>>,
|
||||
/// A list of event types to include.
|
||||
///
|
||||
/// If this list is absent then all event types are included. A '*' can be used as a wildcard to
|
||||
/// match any sequence of characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub types: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
@ -93,15 +86,13 @@ pub struct RoomFilter {
|
||||
/// If this list is absent then no rooms are excluded. A matching room will be excluded even if
|
||||
/// it is listed in the 'rooms' filter. This filter is applied before the filters in
|
||||
/// `ephemeral`, `state`, `timeline` or `account_data`.
|
||||
#[serde(skip_serializing_if = "Vec::is_empty")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub not_rooms: Vec<RoomId>,
|
||||
/// A list of room IDs to include.
|
||||
///
|
||||
/// If this list is absent then all rooms are included. This filter is applied before the
|
||||
/// filters in `ephemeral`, `state`, `timeline` or `account_data`.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub rooms: Option<Vec<RoomId>>,
|
||||
}
|
||||
|
||||
@ -113,8 +104,7 @@ pub struct Filter {
|
||||
/// If this list is absent then no event types are excluded. A matching type will be excluded
|
||||
/// even if it is listed in the 'types' filter. A '*' can be used as a wildcard to match any
|
||||
/// sequence of characters.
|
||||
#[serde(skip_serializing_if = "Vec::is_empty")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub not_types: Vec<String>,
|
||||
/// The maximum number of events to return.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
@ -122,22 +112,19 @@ pub struct Filter {
|
||||
/// A list of senders IDs to include.
|
||||
///
|
||||
/// If this list is absent then all senders are included.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub senders: Option<Vec<UserId>>,
|
||||
/// A list of event types to include.
|
||||
///
|
||||
/// If this list is absent then all event types are included. A '*' can be used as a wildcard to
|
||||
/// match any sequence of characters.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub types: Option<Vec<String>>,
|
||||
/// A list of sender IDs to exclude.
|
||||
///
|
||||
/// If this list is absent then no senders are excluded. A matching sender will be excluded even
|
||||
/// if it is listed in the 'senders' filter.
|
||||
#[serde(skip_serializing_if = "Vec::is_empty")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub not_senders: Vec<UserId>,
|
||||
}
|
||||
|
||||
@ -150,8 +137,7 @@ pub struct FilterDefinition {
|
||||
/// to indicate sub-fields. So ['content.body'] will include the 'body' field of the 'content'
|
||||
/// object. A literal '.' character in a field name may be escaped using a '\'. A server may
|
||||
/// include more fields than were requested.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub event_fields: Option<Vec<String>>,
|
||||
/// The format to use for events.
|
||||
///
|
||||
|
@ -6,12 +6,11 @@ use serde::{Deserialize, Serialize};
|
||||
|
||||
/// The desired resizing method.
|
||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum Method {
|
||||
/// Crop the original to produce the requested image dimensions.
|
||||
#[serde(rename = "crop")]
|
||||
Crop,
|
||||
/// Maintain the original aspect ratio of the source image.
|
||||
#[serde(rename = "scale")]
|
||||
Scale,
|
||||
}
|
||||
|
||||
|
@ -15,12 +15,10 @@ ruma_api! {
|
||||
|
||||
request {
|
||||
/// A list of user IDs to remove from the list.
|
||||
#[serde(skip_serializing_if = "Vec::is_empty")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub drop: Vec<UserId>,
|
||||
/// A list of user IDs to add to the list.
|
||||
#[serde(skip_serializing_if = "Vec::is_empty")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub invite: Vec<UserId>,
|
||||
/// The user whose presence state will be updated.
|
||||
#[ruma_api(path)]
|
||||
|
@ -21,8 +21,7 @@ ruma_api! {
|
||||
/// A list of user IDs to invite to the room.
|
||||
///
|
||||
/// This will tell the server to invite everyone in the list to the newly created room.
|
||||
#[serde(skip_serializing_if = "Vec::is_empty")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub invite: Vec<UserId>,
|
||||
/// If this is included, an `m.room.name` event will be sent into the room to indicate
|
||||
/// the name of the room.
|
||||
|
@ -62,8 +62,7 @@ pub struct Criteria {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub include_state: Option<bool>,
|
||||
/// The keys to search for. Defaults to all keys.
|
||||
#[serde(skip_serializing_if = "Vec::is_empty")]
|
||||
#[serde(default)]
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub keys: Vec<SearchKeys>,
|
||||
/// The order in which to search for results.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
@ -112,12 +111,11 @@ pub struct Grouping {
|
||||
|
||||
/// The key within events to use for this grouping.
|
||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum GroupingKey {
|
||||
/// `room_id`
|
||||
#[serde(rename = "room_id")]
|
||||
RoomId,
|
||||
/// `sender`
|
||||
#[serde(rename = "sender")]
|
||||
Sender,
|
||||
}
|
||||
|
||||
@ -144,13 +142,12 @@ pub enum SearchKeys {
|
||||
|
||||
/// The order in which to search for results.
|
||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum OrderBy {
|
||||
/// Prioritize events by a numerical ranking of how closely they matched the search
|
||||
/// criteria.
|
||||
#[serde(rename = "rank")]
|
||||
Rank,
|
||||
/// Prioritize recent events.
|
||||
#[serde(rename = "recent")]
|
||||
Recent,
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user