hnclient

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

README

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	AgentCreator func() *gorequest.SuperAgent
}

func (*Client) CreateAgent

func (self *Client) CreateAgent() *gorequest.SuperAgent

func (*Client) GetItem

func (self *Client) GetItem(id int) (item Item, err error)

func (*Client) GetMaxItem

func (self *Client) GetMaxItem() (id int, err error)

func (*Client) GetUser

func (self *Client) GetUser(name string) (user User, err error)

type Item

type Item struct {
	Id          uint   `json:"id,omitempty"`          //The item's unique id.
	Deleted     bool   `json:"deleted,omitempty"`     //true if the item is deleted.
	Type        string `json:"type,omitempty"`        //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        int64  `json:"time,omitempty"`        //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      uint   `json:"parent,omitempty"`      //The comment's parent: either another comment or the relevant story.
	Poll        uint   `json:"poll,omitempty"`        //The pollopt's associated poll.
	Kids        []uint `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.
	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 User

type User struct {
	Id        string `json:"id,omitempty"`        //The user's unique username. Case-sensitive. Required.
	Delay     int    `json:"delay,omitempty"`     //Delay in minutes between a comment's creation and its visibility to other users.
	Created   int64  `json:"created,omitempty"`   //Creation date of the user, in Unix Time.
	Karma     int    `json:"karma,omitempty"`     //The user's karma.
	About     string `json:"about,omitempty"`     //The user's optional self-description. HTML.
	Submitted []uint `json:"submitted,omitempty"` //List of the user's stories, polls and comments.
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL