use serde::{de::DeserializeOwned, Deserialize, Serialize};
use crate::{
atom::feed::{entry::content::Content, AtomLink},
deserializers::{default_false, default_xml_dataservices_scheme},
};
pub mod category;
pub mod content;
#[derive(Debug, Serialize, Deserialize)]
pub struct EntryCategory {
#[serde(rename = "@term")]
pub term: String,
#[serde(rename = "@scheme", default = "default_xml_dataservices_scheme")]
pub scheme: String,
#[serde(rename = "@label")]
pub label: Option<String>,
#[serde(rename = "@fixed", default = "default_false")]
pub fixed: bool,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Entry<T> {
#[serde(rename = "@etag")]
pub etag: Option<String>,
pub id: String,
pub title: String,
pub updated: String,
pub category: EntryCategory,
#[serde(rename = "link")]
pub links: Vec<AtomLink>,
pub content: Content<T>,
pub properties: Option<T>,
}
impl<T> std::str::FromStr for Entry<T>
where
T: DeserializeOwned,
{
type Err = quick_xml::DeError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
quick_xml::de::from_str(s)
}
}
#[cfg(test)]
pub mod unit_tests;