Documentation ¶
Overview ¶
Package hackernews provides an API wrapper around the HackerNews API. Some of these codes are taken from https://github.com/peterhellberg/hn. The API reference is in https://github.com/HackerNews/API.
Index ¶
Constants ¶
View Source
const BaseEndpoint = "https://hacker-news.firebaseio.com/v0"
BaseEndpoint is the base endpoint used by the Client.
Variables ¶
View Source
var DefaultClient = &Client{ Client: *http.DefaultClient, }
DefaultClient is the default HackerNews client.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is a HackerNews client.
func (*Client) Get ¶
Get gets the given path (concatenated after BaseEndpoint) and unmarshals the body into jsonVal if it's not nil.
type Item ¶
type Item struct { ID ItemID `json:"id"` Deleted bool `json:"deleted"` // Type is the item's type. Type ItemType `json:"type"` // By is the author's username. By string `json:"by"` // Time is the creation time. Time UnixTime `json:"time"` // Text is the comment, story or poll text in HTML. Text string `json:"text"` // Dead is true if the item is dead. Dead bool `json:"dead"` // Parent is the comment's parent, which is another comment or relevant // story. Parent ItemID `json:"parent"` // Kids is the IDs of the item's comments in ranked display order. Kids []ItemID `json:"kids"` // URL is the URL of the story. URL string `json:"url"` // Score is the story's score or the votes for a pollopt. Score int `json:"score"` // Title is the title of the story in HTML. Title string `json:"title"` // Parts is the list of relateed pollopts, in display order. Parts []ItemID `json:"parts"` // Descendants is the total comment count in case of stories or polls. Descendants int `json:"descendants"` }
Item represents an item.
Directories ¶
Path | Synopsis |
---|---|
Package hnhtml implements an HTML-to-Pango-markup translator that translates a small subset of HTML, enough to view HackerNews posts.
|
Package hnhtml implements an HTML-to-Pango-markup translator that translates a small subset of HTML, enough to view HackerNews posts. |
Click to show internal directories.
Click to hide internal directories.