pub struct HnClient { /* private fields */ }
Expand description
The API client.
Implementations§
source§impl HnClient
impl HnClient
sourcepub fn get_item(&self, id: u32) -> Result<Option<Item>>
pub fn get_item(&self, id: u32) -> Result<Option<Item>>
Return the item with the specified id.
May return None
if item id is invalid.
sourcepub fn get_user(&self, username: &str) -> Result<Option<User>>
pub fn get_user(&self, username: &str) -> Result<Option<User>>
Return the user with the specified username.
May return None
if username is invalid.
sourcepub fn get_max_item_id(&self) -> Result<u32>
pub fn get_max_item_id(&self) -> Result<u32>
Return the id of the newest item.
To get the 10 latest items, you can decrement the id 10 times.
sourcepub fn get_top_stories(&self) -> Result<Vec<u32>>
pub fn get_top_stories(&self) -> Result<Vec<u32>>
Return a list of top story item ids.
sourcepub fn get_new_stories(&self) -> Result<Vec<u32>>
pub fn get_new_stories(&self) -> Result<Vec<u32>>
Return a list of new story item ids.
sourcepub fn get_best_stories(&self) -> Result<Vec<u32>>
pub fn get_best_stories(&self) -> Result<Vec<u32>>
Return a list of best story item ids.
sourcepub fn get_ask_stories(&self) -> Result<Vec<u32>>
pub fn get_ask_stories(&self) -> Result<Vec<u32>>
Return up to 200 latest Ask HN story item ids.
sourcepub fn get_show_stories(&self) -> Result<Vec<u32>>
pub fn get_show_stories(&self) -> Result<Vec<u32>>
Return up to 200 latest Show HN story item ids.
sourcepub fn get_job_stories(&self) -> Result<Vec<u32>>
pub fn get_job_stories(&self) -> Result<Vec<u32>>
Return up to 200 latest Job story item ids.
sourcepub fn get_updates(&self) -> Result<Updates>
pub fn get_updates(&self) -> Result<Updates>
Return a list of items and users that have been updated recently.