#hacker-news #api-bindings #public-api #sdk #open-api #data #sideko

sideko_hacker_news

Rust API bindings - ssideko_hacker_news

2 unstable releases

0.2.0 Dec 1, 2023
0.1.0 Oct 12, 2023

#7 in #hacker-news

MIT license

24KB
446 lines

sideko_hacker_news rust

Hacker News makes the public their data available in near real time.

The v0 API is essentially a dump of our in-memory data structures. We know, what works great locally in memory isn't so hot over the network. Many of the awkward things are just the way HN works internally... It's not the ideal public API, but it's the one we could release in the time we had

This documentation and SDK libraries have been generated by Sideko which has no affiliation with Hacker News. Everything you see is generated from an OpenAPI specification.

Install and try the free beta SDK generator on our Github.

Authentication

use sideko_hacker_news::Client;
let client = Client::default();

get_ask_story_ids

List the latest Ask HN story IDs. Will return maximum 200 IDs.

Documentation & SDKs generated by Sideko from OpenAPI. Install and try the free beta SDK generator on our Github.


let response = client.get_ask_story_ids(GetAskstoriesJsonRequest {..Default::default()});

get_best_story_ids

List the best hacker news story IDs. Will return maximum 500 IDs.

Documentation & SDKs generated by Sideko from OpenAPI. Install and try the free beta SDK generator on our Github.


let response = client.get_best_story_ids(GetBeststoriesJsonRequest {..Default::default()});

get_item

Stories, Comments, Jobs, Ask HNs and even Polls are all considered items, with slightly different structures (see the examples).

Documentation & SDKs generated by Sideko from OpenAPI. Install and try the free beta SDK generator on our Github.


let response = client.get_item(GetItemIdJsonRequest {id: 123, ..Default::default()});

get_job_story_ids

List the latest Job story IDs. Will return maximum 200 IDs.

Documentation & SDKs generated by Sideko from OpenAPI. Install and try the free beta SDK generator on our Github.


let response = client.get_job_story_ids(GetJobstoriesJsonRequest {..Default::default()});

get_max_item_id

The current largest item ID. Walking backwards from here allows you to list all items avialable through the API.

Documentation & SDKs generated by Sideko from OpenAPI. Install and try the free beta SDK generator on our Github.


let response = client.get_max_item_id(GetMaxitemJsonRequest {..Default::default()});

get_new_story_ids

List the top hacker news story IDs. Will return maximum 500 IDs.

Documentation & SDKs generated by Sideko from OpenAPI. Install and try the free beta SDK generator on our Github.


let response = client.get_new_story_ids(GetNewstoriesJsonRequest {..Default::default()});

get_show_story_ids

List the latest Show HN story IDs. Will return maximum 200 IDs.

Documentation & SDKs generated by Sideko from OpenAPI. Install and try the free beta SDK generator on our Github.


let response = client.get_show_story_ids(GetShowstoriesJsonRequest {..Default::default()});

get_top_story_ids

List the top hacker news story IDs. Will return maximum 500 IDs.

Documentation & SDKs generated by Sideko from OpenAPI. Install and try the free beta SDK generator on our Github.


let response = client.get_top_story_ids(GetTopstoriesJsonRequest {..Default::default()});

get_updates

List recently updated item IDs and profile IDs.

Documentation & SDKs generated by Sideko from OpenAPI. Install and try the free beta SDK generator on our Github.


let response = client.get_updates(GetUpdatesJsonRequest {..Default::default()});

get_user

Retrieves user metadata given the user ID (HN username).

Documentation & SDKs generated by Sideko from OpenAPI. Install and try the free beta SDK generator on our Github.


let response = client.get_user(GetUserIdJsonRequest {id: "string".to_string(), ..Default::default()});

Dependencies

~5–16MB
~220K SLoC