revolt_api 0.6.5

Open source user-first chat platform.
Documentation
/*
 * Revolt API
 *
 * Open source user-first chat platform.
 *
 * The version of the OpenAPI document: 0.6.5
 * Contact: contact@revolt.chat
 * Generated by: https://openapi-generator.tech
 */

/// MessageQuery : Filter and sort messages by time



#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct MessageQuery {
    /// Maximum number of messages to fetch  For fetching nearby messages, this is \\`(limit + 1)\\`.
    #[serde(rename = "limit", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub limit: Option<Option<i64>>,
    /// Parent channel ID
    #[serde(rename = "channel", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub channel: Option<Option<String>>,
    /// Message author ID
    #[serde(rename = "author", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub author: Option<Option<String>>,
    /// Search query
    #[serde(rename = "query", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub query: Option<Option<String>>,
    /// Message id to search around  Specifying 'nearby' ignores 'before', 'after' and 'sort'. It will also take half of limit rounded as the limits to each side. It also fetches the message ID specified.
    #[serde(rename = "nearby")]
    pub nearby: String,
    /// Message id before which messages should be fetched
    #[serde(rename = "before", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub before: Option<Option<String>>,
    /// Message id after which messages should be fetched
    #[serde(rename = "after", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub after: Option<Option<String>>,
    #[serde(rename = "sort", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub sort: Option<Option<crate::models::MessageSort>>,
}

impl MessageQuery {
    /// Filter and sort messages by time
    pub fn new(nearby: String) -> MessageQuery {
        MessageQuery {
            limit: None,
            channel: None,
            author: None,
            query: None,
            nearby,
            before: None,
            after: None,
            sort: None,
        }
    }
}