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=726&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 11601 results for "api"(922ms)

cerebras_codermain.tsx3 matches

@the_samoudiUpdated 4 months ago
1042 };
1043 } else {
1044 const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
1045 const completion = await client.chat.completions.create({
1046 messages: [
1163 <meta name="viewport" content="width=device-width, initial-scale=1.0">
1164 <title>CerebrasCoder</title>
1165 <link rel="preconnect" href="https://fonts.googleapis.com" />
1166 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
1167 <link
1168 href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap"
1169 rel="stylesheet"
1170 />

hardworkingLimeCheetahmain.tsx3 matches

@stevekrouseUpdated 4 months ago
1043 };
1044 } else {
1045 const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
1046 const completion = await client.chat.completions.create({
1047 messages: [
1164 <meta name="viewport" content="width=device-width, initial-scale=1.0">
1165 <title>CerebrasCoder</title>
1166 <link rel="preconnect" href="https://fonts.googleapis.com" />
1167 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
1168 <link
1169 href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap"
1170 rel="stylesheet"
1171 />

hardworkingLimeCheetahREADME.md2 matches

@stevekrouseUpdated 4 months ago
4
51. Sign up for [Cerebras](https://cloud.cerebras.ai/)
62. Get a Cerebras API Key
73. Save it in a [Val Town environment variable](https://www.val.town/settings/environment-variables) called `CEREBRAS_API_KEY`
8
9# Todos

cerebras_coderREADME.md2 matches

@the_samoudiUpdated 4 months ago
4
51. Sign up for [Cerebras](https://cloud.cerebras.ai/)
62. Get a Cerebras API Key
73. Save it in a [Val Town environment variable](https://www.val.town/settings/environment-variables) called `CEREBRAS_API_KEY`
8
9# Todos

EnkakuAuthenticatedAPIREADME.md1 match

@paul_lecamUpdated 4 months ago
1Migrated from folder: Enkaku/EnkakuAuthenticatedAPI

calmRoseCaterpillarmain.tsx1 match

@hameedUpdated 4 months ago
374 <title>Function Mermaid Diagram Generator</title>
375 <meta name="viewport" content="width=device-width, initial-scale=1">
376 <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap" rel="stylesheet">
377 <script src="https://esm.town/v/std/catch"></script>
378 </head>

tvshowsmain.tsx2 matches

@GlenchUpdated 4 months ago
23 for (var i = 0; i < TV_SHOWS_WATCHED.length; ++i) {
24 const show_id = TV_SHOWS_WATCHED[i];
25 const url = `https://api.themoviedb.org/3/tv/${show_id}?api_key=${process.env.tmdb_api_key}`;
26 const resp = await fetch(url);
27 const show = await resp.json();
38 title: "My TV Shows",
39 link: "https://www.val.town/Glench.tvshows",
40 description: "Personal shows from tmdb api and val.town",
41 item: {
42 title: (x) =>

blob_adminmain.tsx25 matches

@stevekrouse1Updated 4 months ago
73 const menuRef = useRef(null);
74 const isPublic = blob.key.startsWith("__public/");
75 const publicUrl = isPublic ? `${window.location.origin}/api/public/${encodeURIComponent(blob.key.slice(9))}` : null;
76
77 useEffect(() => {
237 setLoading(true);
238 try {
239 const response = await fetch(`/api/blobs?prefix=${encodeKey(searchPrefix)}&limit=${limit}`);
240 const data = await response.json();
241 setBlobs(data);
264 setBlobContentLoading(true);
265 try {
266 const response = await fetch(`/api/blob?key=${encodeKey(clickedBlob.key)}`);
267 const content = await response.text();
268 setSelectedBlob({ ...clickedBlob, key: decodeKey(clickedBlob.key) });
278 const handleSave = async () => {
279 try {
280 await fetch(`/api/blob?key=${encodeKey(selectedBlob.key)}`, {
281 method: "PUT",
282 body: editContent,
290 const handleDelete = async (key) => {
291 try {
292 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
293 setBlobs(blobs.filter(b => b.key !== key));
294 if (selectedBlob && selectedBlob.key === key) {
307 const key = `${searchPrefix}${file.name}`;
308 formData.append("key", encodeKey(key));
309 await fetch("/api/blob", { method: "POST", body: formData });
310 const newBlob = { key, size: file.size, lastModified: new Date().toISOString() };
311 setBlobs([newBlob, ...blobs]);
329 try {
330 const fullKey = `${searchPrefix}${key}`;
331 await fetch(`/api/blob?key=${encodeKey(fullKey)}`, {
332 method: "PUT",
333 body: "",
344 const handleDownload = async (key) => {
345 try {
346 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
347 const blob = await response.blob();
348 const url = window.URL.createObjectURL(blob);
363 if (newKey && newKey !== oldKey) {
364 try {
365 const response = await fetch(`/api/blob?key=${encodeKey(oldKey)}`);
366 const content = await response.blob();
367 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
368 method: "PUT",
369 body: content,
370 });
371 await fetch(`/api/blob?key=${encodeKey(oldKey)}`, { method: "DELETE" });
372 setBlobs(blobs.map(b => b.key === oldKey ? { ...b, key: newKey } : b));
373 if (selectedBlob && selectedBlob.key === oldKey) {
383 const newKey = `__public/${key}`;
384 try {
385 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
386 const content = await response.blob();
387 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
388 method: "PUT",
389 body: content,
390 });
391 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
392 setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
393 if (selectedBlob && selectedBlob.key === key) {
402 const newKey = key.slice(9); // Remove "__public/" prefix
403 try {
404 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
405 const content = await response.blob();
406 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
407 method: "PUT",
408 body: content,
409 });
410 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
411 setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
412 if (selectedBlob && selectedBlob.key === key) {
557 onClick={() =>
558 copyToClipboard(
559 `${window.location.origin}/api/public/${encodeURIComponent(selectedBlob.key.slice(9))}`,
560 )}
561 className="text-blue-400 hover:text-blue-300 text-sm"
580 >
581 <img
582 src={`/api/blob?key=${encodeKey(selectedBlob.key)}`}
583 alt="Blob content"
584 className="max-w-full h-auto"
660
661// Public route without authentication
662app.get("/api/public/:id", async (c) => {
663 const key = `__public/${c.req.param("id")}`;
664 const { blob } = await import("https://esm.town/v/std/blob");
766};
767
768app.get("/api/blobs", checkAuth, async (c) => {
769 const prefix = c.req.query("prefix") || "";
770 const limit = parseInt(c.req.query("limit") || "20", 10);
775});
776
777app.get("/api/blob", checkAuth, async (c) => {
778 const key = c.req.query("key");
779 if (!key) return c.text("Missing key parameter", 400);
783});
784
785app.put("/api/blob", checkAuth, async (c) => {
786 const key = c.req.query("key");
787 if (!key) return c.text("Missing key parameter", 400);
792});
793
794app.delete("/api/blob", checkAuth, async (c) => {
795 const key = c.req.query("key");
796 if (!key) return c.text("Missing key parameter", 400);
800});
801
802app.post("/api/blob", checkAuth, async (c) => {
803 const { file, key } = await c.req.parseBody();
804 if (!file || !key) return c.text("Missing file or key", 400);

marpmain.tsx2 matches

@pomdtrUpdated 4 months ago
1import { api } from "https://esm.town/v/pomdtr/api";
2import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
3import { Marp } from "npm:@marp-team/marp-core";
5export default async function() {
6 const { author, name } = extractValInfo(import.meta.url);
7 const { readme } = await api(`/v1/alias/${author}/${name}`);
8
9 const marp = new Marp();

devstatsmain.tsx3 matches

@carburoUpdated 4 months ago
22 <meta name="viewport" content="width=device-width, initial-scale=1.0">
23 <title>DevStats Dashboard</title>
24 <link rel="preconnect" href="https://fonts.googleapis.com">
25 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
26 <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap" rel="stylesheet">
27 <script src="https://cdn.tailwindcss.com"></script>
28 <script src="https://esm.town/v/std/catch"></script>
126type Rows = Awaited<ReturnType<typeof getRows>>
127
128app.get("/api", async function apiRoute(c) {
129 try {
130 return c.json(await getRows())

new-val-api-21 file match

@shouserUpdated 11 hours ago
This is an example of using the API to create a val.

gptApiTemplate2 file matches

@charmaineUpdated 1 day ago
papimark21
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