mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-14 05:26:59 +00:00
51 lines
1.2 KiB
Rust
51 lines
1.2 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
/*#[derive(Serialize, Deserialize, Debug, Clone)]
|
|
pub struct LastMessage {
|
|
id: String,
|
|
user_id: String,
|
|
short_content: String,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
|
pub struct Channel {
|
|
#[serde(rename = "_id")]
|
|
pub id: String,
|
|
#[serde(rename = "type")]
|
|
pub channel_type: u8,
|
|
|
|
// DM: whether the DM is active
|
|
pub active: Option<bool>,
|
|
// DM + GDM: last message in channel
|
|
pub last_message: Option<LastMessage>,
|
|
// DM + GDM: recipients for channel
|
|
pub recipients: Option<Vec<String>>,
|
|
// GDM: owner of group
|
|
pub owner: Option<String>,
|
|
// GUILD: channel parent
|
|
pub guild: Option<String>,
|
|
// GUILD + GDM: channel name
|
|
pub name: Option<String>,
|
|
// GUILD + GDM: channel description
|
|
pub description: Option<String>,
|
|
}*/
|
|
|
|
#[derive(Serialize, Deserialize, Debug)]
|
|
#[serde(tag = "type")]
|
|
pub enum Channel {
|
|
DirectMessage {
|
|
#[serde(rename = "_id")]
|
|
id: String,
|
|
active: bool,
|
|
recipients: Vec<String>,
|
|
},
|
|
Group {
|
|
#[serde(rename = "_id")]
|
|
id: String,
|
|
name: String,
|
|
owner: String,
|
|
description: String,
|
|
recipients: Vec<String>,
|
|
}
|
|
}
|