1Migrated from folder: Archive/vtOpenAPI
1# Notehub
2
3A set of helper functions for interacting with the Notehub API
4
5Requires `NOTEHUB_CLIENT_ID` and `NOTEHUB_CLIENT_SECRET` [environment variables](https://www.val.town/settings/environment-variables) to be configured.
1Retrieve a city for a given coordinates in the format `[longitude, latitude]`.
2
3An `OPENCAGE_API_KEY` variable is necessary and can be [obtained for free on their website](https://opencagedata.com/pricing).
4
5Migrated from folder: geographic/cities
5import msg from "https://esm.town/v/pomdtr/msg"
6
7import {capitalize} from "https://esm.sh/lodash-es"
8
9export const title = "mdx rendered from a val readme"
10
11# {capitalize(title)}
12
13> {msg}
5import msg from "https://esm.town/v/pomdtr/msg"
6
7import {capitalize} from "https://esm.sh/lodash-es"
8
9export const title = "mdx rendered from a val readme"
10
11# {capitalize(title)}
12
13> {msg}
4
5async function createScreenshot(code: string) {
6 const apiUrl = "https://sourcecodeshots.com/api/image";
7 const resp = await fetch(apiUrl, {
8 method: "POST",
9 headers: {
39 }
40 }
41 const resp = await fetch(`https://api.val.town/v1/alias/${author}/${name}`, {
42 headers,
43 });
50 const version = url.searchParams.get("v");
51 const resp = await fetch(
52 `https://api.val.town/v1/vals/${val.id}/versions/${version}`,
53 { headers },
54 );
3console.log(
4 await fetchJSON(
5 `https://api.val.town/v1/vals/1f32d4c1-332e-4135-889f-8df408924a9d/versions/1`,
6 {
7 headers: {
2Returns information about a specific version of a val.
3
4To access private vals this requires a secret called valtownToken, set to your API Token. See more about [authentication](https://docs.val.town/api/authentication) to understand how to generate a token.
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=43";
2
3console.log(await fetchJSON("https://api.val.town/v1/alias/stevekrouse/fetchJSON"));
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=43";
2
3console.log(await fetchJSON("https://api.val.town/v1/alias/stevekrouse"));