2025-01-27 20:34:08 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
|
|
pub struct CookieRequest {
|
|
|
|
pub name: String,
|
|
|
|
pub value: String
|
|
|
|
}
|
|
|
|
|
|
|
|
impl CookieRequest {
|
|
|
|
pub fn new<S>(name: S, value: S) -> Self where S: Into<String> {
|
|
|
|
Self { name: name.into(), value: value.into() }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-01-27 22:41:00 +00:00
|
|
|
impl From<(String, String)> for CookieRequest {
|
|
|
|
fn from(value: (String, String)) -> Self {
|
|
|
|
Self { name: value.0, value: value.1 }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-01-27 20:34:08 +00:00
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
|
|
pub struct SubmissionRequest {
|
|
|
|
pub cookies: Vec<CookieRequest>,
|
|
|
|
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<Utc>,
|
|
|
|
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<Replies>,
|
|
|
|
reply_to: i32,
|
|
|
|
edited: bool,
|
|
|
|
hidden: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
|
|
pub struct Comment {
|
|
|
|
pub id: i32,
|
|
|
|
pub author: Author,
|
|
|
|
// pub date: DateTime<Utc>,
|
|
|
|
pub date: String,
|
|
|
|
pub text: String,
|
|
|
|
pub replies: Vec<Replies>,
|
|
|
|
pub reply_to: Option<i32>,
|
|
|
|
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<Utc>,
|
|
|
|
pub date: String,
|
|
|
|
pub tags: Vec<String>,
|
|
|
|
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<String>,
|
|
|
|
pub folder: String,
|
|
|
|
pub user_folders: Vec<UserFolder>,
|
|
|
|
pub file_url: String,
|
|
|
|
pub thumbnail_url: String,
|
|
|
|
pub comments: Vec<Comment>,
|
|
|
|
pub prev: Option<i32>,
|
|
|
|
pub next: Option<i32>,
|
|
|
|
pub favorite: bool,
|
|
|
|
pub favorite_toggle_link: String,
|
2025-01-27 22:41:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
|
|
|
|
#[serde(untagged, rename_all = "lowercase")]
|
|
|
|
pub enum SubmissionType {
|
|
|
|
#[serde(untagged)]
|
|
|
|
Image
|
|
|
|
}*/
|