Back

Version 34

7/20/2023
async function fetchValTownAPI(
apiToken: string,
path: string,
options?: RequestInit,
) {
if (!path.startsWith("/")) {
path = "/" + path;
}
if (!path.startsWith("/v1")) {
path = "/v1" + path;
}
return @stevekrouse.fetchJSON(`https://api.val.town${path}`, {
...options,
headers: {
"Authorization": `Bearer`,
...(options?.headers),
},
});
}
Updated: October 23, 2023