pinboard

package
v0.0.0-...-02d2535 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2016 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultEndpoint *url.URL
View Source
var DefaultNumberOfWorkers = 10
View Source
var DefaultRequestRate = 10
View Source
var DefaultTimeout = 10 * time.Second

Functions

func DefaultHttpClient

func DefaultHttpClient(timeout time.Duration, tls *tls.Config) *http.Client

func TlsConfigAllowingInsecure

func TlsConfigAllowingInsecure() *tls.Config

Types

type Bookmark

type Bookmark struct {
	Href        string          `json:"href"`
	Description string          `json:"description,omitempty"`
	Extended    string          `json:"extended,omitempty"`
	Meta        string          `json:"meta,omitempty"`
	Hash        string          `json:"hash,omitempty"`
	Time        time.Time       `json:"time,omitempty"`
	Shared      PinboardBoolean `json:"shared"`
	ToRead      PinboardBoolean `json:"toread"`
	Tags        PinboardTags    `json:"tags"`
	FailureInfo FailureInfo     `json:"failure,omitempty"`
}

func GetBookmarksFromFile

func GetBookmarksFromFile(reader io.Reader, format Format) []Bookmark

func ParseJSON

func ParseJSON(input io.Reader) []Bookmark

func ParseText

func ParseText(input io.Reader) []Bookmark

type Checker

type Checker struct {
	Reporter        Reporter
	RequestRate     int
	NumberOfWorkers int

	Http *http.Client
}

func (*Checker) Run

func (checker *Checker) Run(bookmarks []Bookmark)

type Client

type Client struct {
	Token    string
	Endpoint *url.URL
}

func NewClient

func NewClient(token string, endpoint *url.URL) *Client

func (*Client) DeleteBookmark

func (client *Client) DeleteBookmark(bookmark Bookmark) (err error)

func (*Client) DownloadBookmarks

func (client *Client) DownloadBookmarks() (io.ReadCloser, error)

func (*Client) GetAllBookmarks

func (client *Client) GetAllBookmarks() ([]Bookmark, error)

type FailureInfo

type FailureInfo struct {
	HttpCode     int    `json:"httpCode,omitempty"`
	ErrorMessage string `json:"message,omitempty"`
	// note: needs to be a pointer type so that 'omitempty' does work
	CheckedAt *time.Time `json:"checkedAt,omitempty"`
}

type Format

type Format int
const (
	JSON Format = iota + 1
	TXT
)

func FormatFromString

func FormatFromString(value string) (Format, error)

func (Format) String

func (f Format) String() string

type JSONReporter

type JSONReporter struct {
	// contains filtered or unexported fields
}

func NewJSONReporter

func NewJSONReporter(verbose bool, writers ...io.Writer) *JSONReporter

type LookupFailure

type LookupFailure struct {
	Bookmark Bookmark
	Code     int
	Error    error
}

type PinboardBoolean

type PinboardBoolean bool

func (*PinboardBoolean) MarshalJSON

func (p *PinboardBoolean) MarshalJSON() ([]byte, error)

func (*PinboardBoolean) UnmarshalJSON

func (p *PinboardBoolean) UnmarshalJSON(data []byte) error

type PinboardTags

type PinboardTags []string

func (*PinboardTags) MarshalJSON

func (p *PinboardTags) MarshalJSON() ([]byte, error)

func (*PinboardTags) UnmarshalJSON

func (p *PinboardTags) UnmarshalJSON(data []byte) error

type Reporter

type Reporter interface {
	// contains filtered or unexported methods
}

type SimpleFailureReporter

type SimpleFailureReporter struct {
	// contains filtered or unexported fields
}

func NewSimpleFailureReporter

func NewSimpleFailureReporter(verbose bool, colorize bool, writers ...io.Writer) SimpleFailureReporter

Jump to

Keyboard shortcuts

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