1pub mod lexicon;
2pub mod com {
3 pub mod macroblog {
4 pub mod blog {
5 pub mod post {
6 use serde::{Deserialize, Serialize};
7 use atrium_api::types::string::Datetime;
8
9 #[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
10 #[serde(rename_all = "camelCase")]
11 pub struct Record {
12 #[serde(rename = "$type")]
13 pub r#type: String,
14 pub created_at: Datetime,
15 pub title: String,
16 pub text: String,
17 #[serde(skip_serializing_if = "Option::is_none")]
18 pub tags: Option<Vec<String>>,
19 }
20
21 #[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
22 #[serde(rename_all = "camelCase")]
23 pub struct RecordData {
24 pub title: String,
25 pub text: String,
26 #[serde(skip_serializing_if = "Option::is_none")]
27 pub tags: Option<Vec<String>>,
28 }
29
30 impl From<RecordData> for Record {
31 fn from(data: RecordData) -> Self {
32 Record {
33 r#type: "com.macroblog.blog.post".to_string(),
34 created_at: Datetime::now(),
35 title: data.title,
36 text: data.text,
37 tags: data.tags,
38 }
39 }
40 }
41 }
42 }
43 }
44}