More lenient parsing

This commit is contained in:
Leonora Tindall 2022-11-01 14:15:28 -05:00
parent d39e19beb2
commit 55a2610eff
Signed by: nora
GPG Key ID: 7A8B52EC67E09AAF
1 changed files with 9 additions and 3 deletions

View File

@ -26,12 +26,13 @@ pub struct CohostPostsPage {
pub struct CohostPost { pub struct CohostPost {
#[serde(rename = "postId")] #[serde(rename = "postId")]
pub id: u64, pub id: u64,
#[serde(default)]
pub headline: String, pub headline: String,
#[serde(rename = "publishedAt")] #[serde(rename = "publishedAt")]
pub published_at: DateTime<Utc>, pub published_at: DateTime<Utc>,
pub cws: Vec<String>, pub cws: Vec<String>,
pub tags: Vec<String>, pub tags: Vec<String>,
#[serde(rename = "plainTextBody")] #[serde(rename = "plainTextBody", default)]
pub plain_body: String, pub plain_body: String,
#[serde(rename = "singlePostPageUrl")] #[serde(rename = "singlePostPageUrl")]
pub url: String, pub url: String,
@ -46,18 +47,23 @@ pub struct CohostPostingProject {
#[serde(rename = "projectId")] #[serde(rename = "projectId")]
pub id: u64, pub id: u64,
pub handle: String, pub handle: String,
#[serde(rename = "displayName")] #[serde(rename = "displayName", default)]
pub display_name: String, pub display_name: String,
#[serde(default)]
pub dek: String, pub dek: String,
#[serde(default)]
pub description: String, pub description: String,
#[serde(default)]
pub pronouns: String, pub pronouns: String,
} }
#[derive(Deserialize)] #[derive(Deserialize)]
pub struct CohostPostLink { pub struct CohostPostLink {
#[serde(default)]
pub href: String, pub href: String,
#[serde(default)]
pub rel: String, pub rel: String,
#[serde(rename = "type")] #[serde(rename = "type", default)]
pub t_type: String, pub t_type: String,
} }