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=1471&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 17431 results for "api"(1645ms)

telemetrymain.tsx1 match

@saolsen•Updated 1 year ago
10 trace as otelTrace,
11 Tracer,
12} from "npm:@opentelemetry/api";
13import { ReadableSpan } from "npm:@opentelemetry/sdk-trace-base";
14import {

PriestGPTREADME.md1 match

@mjweaver01•Updated 1 year ago
11
12
13If you fork this, you'll need to set `OPENAI_API_KEY` in your [Val Town Secrets](https://www.val.town/settings/secrets).
14
15

signedFetchmain.tsx1 match

@stevekrouse•Updated 1 year ago
7// Make an authenticated request to another user's val
8// Example usage: https://www.val.town/v/stevekrouse.authRequestEx
9export const runValAPIAuth = async ({ val, args, handle, privateKey, keys }: {
10 val: string;
11 args: any;

twitterAlertREADME.md1 match

@mimos•Updated 1 year ago
13Change the `query` variable for what you want to get notified for.
14
15You can use [Twitter's search operators](https://developer.twitter.com/en/docs/twitter-api/v1/rules-and-filtering/search-operators) to customize your query, for some collection of keywords, filtering out others, and much more!
16
17## 3. Notification

key_value_apiREADME.md1 match

@mjweaver01•Updated 1 year ago
1Migrated from folder: ValTownDemos/key_value_api

chatmain.tsx1 match

@weaverwhale•Updated 1 year ago
3async function getOpenAI() {
4 // if you don't have a key, use our std library version
5 if (Deno.env.get("OPENAI_API_KEY") === undefined) {
6 const { OpenAI } = await import("https://esm.town/v/std/openai");
7 return new OpenAI();

apimain.tsx4 matches

@weaverwhale•Updated 1 year ago
1import { API_URL } from "https://esm.town/v/std/API_URL";
2
3export async function api<T = any>(
4 path: string,
5 options?: RequestInit & {
11 if (options?.paginate) {
12 const data = [];
13 let url = new URL(`${API_URL}${path}`);
14 url.searchParams.set("limit", "100");
15
32 return { data } as T;
33 }
34 const resp = await fetch(`${API_URL}${path}`, {
35 ...options,
36 headers: {

roastCastmain.tsx9 matches

@jamiedubs•Updated 1 year ago
7 console.log("fetchCast", { fid, hash });
8 const res = await fetch(
9 `https://api.neynar.com/v2/farcaster/cast?identifier=${hash}&type=hash`,
10 {
11 method: "GET",
12 headers: {
13 accept: "application/json",
14 api_key: "NEYNAR_API_DOCS", // FIXME add my own API key pls
15 },
16 },
31 const body = { id, inputs };
32 const headers = {
33 Authorization: `Bearer ${process.env.GLIF_API_TOKEN}`,
34 };
35
36 const res = await fetch(`https://simple-api.glif.app`, {
37 method: "POST",
38 body: JSON.stringify(body),
41 if (res.status !== 200) {
42 const text = await res.text();
43 return { error: `${res.status} error from glif API: ${text}` };
44 }
45
66 };
67
68 const url = "https://api.pinata.cloud/v3/farcaster/casts";
69 const options = {
70 method: "POST",
100export default async function(req: Request): Promise<Response> {
101 // console.log("req", req);
102 if (!process.env.GLIF_API_TOKEN) {
103 return Response.json(
104 { message: "GLIF_API_TOKEN env var is missing" },
105 { status: 500 },
106 );
140 }
141
142 // TODO verify signature w/ hub API
143 const data = reqBody?.untrustedData;
144 // console.log({ reqBody, data });

discordWebhookExmain.tsx1 match

@Darok•Updated 1 year ago
4export const discordWebhookEx = discordWebhook({
5 url:
6 "https://discord.com/api/webhooks/1220801040870281357/1aA_0F-CcEY64yQsvVxOx0mP8E_XbdduAxlqFtiix5H72p9g0WxIGkFoDGNlyr7Q-LaH",
7 content: "Hi from val town!",
8});

greenSnipeREADME.md3 matches

@pomdtr•Updated 1 year ago
11How does this new shiny search engine work? Well, it's quite simple.
12
131. I wrote a [Deno script](https://github.com/pomdtr/val-town-mirror/blob/main/scripts/pull.ts) that fetches all vals from the Val Town API.
142. I pushed the data to a [Github Repository](https://github.com/pomdtr/val-town-mirror)
153. I added a [Github Action](https://github.com/pomdtr/val-town-mirror/blob/main/.github/workflows/sync.yaml) that runs the script every hour to refresh the data.
164. I created a simple frontend on top of the Github Search API that allows you to search the data. It's [hosted on Val Town](https://www.val.town/v/pomdtr/val_town_search) (obviously).
17
18That was it. I didn't have to build a complex search engine, I just used the tools that were available to me.
19
20Is this a scalable solution for Val Town? Probably not.\
21Am I abusing the Github API? Maybe.\
22Does it work better than the current search feature of Val Town? Absolutely!
23

RandomQuoteAPI

@Freelzy•Updated 11 hours ago

HAPI7 file matches

@dIgitalfulus•Updated 16 hours ago
Kapil01
apiv1