Created
May 20, 2016 14:56
-
-
Save joakin/e49efca10a5b6d346dc843608d3cf0dd to your computer and use it in GitHub Desktop.
canduit usage, node
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Canduit = require('canduit') | |
const init = (conf) => new Promise((res, rej) => | |
Canduit(conf, (err, api) => err ? rej(err) : res(api))) | |
const run = (api, route, params) => new Promise((res, rej) => | |
api.exec(route, params, (err, resp) => err ? rej(err) : res(resp))) | |
const conf = { | |
user: '<USERNAME>', | |
api: 'https://phabricator.wikimedia.org/api/', | |
cert: '<CERTHERE>' | |
// token: '<TOKENHERE>' | |
} | |
const log = console.log.bind(console) | |
const ping = (api) => run(api, 'conduit.ping', null) | |
init(conf) | |
.then(ping) | |
.then(log) | |
.catch(log) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment