Documentation ¶
Overview ¶
Package pinboardlib provides basic functionality for the Pinboard (http://pinboard.in) bookmarking service, allowing saving and retrieving posts.
Index ¶
- func PrettyPrint(p []Post) string
- type Client
- func (c *Client) Posts(count int, offset int) ([]Post, error)
- func (c *Client) PostsByDate(date string) ([]Post, error)
- func (c *Client) PostsByTags(tags []string) ([]Post, error)
- func (c *Client) Save(addr string, tags []string) error
- func (c *Client) Suggest(addr string) ([]Tag, error)
- func (c *Client) Tags() ([]Tag, error)
- type DateListResponse
- type Post
- type PostListResponse
- type Response
- type Tag
- type TagSuggestResponse
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrettyPrint ¶
PrettyPrint formats a Post list for human reading.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the single point of API interaction.
func NewClient ¶
NewClient provides a Pinboard API client with the given Pinboard user token and HTTP connection client.
func (*Client) Posts ¶
Posts retrieves a list of Post items with the given maximum count (0 means all items), starting from the given offset, counting from the first and oldest item (0 means no offset). If the offset is greater than the amount of Post items, an empty list is returned. See https://api.pinboard.in/v1/posts/all
func (*Client) PostsByDate ¶
PostsByDate retrieves al list of Post items from a given date, in YYYY-MM-DD format (ISO 8601).
func (*Client) PostsByTags ¶
PostsByTags retrieves a list of Post items, containing the given tag(s), max 3 tags supported. See https://api.pinboard.in/v1/posts/all
type DateListResponse ¶
type DateListResponse struct { Date time.Time `json:"date"` User string `json:"user"` // TODO Unify and inline Posts from here and PostListResponse Posts []struct { Href string `json:"href"` Description string `json:"description"` Extended string `json:"extended"` Meta string `json:"meta"` Time time.Time `json:"time"` Toread string `json:"toread"` Tags string `json:"tags"` } `json:"posts"` }
DateListResponse models a raw response from the posts/get endpoint.
type Post ¶
type Post struct { Description string `json:"description,omitempty"` Href string `json:"href,omitempty"` ToRead bool `json:"toread,omitempty"` Tags string `json:"tags,omitempty"` }
Post models a post (saved URL or bookmark) from the Pinboard API.
type PostListResponse ¶
type PostListResponse []struct { Href string `json:"href"` Description string `json:"description"` Extended string `json:"extended"` Meta string `json:"meta"` Hash string `json:"hash"` Time time.Time `json:"time"` Shared string `json:"shared"` Toread string `json:"toread"` Tags string `json:"tags"` }
PostListResponse models a raw response containing only Posts from the Pinboard API.
type TagSuggestResponse ¶
type TagSuggestResponse []struct { // This is the JSON response, /* [ { "popular":[ "design", "typography" ] }, { "recommended":[ "typography", "design", "japan", "tokyo", "IFTTT", "Pocket", "best", "diy", "duct_tape", "hacker" ] } */ Popular []string `json:"popular,omitempty"` Recommended []string `json:"recommended,omitempty"` }
TagSuggestResponse models the suggested tags for a given address.