use rss_gen::{
generate_atom, AtomEntry, AtomFeed, AtomLink, AtomPerson,
};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let feed = AtomFeed::new()
.id("urn:example:atom-demo")
.title("rss-gen Atom demo")
.subtitle("Showcases the surface added in v0.0.6")
.updated("2026-06-28T00:00:00Z")
.language("en-GB")
.generator("rss-gen example_atom")
.add_author(
AtomPerson::new("Jane Doe")
.email("jane@example.com")
.uri("https://example.com/~jane"),
)
.add_author(AtomPerson::new("Sam Roe"))
.add_contributor(AtomPerson::new("Ada Reviewer"))
.self_link("https://example.com/atom.xml")
.alternate_link("https://example.com/")
.add_category("rust")
.add_category("syndication")
.add_entry(
AtomEntry::new()
.id("https://example.com/post-1")
.title("Hello, Atom")
.updated("2026-06-28T00:00:00Z")
.published("2026-06-27T12:00:00Z")
.summary("Plain-text summary of the post.")
.content_html(
"<p>HTML content body — type=\"html\".</p>",
)
.alternate_link("https://example.com/post-1")
.add_category("intro"),
)
.add_entry(
AtomEntry::new()
.id("https://example.com/ep-1")
.title("Episode 1")
.updated("2026-06-28T00:00:00Z")
.summary("Pilot episode")
.add_enclosure(
"https://example.com/ep-1.mp3",
"audio/mpeg",
12_345_678,
)
.add_link(
AtomLink::alternate("https://example.com/ep-1")
.title("Show notes"),
),
);
let xml = generate_atom(&feed)?;
println!("{xml}");
Ok(())
}