-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmodel.rs
More file actions
98 lines (88 loc) · 2.35 KB
/
model.rs
File metadata and controls
98 lines (88 loc) · 2.35 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Event {
pub config: Config,
#[serde(rename = "NextIssue")]
pub next_issue: NextIssue,
pub data: Data,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Config {
#[serde(rename = "dryRun")]
pub dry_run: bool,
#[serde(rename = "detail-type")]
pub detail_type: String,
pub resources: Vec<String>,
pub id: String,
pub source: String,
pub time: String,
pub detail: HashMap<String, serde_json::Value>,
pub region: String,
pub version: String,
pub account: String,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct NextIssue {
pub number: u32,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Data {
#[serde(rename = "Quote")]
pub quote: Quote,
#[serde(rename = "Book")]
pub book: Book,
#[serde(rename = "Sponsor")]
pub sponsor: Sponsor,
#[serde(rename = "Links")]
pub links: Vec<Link>,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Quote {
pub id: u32,
pub text: String,
pub author: String,
#[serde(rename = "authorDescription")]
pub author_description: String,
#[serde(rename = "authorUrl", skip_serializing_if = "Option::is_none")]
pub author_url: Option<String>,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Book {
pub id: String,
pub title: String,
pub author: String,
pub links: BookLinks,
#[serde(rename = "coverPicture")]
pub cover_picture: String,
pub description: String,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct BookLinks {
pub us: String,
pub uk: String,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Sponsor {
pub banner_html: String,
pub sponsored_article_html: String,
pub customer: String,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Link {
pub title: String,
pub url: String,
pub description: String,
pub image: Option<String>,
pub score: u32,
#[serde(rename = "originalImage")]
pub original_image: String,
#[serde(rename = "campaignUrls")]
pub campaign_urls: CampaignUrls,
}
#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct CampaignUrls {
pub title: String,
pub image: String,
pub description: String,
}