Documentation
¶
Index ¶
- func GetAskStories() ([]int, error)
- func GetBestStories() ([]int, error)
- func GetJobStories() ([]int, error)
- func GetLatestItemId() (int, error)
- func GetNewStories() ([]int, error)
- func GetShowStories() ([]int, error)
- func GetStoryIds(url string) ([]int, error)
- func GetTopStories() ([]int, error)
- func IterateItemsByBatch(batchSize int, cb func(batch []*Item) (bool, error)) error
- type FullStory
- type Item
- type ItemType
- type UnixTime
- type Updates
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLatestItemId ¶
GetLatestItemId returns the current largest item id from the Hacker News API.
func GetStoryIds ¶
GetStoryIds retrieves story ids from the given url.
Types ¶
type FullStory ¶
func FetchFullStory ¶
type Item ¶
type Item struct { ID int `json:"id"` // The item's unique id. Deleted bool `json:"deleted,omitempty"` // true if the item is deleted. Type ItemType `json:"type"` // The type of item. One of "job", "story", "comment", "poll", or "pollopt". By string `json:"by,omitempty"` // The username of the item's author. Time UnixTime `json:"time"` // Creation date of the item, in Unix Time. Text string `json:"text,omitempty"` // The comment, story or poll text. HTML. Dead bool `json:"dead,omitempty"` // true if the item is dead. Parent int `json:"parent,omitempty"` // The comment's parent: either another comment or the relevant story. Poll int `json:"poll,omitempty"` // The pollopt's associated poll. Kids []int `json:"kids,omitempty"` // The ids of the item's comments, in ranked display order. URL string `json:"url,omitempty"` // The URL of the story. Score int `json:"score,omitempty"` // The story's score, or the votes for a pollopt. Title string `json:"title,omitempty"` // The title of the story, poll or job. HTML. Parts []int `json:"parts,omitempty"` // A list of related pollopts, in display order. Descendants int `json:"descendants,omitempty"` // In the case of stories or polls, the total comment count. }
type UnixTime ¶
type UnixTime int64
func (*UnixTime) UnmarshalJSON ¶
UnmarshalJSON converts a Unix timestamp to UnixTime during JSON unmarshaling.
type Updates ¶
type Updates struct { Items []int `json:"items"` // List of updated item IDs Profiles []string `json:"profiles"` // List of updated profile usernames }
Updates represents the updated items and profiles.
type User ¶
type User struct { // The user's unique username. Case-sensitive. Id string `json:"id"` // Creation date of the user, in Unix Time. Created int64 `json:"created"` // The user's karma. Karma int `json:"karma"` // The user's optional self-description. HTML. About string `json:"about"` // List of the user's stories, polls and comments. Submitted []int `json:"submitted"` }
Click to show internal directories.
Click to hide internal directories.