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

/// Channel : Representation of a channel on Revolt



#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct Channel {
    #[serde(rename = "channel_type")]
    pub channel_type: ChannelType,
    /// Unique Id
    #[serde(rename = "_id")]
    pub _id: String,
    /// Id of the user this channel belongs to
    #[serde(rename = "user")]
    pub user: String,
    /// Whether this direct message channel is currently open on both sides
    #[serde(rename = "active")]
    pub active: bool,
    /// Array of user ids participating in channel
    #[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>>,
    /// Display name of the channel
    #[serde(rename = "name")]
    pub name: String,
    /// User id of the owner of the group
    #[serde(rename = "owner")]
    pub owner: String,
    /// Channel description
    #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub description: Option<Option<String>>,
    #[serde(rename = "icon", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub icon: Option<Option<Box<crate::models::ChannelOneOf2Icon>>>,
    /// Permissions assigned to members of this group (does not apply to the owner of the group)
    #[serde(rename = "permissions", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub permissions: Option<Option<i64>>,
    /// Whether this channel is marked as not safe for work
    #[serde(rename = "nsfw", skip_serializing_if = "Option::is_none")]
    pub nsfw: Option<bool>,
    /// Id of the server this channel belongs to
    #[serde(rename = "server")]
    pub server: String,
    #[serde(rename = "default_permissions", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
    pub default_permissions: Option<Option<Box<crate::models::ChannelOneOf3DefaultPermissions>>>,
    /// Permissions assigned based on role to this channel
    #[serde(rename = "role_permissions", skip_serializing_if = "Option::is_none")]
    pub role_permissions: Option<::std::collections::HashMap<String, crate::models::OverrideField>>,
}

impl Channel {
    /// Representation of a channel on Revolt
    pub fn new(channel_type: ChannelType, _id: String, user: String, active: bool, recipients: Vec<String>, name: String, owner: String, server: String) -> Channel {
        Channel {
            channel_type,
            _id,
            user,
            active,
            recipients,
            last_message_id: None,
            name,
            owner,
            description: None,
            icon: None,
            permissions: None,
            nsfw: None,
            server,
            default_permissions: None,
            role_permissions: None,
        }
    }
}

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

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