valtown-api-types
v0.1.1
Published
This package provides the [Val Town OpenAPI spec](https://www.val.town/docs/openapi.yaml) as a Typescript file.
Downloads
8
Readme
valtown-api-types
This package provides the Val Town OpenAPI spec as a Typescript file.
Usage
This package is intended for use with a fets API client.
import { NormalizeOAS, createClient } from "fets";
import openapi from "valtown-api-types";
const token = "<YOUR TOKEN>";
const client = createClient<NormalizeOAS<typeof api>>({
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 val = await resp.json();
console.log(val);