Class: Pinboard

Pinboard

new Pinboard(username, auth_token, proxy, encode_url)

Pinboard class.
Parameters:
Name Type Argument Default Description
username String The username
auth_token String <optional>
null The user's auth token (got with Pinboard.login)
proxy String <optional>
A proxy URL for Cross-Domain requests
encode_url Boolean <optional>
Encode the URL (Required for some proxy scripts)
Source:
  • pinboard.js, line 16

Methods

add(url, description, callback, params)

Add a new bookmark
Parameters:
Name Type Argument Description
url String URL to bookmark
description String Bookmark description
callback Function The usual (result, error) callback
params Array <optional>
/posts/add optinal parameters ({"name": "", "value": ""} format)
Source:
  • pinboard.js, line 156

delete(url, callback, params)

Remove a bookmark
Parameters:
Name Type Argument Description
url String URL to bookmark
callback Function The usual (result, error) callback
params Array <optional>
/posts/add optinal parameters ({"name": "", "value": ""} format)
Source:
  • pinboard.js, line 184

list_posts(callback, params)

List the user's posts
Parameters:
Name Type Argument Description
callback Function Returns the posts JSON
params Array <optional>
/posts/all optinal parameters ({"name": "", "value": ""} format)
Source:
  • pinboard.js, line 129

login(password, callback(auth_token,)

Login the user and gets the authentication token.
Parameters:
Name Type Description
password String The user password
callback(auth_token, Function error) - Returns the authentication token or a error
Source:
  • pinboard.js, line 92

request(method, api_method, params, body, statechange(req))

AJAX helper function. I'm using this just to keep the library code clean.
Parameters:
Name Type Description
method String The HTTP method for the request.
api_method String Pinboard API URL method.
params String Pinboard API URL parameters.
body String Body of a POST request. (Use null if there's none)
statechange(req) Function XMLHttpRequest.onreadystatechange
Source:
  • pinboard.js, line 45