node-pinboard
Version:
A Node.js wrapper for the Pinboard API.
16 lines • 709 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var node_fetch_1 = require("node-fetch");
var querystring_1 = require("querystring");
exports.API_URL = 'https://api.pinboard.in/v1';
var get = function (_a, cb) {
var endpoint = _a.endpoint, qs = _a.qs;
var promise = node_fetch_1.default(exports.API_URL + "/" + endpoint + "?" + querystring_1.stringify(qs), {
headers: { 'Content-Type': 'application/json' }
}).then(function (res) { return res.json(); });
return cb
? promise.then(function (json) { return cb(null, json); }).catch(function (err) { return cb(err, null); })
: promise;
};
exports.default = get;
//# sourceMappingURL=get.js.map