https://github.com/nbbaier/valtown-fets-client
A Val Town API client built leveraging feTS
https://github.com/nbbaier/valtown-fets-client
Last synced: about 2 months ago
JSON representation
A Val Town API client built leveraging feTS
- Host: GitHub
- URL: https://github.com/nbbaier/valtown-fets-client
- Owner: nbbaier
- Created: 2023-07-28T19:42:29.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-29T00:09:46.000Z (almost 2 years ago)
- Last Synced: 2025-02-16T15:18:15.378Z (4 months ago)
- Language: TypeScript
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# valtown-fets-client
This is a client leveraging [`feTS`](https://github.com/ardatan/feTS) to create an API client for Val Town. The Val Town [openapi spec](https://www.val.town/docs/openapi.yaml) is used to generate `api.ts`.
# Usage
```ts
import { NormalizeOAS, createClient } from "fets";
import { api } from "./api";const token = "";
const client = createClient>({
endpoint: "https://api.val.town",
});const resp = await client["/v1/alias/{username}/{val_name}"].get({
params: { username: "nbbaier", val_name: "hello" },
headers: { Authorization: `Bearer ${token}` },
});const me = await resp.json();
console.log(me);
```# Todo
- [ ] Publishing to NPM
- [ ] Automated generation of `api.ts` when the spec changes