Skip to main content

tpy

A strongly typed Pylon API client. https://pylon.bot/

CI

The Pylon API does not have a standard response per each variable, meaning there are alot of edge cases and can result sometimes in unexpected responses. Tpy aims to resolve this by providing type safe interaction along with a provided Go-like error handler. Tpy also provides a predictable interface with documentation on almost all used endpoints.

npm install tpy

import Tpy from 'https://deno.land/x/tpy@0.0.1/mod.ts';
// Or use Node
// import Tpy from 'tpy';

const client = new Tpy('My.pYl0N_tOKEn');
const [err, user] = await client.getUser();

// Tpy has strongly typed error handling so there are no need for type guards.
// If there's an error, the response will return undefined,
// Otherwise, the response will the requested type as expected.
if (err) {
  throw `There was an error while fetching the user: ${TpyErrToString(err)}.`;
  // user is now !undefined.
} else console.log(`User logged in: ${user.displayName}`);

// README integrity: passing

Contributing

Currently, the library is missing some documentation and has some dirty code. If youโ€™d like to contribute please read the contributing guide before you start working.