Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/?q=api&page=480&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=api

Returns an array of strings in format "username" or "username/projectName"

Found 5026 results for "api"(408ms)

hiddenAPImain.tsx2 matches

@stevekrouse•Updated 1 year ago
1import { hiddenAPIInternal } from "https://esm.town/v/stevekrouse/hiddenAPIInternal";
2
3export let hiddenAPI = (...args) => hiddenAPIInternal(...args);

big_storymain.tsx1 match

@tmcw•Updated 1 year ago
6 const nytimes =
7 await (await fetch(
8 `https://api.nytimes.com/svc/topstories/v2/home.json?api-key=${process.env.nytimes_api_key}`,
9 )).json();
10 const now = Date.now();

testVTClientmain.tsx3 matches

@stevekrouse•Updated 1 year ago
1export const testVTClient = (async () => {
2 const { createApiClient } = await import(
3 "https://esm.sh/gh/nbbaier/valtown-zodios@main/src/spec/valtown-client.ts"
4 );
5 const apiClient = createApiClient("https://api.val.town");
6 const params = {
7 params: { username: "stevekrouse", val_name: "fetchJSON" },
8 };
9 const user = await apiClient.getValname(params);
10 return user;
11})();

testMutateSemanticsmain.tsx5 matches

@stevekrouse•Updated 1 year ago
4export async function testMutateSemantics({
5 stateName,
6 api,
7 mutateExpected,
8 expected,
11}: {
12 stateName: string;
13 api: string;
14 mutateExpected?: boolean;
15 expected?: (old, next) => boolean;
18}) {
19 const { data: last } = await fetchJSON(
20 `${api}/eval/${stateName}`
21 );
22 const now = Date.now();
23 await fetchJSON(
24 `${api}/eval/${mutator(now)}`,
25 authenticated
26 ? {
30 );
31 const { data: next } = await fetchJSON(
32 `${api}/eval/${stateName}`
33 );
34 const mutated = next === now;

notionGetDatabasemain.tsx2 matches

@stevekrouse•Updated 1 year ago
4 filter?: any;
5}) => {
6 const { Client, collectPaginatedAPI } = await import(
7 "https://deno.land/x/notion_sdk/src/mod.ts"
8 );
9 const notion = new Client({ auth });
10 return collectPaginatedAPI(notion.databases.query, {
11 database_id: databaseId,
12 filter,

chatGPTPluginmain.tsx14 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2import { openaiOpenAPI } from "https://esm.town/v/stevekrouse/openaiOpenAPI";
3
4// https://stevekrouse-chatgptplugin.express.val.run/.well-known/ai-plugin.json
13Vals are JavaScript & TypeScript code.
14They run server-side on Deno.
15\`fetch\` is in the environment to access any PUBLIC real-time APIs or data feeds.
16Answer any questions about times after your cut off date by querying PUBLIC APIs.
17Do NOT use any API that requires a secret key.
18Only use PUBLIC APIs.
19Do NOT use \`YOUR_API_KEY\`.
20Do NOT import axios or node-fetch. Instead use \`fetch\`.
21Do NOT use newlines. Just use semicolons.
25 "type": "none",
26 },
27 "api": {
28 "type": "openapi",
29 "url": "/openapi",
30 },
31 "logo_url":
35 });
36 }
37 else if (req.path === "/openapi") {
38 // OpenAPI Spec
39 // only POST /v1/eval for now
40 res.send(openaiOpenAPI);
41 }
42 else if (req.path === "/v1/eval") {
43 // Proxy /v1/eval to api.val.town
44 try {
45 console.log(req.body);
46 let result = await fetchJSON(
47 "https://api.val.town/v1/eval",
48 { method: "POST", body: JSON.stringify(req.body) },
49 );

emailExmain.tsx3 matches

@stevekrouse•Updated 1 year ago
1import { exportedKeys } from "https://esm.town/v/stevekrouse/exportedKeys";
2import { thisEmail } from "https://esm.town/v/stevekrouse/thisEmail";
3import { runValAPIAuth } from "https://esm.town/v/stevekrouse/runValAPIAuth";
4
5export const emailEx = runValAPIAuth({
6 val: "@stevekrouse.email",
7 args: [{
8 subject: "test via api",
9 from: { email: thisEmail() },
10 to: [{ email: "steve@val.town" }],

openaiFineTunemain.tsx1 match

@stevekrouse•Updated 1 year ago
7}) {
8 return fetchJSON(
9 "https://api.openai.com/v1/fine_tuning/jobs",
10 {
11 method: "POST",

resendmain.tsx4 matches

@stevekrouse•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export function resend({ from, to, subject, html, text, apiKey }: {
4 from: string;
5 to: string;
7 html?: string;
8 text?: string;
9 apiKey: string;
10}) {
11 return fetchJSON("https://api.resend.com/emails", {
12 method: "POST",
13 headers: {
14 "Authorization": `Bearer ${apiKey}`,
15 "Content-Type": "application/json",
16 },

updateInspoListmain.tsx2 matches

@stevekrouse•Updated 1 year ago
1let { valTownInspoList } = await import("https://esm.town/v/rodrigotello/valTownInspoList?v=99");
2import { isValTownTeam } from "https://esm.town/v/stevekrouse/isValTownTeam";
3import { verifyAPIAuth } from "https://esm.town/v/stevekrouse/verifyAPIAuth";
4
5export async function updateInspoList(newList, auth) {
6 let handle = await verifyAPIAuth(auth);
7 if (isValTownTeam(handle)) {
8 valTownInspoList = newList;

runValAPIEx2 file matches

@charmaine•Updated 4 hours ago

PassphraseAPI2 file matches

@wolf•Updated 2 days ago
artivilla
founder @outapint.io vibe coding on val.town. dm me to build custom vals: https://artivilla.com
fiberplane
Purveyors of Hono tooling, API Playground enthusiasts, and creators of 🪿 HONC 🪿 (https://honc.dev)