hackernews-types

Crates.iohackernews-types
lib.rshackernews-types
version0.1.2
sourcesrc
created_at2021-05-15 11:13:34.465391
updated_at2021-05-15 12:53:33.245917
descriptionRust types representing items returned from the Hacker News API
homepage
repositoryhttps://github.com/orf/hncat
max_upload_size
id397799
size4,228
Tom Forbes (orf)

documentation

README

hackernews-types

This package contains simple types for interacting with the Hacker News API. The API documentation is not great and there are some differences. The types contained within this crate can parse every item returned from the hacker news API.

Example:

use anyhow::Result;
use reqwest;
use hackernews_types::Item;

#[tokio::main]
async fn main() -> Result<()>{
    let client = reqwest::Client::new();
    let resp = client.get("https://hacker-news.firebaseio.com/v0/item/8863.json").send().await?;
    let item: Item = resp.json().await?;
    
    println!("Item: {:?}", item);
    
    Ok(())
}
Commit count: 18

cargo fmt