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
57
58
59
60
61
62
63
64
65
66
use chrono::NaiveDateTime;
use serde::{
    Deserialize,
    Serialize,
};
use std::collections::HashMap;
use url::Url;

/// A wordpress post
///
#[derive(Debug, Serialize, Deserialize)]
pub struct Post {
    pub date: NaiveDateTime,
    pub date_gmt: NaiveDateTime,
    guid: serde_json::Value,
    pub id: u64,
    pub link: Url,
    pub modified: NaiveDateTime,
    pub modified_gmt: NaiveDateTime,
    pub slug: String,
    pub status: String,
    #[serde(rename = "type")]
    kind: serde_json::Value,
    pub password: Option<String>,
    pub permalink_template: Option<String>,
    pub generated_slug: Option<String>,
    pub title: PostTitle,
    pub content: PostContent,
    pub author: u64,
    excerpt: serde_json::Value,
    pub featured_media: u64,
    pub comment_status: String,
    pub ping_status: String,
    pub format: Option<String>,
    meta: serde_json::Value,
    pub sticky: Option<bool>,
    pub template: String,
    pub categories: Option<Vec<u64>>,
    tags: Option<Vec<serde_json::Value>>,

    /// Unknown KVs
    ///
    #[serde(flatten)]
    pub unknown: HashMap<String, serde_json::Value>,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct PostTitle {
    pub rendered: String,

    /// Unknown KVs
    ///
    #[serde(flatten)]
    pub unknown: HashMap<String, serde_json::Value>,
}

#[derive(Debug, Serialize, Deserialize)]
pub struct PostContent {
    pub rendered: String,
    pub protected: bool,

    /// Unknown KVs
    ///
    #[serde(flatten)]
    pub unknown: HashMap<String, serde_json::Value>,
}