From 7d752a9fedffa07d1bdf5cd19483cf9dced92ed6 Mon Sep 17 00:00:00 2001 From: Paul Woolcock Date: Mon, 10 Sep 2018 05:49:38 -0400 Subject: [PATCH] Adds the `replies_count` property to Status Closes #73 --- examples/home_timeline.rs | 24 ++++++++++++++++++++++++ src/entities/status.rs | 2 ++ 2 files changed, 26 insertions(+) create mode 100644 examples/home_timeline.rs diff --git a/examples/home_timeline.rs b/examples/home_timeline.rs new file mode 100644 index 0000000..48da6f4 --- /dev/null +++ b/examples/home_timeline.rs @@ -0,0 +1,24 @@ +#![cfg_attr(not(feature = "toml"), allow(dead_code))] +#![cfg_attr(not(feature = "toml"), allow(unused_imports))] +mod register; + +use register::MastodonClient; +use std::error; + +#[cfg(feature = "toml")] +fn main() -> Result<(), Box> { + let mastodon = register::get_mastodon_data()?; + let tl = mastodon.get_home_timeline()?; + + println!("{:#?}", tl); + + Ok(()) +} + +#[cfg(not(feature = "toml"))] +fn main() { + println!( + "examples require the `toml` feature, run this command for this example:\n\ncargo run \ + --example print_your_profile --features toml\n" + ); +} diff --git a/src/entities/status.rs b/src/entities/status.rs index c2f9f6f..0f66a7f 100644 --- a/src/entities/status.rs +++ b/src/entities/status.rs @@ -30,6 +30,8 @@ pub struct Status { pub created_at: DateTime, /// An array of Emoji pub emojis: Vec, + /// The numbef or replies to this status. + pub replies_count: u64, /// The number of reblogs for the status. pub reblogs_count: u64, /// The number of favourites for the status.