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/$%7Bsuccess?q=api&page=1024&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 11835 results for "api"(1479ms)

createQdrantCollectionmain.tsx2 matches

@wilt•Updated 1 year ago
3/**
4 * Create a new Qdrant collection in an existing cluster with the given name
5 * Uses recommended values for OpenAPI embeddings
6 */
7export async function createQdrantCollection(args: {
16 method: "PUT",
17 headers: {
18 "api-key": qdrantKey,
19 "Content-Type": "application/json",
20 },

sendRandomChihuahuaToSlackmain.tsx4 matches

@metart43•Updated 1 year ago
3
4export async function sendRandomChihuahuaToSlack() {
5 const dogAPIURL = new URL(
6 "https://dog.ceo/api/breed/chihuahua/images/random",
7 );
8 const dogApiResp = await fetch(dogAPIURL.href);
9 const { message } = await dogApiResp.json();
10 const res = await fetch(process.env.BROOKLAND_SLACK_WEBHOOK_URL, {
11 method: "POST",

valToStringmain.tsx1 match

@sdan•Updated 1 year ago
6 }
7 const [author, name] = val.split(".");
8 const resp = await fetch(`https://api.val.town/v1/alias/${author}/${name}`);
9 if (resp.status !== 200) {
10 throw new Error(resp.statusText);

measureValTownE2emain.tsx2 matches

@tmcw•Updated 1 year ago
8 for (let i = 0; i < count; i++) {
9 let start = Date.now();
10 await fetch("https://api.val.town/eval/(()=%3E1+1)()");
11 evalTimes.push(Date.now() - start);
12 }
23 for (let i = 0; i < count; i++) {
24 let start = Date.now();
25 await fetch("https://api.val.town/eval/@healeycodes.addOnes()");
26 userFuncTimes.push(Date.now() - start);
27 }

githubFollowingmain.tsx1 match

@tmcw•Updated 1 year ago
5 throw new Error(`${fetchJSON.impl.toString()}`);
6 return fetchJSON(
7 "https://api.github.com/users/stevekrouse/following"
8 );
9})();

jsYAMLExamplemain.tsx1 match

@tmcw•Updated 1 year ago
6 // Fetch a YAML file
7 const yaml = await fetch(
8 "https://raw.githubusercontent.com/docker/engine/8955d8da8951695a98eb7e15bead19d402c6eb27/api/swagger.yaml",
9 ).then((r) => r.text());
10 // parse the fetched file
5 const response =
6 (await fetch(
7 "https://api.val.town/v1/run/politelyinvinciblepointer.handleForm",
8 {
9 method: "POST",

checkIfTwitterAPIIsDownmain.tsx10 matches

@stevekrouse•Updated 1 year ago
1let { twitterAPIDown } = await import("https://esm.town/v/stevekrouse/twitterAPIDown");
2import process from "node:process";
3import { msHour } from "https://esm.town/v/stevekrouse/msHour";
4import { twitterSearch } from "https://esm.town/v/stevekrouse/twitterSearch";
5
6// let's poll the elevated v2 twitter api
7// until it's down, and store the state in
8// @stevekrouse.twitterAPIDown ({ down: boolean, reason: string})
9export async function checkIfTwitterAPIIsDown() {
10 try {
11 // query for something we know will return results
16 });
17 if (results.length) {
18 // if we get results, the API is still up
19 twitterAPIDown = {
20 down: false,
21 reason: `search returned ${results.length} results at ${new Date()}`,
22 };
23 } else {
24 // no results = API down
25 twitterAPIDown = {
26 down: true,
27 reason: `search returned ${results.length} results at ${new Date()}`,
29 }
30 } catch (e) {
31 // if there's an error, the API is also likely down
32 twitterAPIDown = {
33 down: false,
34 reason: `search errored ${e.message} at ${new Date()}`,

myApimain.tsx1 match

@stevekrouse•Updated 1 year ago
1export function myApi(name) {
2 return "hi " + name;
3}

textToImageDallemain.tsx1 match

@stevekrouse•Updated 1 year ago
17 };
18 } = await fetchJSON(
19 "https://api.openai.com/v1/images/generations",
20 {
21 method: "POST",

simple-scrabble-api1 file match

@bry•Updated 4 hours ago

social_data_api_project3 file matches

@tsuchi_ya•Updated 11 hours ago
apiv1
papimark21