Popular Post Canter Posted May 1, 2019 Popular Post Share Posted May 1, 2019 Hey All, As a long time NodeJS/Js user of the Politics & War API, I've recently decided to create a library to simplify accessing the API, and handling the kerfuffle of data that is returned from the calls. My hope was to really sort through the mess of inconsistencies and have clear, promise-based calling of the api simply by calling a method for each API. The library is designed to accept garbage in, and release quality out - it's relatively type-safe, but accepts both number and string as data types for any id fields. As well, it simplifies calls like the nations api which take several parameters, by simply taking an object parameter. It is promise based, and compatible both with NodeJS and CommonJS. // Example Setup in nodejs const PoliticsAndWar = require("pnw4js"); let pnw = new PoliticsAndWar("key"); async function main() { let nation = await pnw.nation(64060) // or string .catch(err => console.error(err)); console.log(nation); }(); It's not a necessity, but it definitely saves a lot of time. Future updates will be compatible with current code, and are planned to include: V2 - Stricter Type Safety, Calling Cache V3 - Filters, Analysis, etc. V4 - Implement a version of this for Google Apps Script?? (to be confirmed). I know Google Apps Script isn't friendly, but many people (including myself) get forced into using it Unfortunately the generated TSDoc on Github Pages is down, so either read the TSDoc annotations in the code or download the /docs folder and just open a file in browser. More updates to come! Links: GitHub: https://github.com/canterbotto/pnw4js Package on NPM: https://www.npmjs.com/package/pnw4js You can friend me @Canter#0548, reply to this post or create an issue on the Github for support, and I'll try to assist within 24 hours. I hope this helps, and thanks for reading! - Canter 3 6 Quote Link to comment Share on other sites More sharing options...
Illenium Posted May 1, 2019 Share Posted May 1, 2019 @Canter mew 1 Quote Kitsune magics are fun~ Link to comment Share on other sites More sharing options...
Nerfed_Bred Posted May 1, 2019 Share Posted May 1, 2019 Seems useful Quote Link to comment Share on other sites More sharing options...
Vack Posted May 1, 2019 Share Posted May 1, 2019 You lost me at “Hey all”, but I’m sure this is extremely useful to several people. 3 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.