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.
Auto Trait Implementations§
impl Freeze for HnClient
impl !RefUnwindSafe for HnClient
impl Send for HnClient
impl Sync for HnClient
impl Unpin for HnClient
impl !UnwindSafe for HnClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more