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
import { paginateAPI } from "https://esm.town/v/andreterron/paginateAPI";
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
import process from "node:process";
export const testApi = (async () => {
const threshold = 90;
const opts = {
headers: {
Authorization: `Bearer ${process.env.vt_token}`,
},
};
const me = await fetchJSON(
"https://api.val.town/v1/me",
opts,
);
// TODO: Paginate
const vals = await paginateAPI(
`https://api.val.town/v1/users/${me.id}/vals?limit=100`,
opts,
);
// urls.forEach((u) => console.log(u));
const privateVals = vals.filter((val) => !val.public);
if (privateVals.length > threshold && )
// return res;
})();
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