node-pinboard
Version:
A Node.js wrapper for the Pinboard API.
98 lines (97 loc) • 3.19 kB
TypeScript
import { Callback } from './types';
export default class Pinboard {
readonly token: string;
/**
* Uses token available on [settings/password](https://pinboard.in/settings/password)
*/
constructor(token: string);
/**
* Returns The most recent time a bookmark was added, updated or deleted.
*/
update: (options: {}, callback: Callback) => Promise<void | object>;
/**
* Add a bookmark.
*/
add: (options: {
url: string;
description: string;
extended?: string;
tags?: string[];
dt?: string;
replace?: "yes" | "no";
shared?: "yes" | "no";
toread?: boolean;
}, callback: Callback) => Promise<void | object>;
/**
* Delete a bookmark.
*/
delete(url: string, cb: Callback): Promise<void | object>;
/**
* Returns one or more posts on a single day matching the arguments.
* If no date or url is given, date of most recent bookmark will be used.
*/
get: (options: {
tag?: string;
dt?: string;
url?: string;
meta?: string;
}, callback: Callback) => Promise<void | object>;
/**
* Returns a list of dates with the number of posts at each date.
*/
dates: (options: {
tag?: string[];
}, callback: Callback) => Promise<void | object>;
/**
* Returns a list of the user's most recent posts, filtered by tag.
*/
recent: (options: {
tag?: string[];
}, callback: Callback) => Promise<void | object>;
/**
* Returns all bookmarks in the user's account.
*/
all: (options: {
tag?: string;
start?: string;
results?: string;
fromdt?: string;
meta?: string;
}, callback: Callback) => Promise<void | object>;
/**
* Returns a list of popular tags and recommended tags for a given URL.
* Popular tags are tags used site-wide for the url; recommended tags are drawn from the user's own tags.
*/
suggest(url: string, cb: Callback): Promise<void | object>;
/**
* Returns a full list of the user's tags along with the number of times they were used.
*/
getTags: (options: {}, callback: Callback) => Promise<void | object>;
/**
* Delete an existing tag.
*/
delTag(tag: string, cb: Callback): Promise<void | object>;
/**
* Rename an tag, or fold it in to an existing tag
*/
renameTag: (options: {
old: string;
new: string;
}, callback: Callback) => Promise<void | object>;
/**
* Returns the user's secret RSS key (for viewing private feeds)
*/
userSecret: (options: {}, callback: Callback) => Promise<void | object>;
/**
* Returns the user's API token (for making API calls without a password)
*/
api_token: (options: {}, callback: Callback) => Promise<void | object>;
/**
* Returns a list of the user's notes
*/
listNotes(cb: Callback): Promise<void | object>;
/**
* Returns an individual user note. The hash property is a 20 character long sha1 hash of the note text.
*/
getNote(id: string, cb: Callback): Promise<void | object>;
}