1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
export function valVersion({ token, id, version }: {
token?: string;
id: string;
version: number;
}): Promise<{
id: string;
author: {
id: string;
username: string;
};
name: string;
code: string;
public: boolean;
privacy: "public" | "private";
version: number;
runEndAt: string;
runStartAt: string;
logs: any[];
output: object;
error: object | null;
readme: string | null;
likeCount: number;
referenceCount: number;
}> {
const headers: RequestInit["headers"] = token
? {
Authorization: `Bearer ${token}`,
}
: {};
return fetchJSON(
`https://api.val.town/v1/vals/${id}/versions/${version}`,
{ headers },
);
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023