UNPKG

signavio-api

Version:

Unofficial node signavio workflow api wrapper

37 lines (28 loc) 814 B
'use strict'; const docs = require('../api/docs.json'); const Generator = require('./generator'); const path = require('path'); const interfaces = {}; docs.apis.forEach((d) => { const name = d.path.replace('/', ''); interfaces[name] = Generator(name, path.join('../api/', name + '.json')); }); // Add User interface callback to interfaces Object.keys(interfaces).forEach((key) => { if (key === 'User') { interfaces[key].prototype.getUserInstance = function() { return this; }; return; } interfaces[key].prototype.getUserInstance = function(options) { if (this.options.users) return this.options.users; if (!options) { options = { basePath: this.options.basePath }; } return new interfaces.User(options); }; }); module.exports = interfaces;