Skip to main content

mutiny_rs/model/
file.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Serialize, Deserialize, Clone)]
4pub struct File {
5    #[serde(rename = "_id")]
6    pub id: String,
7    pub tag: String,
8    pub filename: String,
9    pub metadata: Metadata,
10    pub content_type: String,
11    pub size: usize,
12    pub deleted: Option<bool>,
13    pub reported: Option<bool>,
14    pub message_id: Option<String>,
15    pub user_id: Option<String>,
16    pub server_id: Option<String>,
17    pub object_id: Option<String>,
18}
19
20/// Metadata associated with a file
21#[derive(Debug, Serialize, Deserialize, Clone, Default)]
22#[serde(tag = "type")]
23pub enum Metadata {
24    /// File is just a generic uncategorized file
25    #[default]
26    File,
27    /// File contains textual data and should be displayed as such
28    Text,
29    /// File is an image with specific dimensions
30    Image { width: usize, height: usize },
31    /// File is a video with specific dimensions
32    Video { width: usize, height: usize },
33    /// File is audio
34    Audio,
35}