nhentairs/src/structs.rs

64 lines
1.3 KiB
Rust

use serde::Deserialize;
#[derive(Deserialize, Debug)]
pub struct GalleryTitleInfo {
pub english: Option<String>,
pub japanese: Option<String>,
pub pretty: Option<String>,
}
#[derive(Deserialize, Debug)]
pub struct GalleryImageInfo {
pub t: String,
pub w: usize,
pub h: usize
}
#[derive(Deserialize, Debug)]
pub struct GalleryImagesInfo {
pub pages: Vec<GalleryImageInfo>,
pub cover: GalleryImageInfo,
pub thumbnail: GalleryImageInfo
}
#[derive(Deserialize, Debug)]
pub struct GalleryTagInfo {
pub id: usize,
pub r#type: String,
pub name: String,
pub url: String,
pub count: usize
}
#[derive(Deserialize, Debug)]
pub struct GalleryInfoSuccess {
pub id: usize,
pub media_id: String,
pub title: GalleryTitleInfo,
pub images: GalleryImagesInfo,
pub scanlator: String,
pub upload_date: usize,
pub tags: Vec<GalleryTagInfo>,
pub num_pages: usize,
pub num_favorites: usize
}
#[derive(Deserialize, Debug)]
pub struct GalleryInfoError {
pub error: String
}
#[derive(Deserialize, Debug)]
#[serde(untagged)]
pub enum GalleryInfo {
Info(GalleryInfoSuccess),
Error(GalleryInfoError)
}
#[derive(Deserialize, Debug)]
pub struct SearchInfo {
pub result: Vec<GalleryInfoSuccess>,
pub num_pages: usize,
pub per_page: usize
}