Skip to content

Instantly share code, notes, and snippets.

@joakin
Created May 20, 2016 14:56
Show Gist options
  • Save joakin/e49efca10a5b6d346dc843608d3cf0dd to your computer and use it in GitHub Desktop.
Save joakin/e49efca10a5b6d346dc843608d3cf0dd to your computer and use it in GitHub Desktop.
canduit usage, node
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