2020-04-03 18:41:53 +02:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
|
|
#[serde(deny_unknown_fields)]
|
2020-04-24 01:28:26 +02:00
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
|
2020-05-07 16:56:11 +02:00
|
|
|
pub(crate) struct Attachment {
|
|
|
|
pub(crate) id: String,
|
|
|
|
pub(crate) r#type: AttachmentType,
|
|
|
|
pub(crate) url: String,
|
|
|
|
pub(crate) preview_url: String,
|
|
|
|
pub(crate) remote_url: Option<String>,
|
|
|
|
pub(crate) text_url: Option<String>,
|
|
|
|
pub(crate) meta: Option<serde_json::Value>, // TODO - is this the best type for the API?
|
|
|
|
pub(crate) description: Option<String>,
|
|
|
|
pub(crate) blurhash: Option<String>,
|
2020-04-03 18:41:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#[serde(rename_all = "lowercase", deny_unknown_fields)]
|
2020-04-24 01:28:26 +02:00
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
|
2020-05-07 16:56:11 +02:00
|
|
|
pub(crate) enum AttachmentType {
|
2020-04-03 18:41:53 +02:00
|
|
|
Unknown,
|
|
|
|
Image,
|
|
|
|
Gifv,
|
|
|
|
Video,
|
|
|
|
Audio,
|
|
|
|
}
|