Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thelinuxlich/zodios-api-shorthand
A shorthand helper to implement Zodios API endpoints
https://github.com/thelinuxlich/zodios-api-shorthand
Last synced: about 2 months ago
JSON representation
A shorthand helper to implement Zodios API endpoints
- Host: GitHub
- URL: https://github.com/thelinuxlich/zodios-api-shorthand
- Owner: thelinuxlich
- License: mit
- Created: 2022-09-26T21:11:52.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-09T18:17:49.000Z (about 2 years ago)
- Last Synced: 2024-10-28T22:35:08.372Z (3 months ago)
- Language: TypeScript
- Size: 16.3 MB
- Stars: 17
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome - thelinuxlich/zodios-api-shorthand - A shorthand helper to implement Zodios API endpoints (TypeScript)
README
# Why?
This library is a helper to shorten the Zodios API definition, so instead of writing:
```ts
makeApi([
{
method: "get",
name: "getTransactions",
path: "/v1/transactions",
parameters: [
{
type: "Query",
name: "limit",
schema: z.number(),
},
{
type: "Query",
name: "offset",
schema: z.number(),
},
],
response: z.string(),
},
]);
```You can write:
```ts
api({
"GET transactions": {
path: "/v1/transactions",
queries: {
limit: z.number(),
offset: z.number(),
},
response: z.string(),
},
});
```# Instructions
Check out `src/index.test.ts` about usage