parse_book_source/
model.rs1use serde::{Deserialize, Serialize};
4use std::collections::BTreeMap;
5
6#[derive(Debug, Clone, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
12pub struct ExploreEntry {
13 pub title: String,
14 pub vars: BTreeMap<String, String>,
15}
16
17#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
19pub struct Chapter {
20 pub title: String,
21 pub url: String,
22 #[serde(default)]
23 pub is_volume: bool,
24}
25
26#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
28pub struct Volume {
29 pub title: String,
30 pub first_chapter_index: usize,
31}
32
33#[derive(Debug, Clone, Default, PartialEq, Eq)]
35pub struct Toc {
36 pub chapters: Vec<Chapter>,
37 pub volumes: Vec<Volume>,
38}
39
40#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
42pub struct BookInfo {
43 pub name: String,
44 pub author: String,
45 pub cover: String,
46 pub intro: String,
47 pub kind: String,
48 pub last_chapter: String,
49 pub toc_url: String,
50 pub word_count: String,
51}
52
53#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
55pub struct BookListItem {
56 #[serde(flatten)]
57 pub info: BookInfo,
58 pub book_url: String,
59}
60
61#[derive(Debug, Clone, Default, PartialEq, Eq)]
68pub struct BookList {
69 pub items: Vec<BookListItem>,
70 pub total_pages: Option<u32>,
71 pub has_more: Option<bool>,
72}
73
74impl BookList {
75 pub fn new(items: Vec<BookListItem>) -> Self {
77 Self {
78 items,
79 total_pages: None,
80 has_more: None,
81 }
82 }
83}