1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export function tidbytDeviceInstallations({ deviceId, apiKey }: {
4 deviceId: string;
5 apiKey: string;
6}) {
7 return fetchJSON(
8 `https://api.tidbyt.com/v0/devices/${deviceId}/installations`,
9 {
10 headers: {
11 Authorization: `Bearer ${apiKey}`,
12 },
13 },
24}[]> {
25 const res = await fetchJSON(
26 "https://api.val.town/v1/me/references?" +
27 searchParams({
28 since: since?.toISOString(),
38 await new Promise<void>((resolve) => setTimeout(() => resolve(), 150));
39 }
40 const code = `await api(
41 @andreterron.paintGraffitiPixel,
42 ${Math.min(Math.floor(Math.random() * 64), 64)}, // x
1import { name as name2 } from "https://esm.town/v/wonday/name";
2
3export function myApi(name) {
4 return `hi ${name}! my name is ${name2}`;
5}
1export function myApi(name) {
2 return "hi " + name;
3}
1export function myApi(name) {
2 console.email("hello " + name);
3 return "hello " + name;
1// Visit: https://api.val.town/v1/express/vtdocs.customStatusCode
2export const customStatusCode = (req: express.Request, res: express.Response) => {
3 // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/418
1export function myApi(name) {
2 return "hi " + name;
3}
3export let quote = (async () => {
4 const quotes = await fetchJSON(
5 "https://zenquotes.io/api/random/"
6 );
7 return `"${quotes[0].q}" – ${quotes[0].a}`;
3export let initialCommit = async (org, repo) => {
4 const repoData = await fetchJSON(
5 `https://api.github.com/repos/${org}/${repo}`
6 );
7 const { created_at } = repoData;
8 const until = new Date(Date.parse(created_at) + 600).toISOString();
9 const json = await fetchJSON(
10 `https://api.github.com/repos/${org}/${repo}/commits?until=${until}`
11 );
12 return json;