aboutsummaryrefslogtreecommitdiff
path: root/src/models.rs
blob: 843744dd09af615a28cd2534eea671394fa95fea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use serde::Deserialize;

/// Generic Model for paginated API.
#[derive(Debug, serde::Deserialize)]
pub struct Paginated<T> {
    pub next: Option<String>,
    pub results: Vec<T>,
}

/// Model for the Search API.
#[derive(Debug, Deserialize)]
pub struct SearchResult {
    pub title: String,
    pub authors: Vec<String>,
    pub publishers: Vec<String>,
    pub cover_url: String,
}

/// Model for the EPUB API.
#[derive(Debug, Deserialize)]
pub struct EpubResponse {
    pub publication_date: String,
    pub chapters: String, // This is a URL to the chapters list
    pub files: String,    // This is a URL to the resource files
}

/// Model for chapters API.
#[derive(Debug, Deserialize)]
pub struct Chapter {
    pub ourn: String,
    pub is_skippable: bool,
}

/// Model for files API.
#[derive(Debug, Deserialize)]
pub struct FileEntry {
    pub ourn: String,
    pub url: String,
    pub full_path: String,
    pub media_type: String,
    pub filename: String,
    pub filename_ext: String,
    pub kind: String,
}