1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! [Hacker News](https://news.ycombinator.com/) API bindings for Rust.
//!
//! ```compile_fail
//! let client = HackerNewsClient::new();
//!
//! // Call various endpoints with your client instance
//! let first_item = client.get_item(69).await?;
//! dbg!(&first_item);
//!
//! // Determine what the item type is
//! let item_type = first_item.get_item_type();
//! dbg!(item_type);
//!
//! // Check if the item is job
//! assert!(first_item.is_comment());
//!
//! // Retrieve user information
//! let user = client.get_user("joeymckenzie").await?;
//! dbg!(user);
//! ```
/// The ID associated to all Hacker News items and users.
type HackerNewsID = u32;
/// Current URL of the API.
pub const API_BASE_URL: &str = "https://hacker-news.firebaseio.com";
/// Item endpoint for stories, polls, news items, etc.
pub const ITEM_ENDPOINT: &str = "item";
/// User endpoint for user data and related items.
pub const USERS_ENDPOINT: &str = "user";
/// Default timeout for requests the API.
pub const DEFAULT_TIMEOUT_SECONDS: u64 = 10;