Skip to content

Commit 359be0c

Browse files
committed
creating pages
1 parent 79e1e4c commit 359be0c

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

src/model.rs

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@ pub mod models {
44

55
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
66
#[allow(non_snake_case)]
7-
pub struct Extentions {
8-
#[serde(skip_serializing_if = "String::is_empty")]
9-
position: i32,
7+
pub struct Extentions<T> {
8+
#[serde(skip_serializing_if = "Option::is_none")]
9+
position: Option<T>,
1010
}
1111

12-
// #[derive(Serialize_repr, Deserialize_repr, PartialEq, Debug)]
13-
// #[repr(u8)]
14-
// enum PositionEnum {
15-
// Str = 2,
16-
// Numm = 3,
17-
// }
12+
// impl Extentions {
13+
// pub fn is_empty(option: Option<Extentions>) -> bool {
14+
// if option == None { true} else { false }
15+
// }
16+
// }
1817

1918
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
2019
#[allow(non_snake_case)]
@@ -25,12 +24,16 @@ pub mod models {
2524
Type: String,
2625
status: String,
2726
title: String,
28-
extensions: Extentions,
27+
#[serde(skip_serializing_if = "Option::is_none")]
28+
extensions: Option<Extentions<String>>,
2929
#[serde(rename(deserialize = "_expandable"))]
3030
_expandable: Expandable,
31+
version: Version,
32+
#[serde(rename(deserialize = "history"))]
33+
history: Option<CntHistory>,
3134
_links: ContentLinks,
3235
}
33-
36+
3437
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
3538
#[allow(non_snake_case)]
3639
pub struct Expandable {
@@ -39,12 +42,9 @@ pub mod models {
3942
operations: String,
4043
children: String,
4144
restrictions: String,
42-
history: String,
4345
ancestors: String,
4446
body: String,
45-
version: String,
4647
descendants: String,
47-
space: String,
4848
}
4949

5050
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
@@ -116,7 +116,6 @@ pub mod models {
116116
pub(crate) key: String,
117117
}
118118

119-
120119
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
121120
pub struct Ancestor {
122121
pub(crate) id: i32,
@@ -134,7 +133,7 @@ pub mod models {
134133
pub space: CntSpace,
135134
pub history: CntHistory,
136135
pub version: Version,
137-
pub extensions: Extentions,
136+
pub extensions: Extentions<String>,
138137
#[serde(rename = "_links")]
139138
#[serde(skip)]
140139
pub links: Links,
@@ -160,10 +159,12 @@ pub mod models {
160159
}
161160

162161
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
163-
// #[serde(rename_all = "camelCase")]
162+
#[serde(rename_all = "camelCase")]
164163
pub struct CntHistory {
165164
pub latest: bool,
165+
#[serde(rename = "createdBy")]
166166
pub created_by: CreatedBy,
167+
#[serde(rename = "createdDate")]
167168
pub created_date: String,
168169
#[serde(rename = "_links")]
169170
#[serde(skip)]
@@ -231,4 +232,4 @@ pub mod models {
231232
pub body: String,
232233
pub descendants: String,
233234
}
234-
}
235+
}

src/pages.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ pub mod page_service {
1010
.header("Accept", "application/json")
1111
.send().await.unwrap();
1212
let body = resp.text().await.unwrap();
13-
println!("{:?}", body); // todo - debug
1413
return serde_json::from_str(body.as_str()).unwrap();
1514
}
1615

0 commit comments

Comments
 (0)