mirror of
https://github.com/TheFunny/TelegramTwitterMediaBot.git
synced 2026-10-07 01:32:13 +00:00
refactor(pixiv): keep the artwork type as the API's string
TypeModel's Illust and Manga variants existed only so serde would accept those values -- both call sites ask a single question (is this ugoira?), so the field is a String and the check is a comparison. Same for a type the API adds later: it no longer fails the whole parse.
This commit is contained in:
@@ -10,7 +10,10 @@ pub struct IllustrationModel {
|
||||
/// works (`<br />`, `<a href>`, sometimes `<p>`), empty for many.
|
||||
#[serde(default)]
|
||||
pub caption: String,
|
||||
pub r#type: TypeModel,
|
||||
/// `"illust"` / `"manga"` / `"ugoira"`; only ugoira changes how the
|
||||
/// artwork is fetched (a zip of frames to encode), so the rest is kept as
|
||||
/// the string the API sent rather than as variants nothing matches.
|
||||
pub r#type: String,
|
||||
pub image_urls: ImageUrlsModel,
|
||||
pub user: UserInfoModel,
|
||||
pub tags: Vec<IllustrationTagModel>,
|
||||
@@ -22,16 +25,6 @@ pub struct IllustrationModel {
|
||||
pub meta_pages: Vec<MetaPageModel>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub enum TypeModel {
|
||||
#[serde(rename = "illust")]
|
||||
Illust,
|
||||
#[serde(rename = "manga")]
|
||||
Manga,
|
||||
#[serde(rename = "ugoira")]
|
||||
Ugoira,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub struct UserInfoModel {
|
||||
pub id: u64,
|
||||
|
||||
Reference in New Issue
Block a user