Skip to main content
   __              _     _     
  / /_____ _____  (_)   (_)____
 / __/ __ `/ __ \/ /   / / ___/
/ /_/ /_/ / /_/ / /   / (__  ) 
\__/\__,_/ .___/_(_)_/ /____/  
        /_/       /___/        
    

Consume APIs as typed objects!

License TS Dependencies Stars

Imagine doing thisโ€ฆ

http
  .get('/some-url-that-returns-an-object') // Get data ๐Ÿ“ก
  .as(YourClass) // Map it onto your class โœจ
  .then((builtObject) => {
    builtObject.doSomething(); // Use it directly ๐ŸŽ‰
  })

Or even thisโ€ฆ

const builtObject = await http.get('/some-url-that-returns-an-object').as(YourClass)
builtObject.doSomething();

How?

Introducing tapi, a tiny TypeScript package used to define how to interpret any given API response as a typed object.

It automatically converts JSON objects into TypeScript class instances, however you can still configure it however you want with Aliases, Transformers, Mappers and more.



More info

๐Ÿ“ฆ Check it out on npm

๐Ÿฆ• Check it out on deno

๐Ÿ˜ฑ Check it out on Bundlephobia

โ˜ Use directly from the browser

๐Ÿ“š Additional info on the file on libraries.io

Big thanks to anyone who contributes!

You could be here!

๐Ÿ‘‡

Contributors


Thanks for using tapi! ๐Ÿ˜Š I hope itโ€™s been useful to you in some way.