Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sinisimattia/tapi

Consume APIs and convert them to TypeScript objects
https://github.com/sinisimattia/tapi

api automapper converter deno javascript json typescript

Last synced: 8 days ago
JSON representation

Consume APIs and convert them to TypeScript objects

Awesome Lists containing this project

README

        



__ _ _
/ /_____ _____ (_) (_)____
/ __/ __ `/ __ \/ / / / ___/
/ /_/ /_/ / /_/ / / / (__ )
\__/\__,_/ .___/_(_)_/ /____/
/_/ /___/

Consume APIs as typed objects!


![License](https://badgen.net/github/license/sinisimattia/tapi)
![TS](https://badgen.net/npm/types/tapi.js)
![Dependencies](https://badgen.net/bundlephobia/dependency-count/tapi.js)
![Stars](https://badgen.net/github/stars/sinisimattia/tapi)

[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/B0B561G42)

## Imagine doing this...

```javascript
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...

```javascript
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.

___

### **[🚀 Get started 🚀](https://tapi.js.org)**

___

## More info

📦 [Check it out on **npm**](https://npm.im/tapi.js)

🦕 [Check it out on **deno**](https://deno.land/x/tapi)

😱 [Check it out on **Bundlephobia**](https://bundlephobia.com/package/tapi.js@latest)

☁ [Use directly from the browser](https://cdn.jsdelivr.net/npm/tapi.js/)

📚 [Additional info on the file on **libraries.io**](https://libraries.io/npm/tapi.js)

## Big thanks to anyone who contributes!

**You** could be here! Just follow the [**contributor's guide**](CONTRIBUTING.md).

👇

![Contributors](https://contrib.rocks/image?repo=sinisimattia/tapi)
___

Thanks for using **tapi**! 😊 I hope it's been useful to you in some way.