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/image-url.jpg?q=api&page=995&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 12728 results for "api"(1730ms)

chatmain.tsx4 matches

@kirinekoUpdated 1 year ago
5 options = {},
6) => {
7 // Initialize OpenAI API stub
8 const { Configuration, OpenAIApi } = await import(
9 "https://esm.sh/openai@3.3.0"
10 );
11 console.log(process.env);
12 // const configuration = new Configuration({
13 // apiKey: process.env.OPENAI,
14 // });
15 // const openai = new OpenAIApi(configuration);
16 // // Request chat completion
17 // const messages = typeof prompt === "string"

tree_examplemain.tsx3 matches

@pomdtrUpdated 1 year ago
4 */
5
6import { api } from "https://esm.town/v/pomdtr/api";
7import type { Tree } from "https://esm.town/v/pomdtr/tree_types";
8import { Hono } from "npm:hono";
49});
50
51// this endpoint is used to dynamically fetch a list of tags from the api
52app.get("/tags/:tag", async (c) => {
53 let { tag } = c.req.param();
55 tag = "#" + tag;
56 }
57 const { data: vals } = await api(
58 `/v1/search/vals?query=${encodeURIComponent(tag)}`
59 );

articlemain.tsx2 matches

@pomdtrUpdated 1 year ago
1import { api } from "https://esm.town/v/pomdtr/api";
2import { gfm } from "https://esm.town/v/pomdtr/gfm";
3import { html } from "https://esm.town/v/stevekrouse/html?v=5";
26 title = `@${val.author}/${val.name}`;
27 }
28 const { code, readme } = await api(`/v1/alias/${val.author}/${val.name}`);
29
30 return html(await gfm(readme, { title, favicon: "📝" }));

auth_middlewaremain.tsx2 matches

@pomdtrUpdated 1 year ago
12 <article>
13 <form method="post">
14 <label for="token"><a href="https://www.val.town/settings/api">API Token</a></label>
15 <input id="token" name="token" type="password" />
16 <button type="submit">Submit</button>
36
37async function fetchUser(token: string): Promise<User> {
38 const resp = await fetch("https://api.val.town/v1/me", {
39 headers: {
40 Authorization: `Bearer ${token}`,

bookmarkmain.tsx1 match

@ramkarthikUpdated 1 year ago
78});
79
80app.get("/api/bookmarks", async (c) => {
81 var baseUrl = c.req.url;
82 var page = parseInt(c.req.query("page") || "0");

ask_aimain.tsx3 matches

@pomdtrUpdated 1 year ago
1import { api } from "https://esm.town/v/pomdtr/api";
2import { email } from "https://esm.town/v/std/email?v=12";
3import { OpenAI } from "https://esm.town/v/std/OpenAI";
4
5async function getValByAlias({ author, name }: { author: string; name: string }) {
6 const { id, code, readme } = await api(`/v1/alias/${author}/${name}`, {
7 authenticated: true,
8 });
13async function updateValCode({ id, code }: { id: string; code: string }) {
14 console.log({ id, code });
15 await api(`/v1/vals/${id}/versions`, {
16 authenticated: true,
17 method: "POST",

val_town_cmdkmain.tsx8 matches

@pomdtrUpdated 1 year ago
1import { api } from "https://esm.town/v/pomdtr/api";
2import { Action, ActionItem, ListItem, Page } from "https://esm.town/v/pomdtr/cmdk";
3import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
176
177app.get("/vals", async (c) => {
178 const me = await api("/v1/me", {
179 authenticated: true,
180 });
181 const { data: vals } = await api(`/v1/users/${me.id}/vals`, {
182 authenticated: true,
183 paginate: true,
228 if (c.req.method === "POST") {
229 const { name, code, privacy } = await c.req.json();
230 const val = await api("/v1/vals", {
231 authenticated: true,
232 method: "POST",
255
256app.post("/vals/delete/:id", async (c) => {
257 await api(`/v1/vals/${c.req.param("id")}`, {
258 authenticated: true,
259 method: "DELETE",
272 const { name, code, privacy } = await c.req.json();
273
274 await api(`/v1/vals/${c.req.param("id")}`, {
275 authenticated: true,
276 method: "PUT",
285 }
286
287 const val = await api(`/v1/vals/${c.req.param("id")}`, {
288 authenticated: true,
289 });
301 let val: any;
302 try {
303 val = await api(`/v1/vals/${c.req.param("id")}`, {
304 authenticated: true,
305 });

PersonalizationGPTREADME.md1 match

@mjweaver01Updated 1 year ago
5Use GPT to return JIT personalization for client side applications.
6
7If you fork this, you'll need to set `OPENAI_API_KEY` in your [Val Town Secrets](https://www.val.town/settings/secrets).
8
9Migrated from folder: PersonalizationGPT/PersonalizationGPT

val_town_clientmain.tsx7 matches

@stevekrouseUpdated 1 year ago
1import { paths } from "https://esm.town/v/pomdtr/openapi_schema";
2import createClient2 from "npm:openapi-fetch";
3
4/**
5 * Create a Valtown API client
6 * @param options - Valtown API client options
7 * @param options.baseUrl - API base URL
8 * @param options.token - API token (if null, no token will be used, if undefined, the token from the environment variable "valtown" will be used)
9 */
10export default function createClient(options: {
13} = {}) {
14 return createClient2<paths>({
15 baseUrl: options?.baseUrl ?? "https://api.val.town",
16 headers: options?.token === null ? {} : { Authorization: `Bearer ${options.token ?? Deno.env.get("valtown")}` },
17 });

newValTownOpenAPImain.tsx5 matches

@stevekrouseUpdated 1 year ago
3import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
4
5export let newValTownOpenAPI = async () => {
6 const savedSpec = await blob.getJSON("vtOpenAPI");
7 let currentSpec = await fetchText(
8 "https://www.val.town/docs/openapi.yaml",
9 );
10 if (savedSpec !== currentSpec) {
11 await email({ subject: "New VT OpenAPI Spec" });
12 }
13 return blob.setJSON("vtOpenAPI", currentSpec);
14};

vapi-minutes-db1 file match

@henrywilliamsUpdated 19 hours ago

vapi-minutes-db2 file matches

@henrywilliamsUpdated 21 hours ago
socialdata
Affordable & reliable alternative to Twitter API: ➡️ Access user profiles, tweets, followers & timeline data in real-time ➡️ Monitor profiles with nearly instant alerts for new tweets, follows & profile updates ➡️ Simple integration
artivilla
founder @outapint.io vibe coding on val.town. dm me to build custom vals: https://artivilla.com