nhentairs/src/structs.rs

64 lines
1.3 KiB
Rust
Raw Normal View History

2020-09-12 12:26:07 +00:00
use serde::Deserialize;
#[derive(Deserialize, Debug)]
pub struct GalleryTitleInfo {
2020-10-26 11:28:39 +00:00
pub english: Option<String>,
pub japanese: Option<String>,
pub pretty: Option<String>,
2020-09-12 12:26:07 +00:00
}
#[derive(Deserialize, Debug)]
pub struct GalleryImageInfo {
pub t: String,
2020-12-02 15:34:42 +00:00
pub w: i32,
pub h: i32
2020-09-12 12:26:07 +00:00
}
#[derive(Deserialize, Debug)]
pub struct GalleryImagesInfo {
pub pages: Vec<GalleryImageInfo>,
2020-10-26 11:28:39 +00:00
pub cover: GalleryImageInfo,
2020-09-12 12:26:07 +00:00
pub thumbnail: GalleryImageInfo
}
#[derive(Deserialize, Debug)]
pub struct GalleryTagInfo {
2020-12-02 15:34:42 +00:00
pub id: i32,
2020-09-12 12:26:07 +00:00
pub r#type: String,
pub name: String,
pub url: String,
2020-12-02 15:34:42 +00:00
pub count: i32
2020-09-12 12:26:07 +00:00
}
#[derive(Deserialize, Debug)]
pub struct GalleryInfoSuccess {
2020-12-02 15:34:42 +00:00
pub id: i32,
2020-09-12 12:26:07 +00:00
pub media_id: String,
pub title: GalleryTitleInfo,
pub images: GalleryImagesInfo,
pub scanlator: String,
2020-12-02 15:34:42 +00:00
pub upload_date: i32,
2020-09-12 12:26:07 +00:00
pub tags: Vec<GalleryTagInfo>,
2020-12-02 15:34:42 +00:00
pub num_pages: i32,
pub num_favorites: i32
2020-09-12 12:26:07 +00:00
}
#[derive(Deserialize, Debug)]
pub struct GalleryInfoError {
pub error: String
}
#[derive(Deserialize, Debug)]
#[serde(untagged)]
pub enum GalleryInfo {
Info(GalleryInfoSuccess),
Error(GalleryInfoError)
}
2020-09-12 12:26:07 +00:00
#[derive(Deserialize, Debug)]
pub struct SearchInfo {
pub result: Vec<GalleryInfoSuccess>,
2020-12-02 15:34:42 +00:00
pub num_pages: i32,
pub per_page: i32
2020-09-12 12:26:07 +00:00
}