use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Deserialize, Serialize)] pub struct CookieRequest { pub name: String, pub value: String } impl CookieRequest { pub fn new(name: S, value: S) -> Self where S: Into { Self { name: name.into(), value: value.into() } } } impl From<(String, String)> for CookieRequest { fn from(value: (String, String)) -> Self { Self { name: value.0, value: value.1 } } } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct SubmissionRequest { pub cookies: Vec, pub bbcode: bool } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Author { pub name: String, pub status: String, pub title: String, pub avatar_url: String, // pub join_date: DateTime, pub join_date: String, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Stats { pub views: i32, pub comments: i32, pub favorites: i32, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct UserFolder { pub name: String, pub url: String, pub group: String, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Replies { id: i32, author: Author, text: String, replies: Vec, reply_to: i32, edited: bool, hidden: bool, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Comment { pub id: i32, pub author: Author, // pub date: DateTime, pub date: String, pub text: String, pub replies: Vec, pub reply_to: Option, pub edited: bool, pub hidden: bool, } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Submission { pub id: i32, pub title: String, pub author: Author, // pub date: DateTime, pub date: String, pub tags: Vec, pub category: String, pub species: String, pub gender: String, pub rating: String, #[serde(rename = "type")] pub submission_type: String, pub stats: Stats, pub description: String, pub footer: String, pub mentions: Vec, pub folder: String, pub user_folders: Vec, pub file_url: String, pub thumbnail_url: String, pub comments: Vec, pub prev: Option, pub next: Option, pub favorite: bool, pub favorite_toggle_link: String, } /*#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] #[serde(untagged, rename_all = "lowercase")] pub enum SubmissionType { #[serde(untagged)] Image }*/