siteslib/jsonb/
details.rsuse serde::{Deserialize, Serialize};
use crate::enums::content_type::ContentType;
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct Details {
#[serde(rename(serialize = "type", deserialize = "type"))]
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<ContentType>,
#[serde(skip_serializing_if = "Option::is_none")]
pub content: Option<String>,
}
impl Details {
pub fn normalize(&self) -> Self {
Self {
content_type: self.content_type.clone(),
content: if self.content.is_some() {
Option::from(self.content.clone().unwrap().replace(r#"""#, "'"))
} else {
None
},
}
}
}