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
45
46
47
48
49
50
51
52
53
54
55
56
use serde::Deserialize;
use std::collections::HashMap;

#[derive(Debug, Clone, Deserialize)]
pub struct Account {
    pub short_name: Option<String>,
    pub author_name: Option<String>,
    pub author_url: Option<String>,
    pub access_token: Option<String>,
    pub auth_url: Option<String>,
    pub page_count: Option<i32>,
}

#[derive(Debug, Clone, Deserialize)]
pub struct PageList {
    pub total_count: i32,
    pub pages: Vec<Page>,
}

#[derive(Debug, Clone, Deserialize)]
pub struct Page {
    pub path: String,
    pub url: String,
    pub title: String,
    pub description: String,
    pub author_name: Option<String>,
    pub author_url: Option<String>,
    pub image_url: Option<String>,
    pub content: Option<Vec<Node>>,
    pub views: i32,
    pub can_edit: Option<bool>,
}

#[derive(Debug, Clone, Deserialize)]
pub struct PageViews {
    pub views: i32,
}

#[derive(Debug, Clone, Deserialize)]
#[serde(untagged)]
pub enum Node {
    Text(String),
    NodeElement(NodeElement),
}

#[derive(Debug, Clone, Deserialize)]
pub struct NodeElement {
    pub tag: String,
    pub attrs: Option<HashMap<String, String>>,
    pub children: Option<Vec<Node>>,
}

#[derive(Debug, Clone, Deserialize)]
pub struct UploadResult {
    pub src: String
}