Added tool for exporting endpoints as a markdown table

This commit is contained in:
Dan Zajdband
2016-03-28 08:24:16 -04:00
parent e4e3116164
commit 7f9b48b53f

18
tools/towiki.js Normal file
View File

@@ -0,0 +1,18 @@
var es = require('./lib/endpoints.json')
var out = []
out.push(['', 'API resource', 'Lib function name', 'HTTP method', ''].join('|'))
out.push('|---|---|---|')
Object.keys(es.methods).forEach(function(e){
var m = es.methods[e]
Object.keys(m).forEach(function(r){
out.push(['', e + r, m[r].resource, m[r].method.toUpperCase(), ''].join('|'))
})
})
Object.keys(es.authentication).forEach(function(e){
out.push(['', e, es.authentication[e], 'POST', ''].join('|'))
})
console.log(out.join('\n'))