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
 */

/// ChannelOneOf1 : Direct message channel between two users



#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct ChannelOneOf1 {
    #[serde(rename = "channel_type")]
    pub channel_type: ChannelType,
    /// Unique Id
    #[serde(rename = "_id")]
    pub _id: String,
    /// Whether this direct message channel is currently open on both sides
    #[serde(rename = "active")]
    pub active: bool,
    /// 2-tuple of user ids participating in direct message
    #[serde(rename = "recipients")]
    pub recipients: Vec<String>,
    /// Id of the last message sent in this channel
    #[serde(rename = "last_message_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub last_message_id: Option<Option<String>>,
}

impl ChannelOneOf1 {
    /// Direct message channel between two users
    pub fn new(channel_type: ChannelType, _id: String, active: bool, recipients: Vec<String>) -> ChannelOneOf1 {
        ChannelOneOf1 {
            channel_type,
            _id,
            active,
            recipients,
            last_message_id: None,
        }
    }
}

/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ChannelType {
    #[serde(rename = "DirectMessage")]
    DirectMessage,
}

impl Default for ChannelType {
    fn default() -> ChannelType {
        Self::DirectMessage
    }
}