Documentation
¶
Index ¶
Constants ¶
View Source
const ( Job ItemType = "job" Story = "story" Comment = "comment" Poll = "poll" PollOpt = "pollopt" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FrontPageItemsRanking ¶
type FrontPageItemsRanking int
const ( Top FrontPageItemsRanking = iota Best New )
func (FrontPageItemsRanking) ToPointer ¶
func (r FrontPageItemsRanking) ToPointer() *FrontPageItemsRanking
type HnClient ¶
type HnClient struct {
// contains filtered or unexported fields
}
func MakeProdClient ¶
func MakeProdClient() HnClient
func (*HnClient) FetchFrontPageItemIds ¶
func (hn *HnClient) FetchFrontPageItemIds(ranking FrontPageItemsRanking, limit int) ([]ItemId, error)
func (*HnClient) Search ¶
func (hn *HnClient) Search(request SearchRequest) (*SearchResponse, error)
type HnClientBuilder ¶
type HnClientBuilder interface { SetHnUrl(string) HnClientBuilder SetSearchPopularityUrl(string) HnClientBuilder SetSearchDateUrl(string) HnClientBuilder Build() HnClient }
func NewHnClientBuilder ¶
func NewHnClientBuilder() HnClientBuilder
type Item ¶
type Item struct { // The item's unique id. Id ItemId `json:"id"` // `true` if the item is deleted. Deleted *bool `json:"deleted"` // The type of the item. One of "job", "story", "comment", "poll", or "pollopt". Type ItemType `json:"type"` // The username of the item's author. By *string `json:"by"` // Creation date of the item in Unix time. Time *int64 `json:"time"` // The comment, story, or poll text in HTML. Text *string `json:"text"` // `true` if the item is dead. Dead *bool `json:"dead"` // The comment's parent: either another comment or the relevant story. Parent *ItemId `json:"parent"` // The pollopt's associated poll. Poll *ItemId `json:"poll"` // The ids of the item's comments, in ranked display order. Kids []ItemId `json:"kids"` // The url of the story. Url *string `json:"url"` // The story's score, or the votes for a pollopt. Score *int32 `json:"score"` // The title of the story, poll, or job in HTML Title *string `json:"title"` // A list of related pollopts, in display order. Parts []ItemId `json:"parts"` // In the case of stories or polls, the total comment count. Descendants *int32 `json:"descendants"` }
type SearchItemsRanking ¶
type SearchItemsRanking int
const ( Date SearchItemsRanking = iota Popularity )
func (SearchItemsRanking) ToPointer ¶
func (r SearchItemsRanking) ToPointer() *SearchItemsRanking
type SearchRequest ¶
type SearchRequest struct { Query string Tags string Ranking SearchItemsRanking Limit int }
type SearchResponse ¶
type SearchResponse struct {
Results []SearchResult
}
type SearchResponseJson ¶
type SearchResponseJson struct {
Hits []SearchResultJson `json:"hits"`
}
type SearchResult ¶
type SearchResultJson ¶
Click to show internal directories.
Click to hide internal directories.