Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/sinisimattia/tapi
- Owner: sinisimattia
- License: gpl-3.0
- Created: 2021-08-05T14:55:32.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-27T08:00:51.000Z (over 1 year ago)
- Last Synced: 2024-10-28T12:16:22.341Z (17 days ago)
- Topics: api, automapper, converter, deno, javascript, json, typescript
- Language: TypeScript
- Homepage: https://tapi.js.org
- Size: 896 KB
- Stars: 38
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
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.