import csharp from './csharp-restsharp'; import curl from './curl'; import golang from './golang'; import java from './java-okhttp'; import php from './php-curl'; import python from './python-http.client'; import ruby from './ruby'; import nodejs from './nodejs-native'; import { Request } from './postman-collection-lite'; const langMap = { csharp, curl, golang, java, php, python, ruby, nodejs, }; export const convert = (lang, opts) => { return new Promise((resolve, reject) => { langMap[lang].convert(new Request(opts), { indentCount: 2, indentType: 'Space', trimRequestBody: true, followRedirect: false, ES6_enabled: true, includeBoilerplate: true, longFormat: false, }, (e, snippet) => { if (e) { reject(e); } else { resolve(snippet); } }); }); };