From 7f9b48b53fb872669205a3dc38f55ec8b46e7e0e Mon Sep 17 00:00:00 2001 From: Dan Zajdband Date: Mon, 28 Mar 2016 08:24:16 -0400 Subject: [PATCH] Added tool for exporting endpoints as a markdown table --- tools/towiki.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tools/towiki.js diff --git a/tools/towiki.js b/tools/towiki.js new file mode 100644 index 0000000..2c50ce0 --- /dev/null +++ b/tools/towiki.js @@ -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'))