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=6&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 11437 results for "api"(1201ms)

eink-framegenerateImageFromHtml.ts5 matches

@pcar•Updated 12 hours ago
1// Generates a screenshot using APIFlash.com from a url
2// API key required
3
4// TODO: Add caching of image
11 return new Response("No url provided", { status: 500 });
12 }
13 const apiKey = Deno.env.get("API_FLASH_KEY");
14 const generateUrl =
15 `https://api.apiflash.com/v1/urltoimage?access_key=${apiKey}&url=${valUrl}&width=${width}&height=${height}&format=png&fresh=true`;
16
17 try {
18 const response = await fetch(generateUrl);
19 if (!response.ok) {
20 throw new Error(`APIFlash responded with status: ${response.status}`);
21 }
22 return response;

eink-framefetchWithCache.ts3 matches

@pcar•Updated 12 hours ago
7
8export default async function fetchWithCache(
9 apiUrl: string,
10 cacheKey: string,
11 cacheMinutes: number = 10,
38
39 // Fetch new data if no valid cache exists
40 const response = await fetch(apiUrl);
41 if (!response.ok) {
42 throw new Error(`API responded with status: ${response.status}`);
43 }
44 const data = await response.json();

eink-framecomponents.tsx6 matches

@pcar•Updated 12 hours ago
9 <meta charSet="UTF-8" />
10 <title>{title}</title>
11 <link rel="preconnect" href="https://fonts.googleapis.com" />
12 {/* Getting a type error here */}
13 {/* <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> */}
14 <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet" />
15 <link href="https://fonts.googleapis.com/css2?family=Doto:wght@100..900&display=swap" rel="stylesheet" />
16 <link href="https://fonts.googleapis.com/css2?family=Rancho&display=swap" rel="stylesheet" />
17 <link href="https://fonts.googleapis.com/css2?family=Permanent+Marker&display=swap" rel="stylesheet" />
18 <link
19 href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap"
20 rel="stylesheet"
21 />

eink-frameapod.tsx1 match

@pcar•Updated 12 hours ago
2import React from "https://esm.sh/react";
3import { renderToString } from "https://esm.sh/react-dom/server/";
4import GetAPOD, { type APOD } from "../api/apod.ts";
5import { BodyWrapper, Header } from "../components.tsx";
6

eink-frameapod.ts3 matches

@pcar•Updated 12 hours ago
11};
12
13const NASA_API_KEY = Deno.env.get("NASA_API_KEY");
14
15export default async function GetAPOD(req: Request): Promise<Response> {
16 const url = `https://api.nasa.gov/planetary/apod?api_key=${NASA_API_KEY}&thumbs=true`;
17 const cacheKey = "nasa_apod";
18 const cacheMinutes = 60;
21
22 if (!data) {
23 return new Response("No data from Nasa API", { status: 404 });
24 }
25

pixiebrix-kb-demokb.tsx3 matches

@twschiller•Updated 13 hours ago
11export const server = async (req: Request) => {
12 if (!req.headers.has("Authorization")) {
13 return Response.json({ message: "No API token provided." }, {
14 status: 401,
15 });
16 }
17
18 if (req.headers.get("Authorization") !== process.env.API_KEY) {
19 return Response.json({ message: "Invalid API token provided." }, {
20 status: 403,
21 });

LEDStrain-Discussion-To-PlainTextapp.tsx2 matches

@tyler71•Updated 16 hours ago
23
24 // Used to get the list of post id's for the discussion.
25 const discussionRes = await fetch(`${server}/api/discussions/${discussionId}`);
26 const discussionResJson = await discussionRes.json();
27
35
36 await Promise.all(chunks.map(async (c: string[]) => {
37 const postRes = await fetch(`${server}/api/posts?filter[id]=${c.join(",")}`);
38 const postJson = await postRes.json();
39

mod-interview-apiapi.js0 matches

@twschiller•Updated 16 hours ago
1// export default async function (req: Request): Promise<Response> {
2
3// if (req.url)
4
5// return Response.json({ tasks: [] });

a4595dc5b24_handleTelegramMessage.ts7 matches

@vtTestLocal•Updated 17 hours ago
92
93/**
94 * Format chat history for Anthropic API
95 */
96function formatChatHistoryForAI(history) {
321bot.on("message", async (ctx) => {
322 try {
323 // Get Anthropic API key from environment
324 const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
325 if (!apiKey) {
326 console.error("Anthropic API key is not configured.");
327 ctx.reply(
328 "I apologize, but I'm not properly configured at the moment. Please inform the household administrator."
332
333 // Initialize Anthropic client
334 const anthropic = new Anthropic({ apiKey });
335
336 // Get message text and user info
502 // Set webhook if it is not set yet
503 if (!isEndpointSet) {
504 await bot.api.setWebhook(req.url, {
505 secret_token: SECRET_TOKEN,
506 });

a4595dc5b24_index.ts11 matches

@vtTestLocal•Updated 17 hours ago
18});
19
20// --- API Routes for Memories ---
21
22// GET /api/memories - Retrieve all memories
23app.get("/api/memories", async (c) => {
24 const memories = await getAllMemories();
25 return c.json(memories);
26});
27
28// POST /api/memories - Create a new memory
29app.post("/api/memories", async (c) => {
30 const body = await c.req.json<Omit<Memory, "id">>();
31 if (!body.text) {
36});
37
38// PUT /api/memories/:id - Update an existing memory
39app.put("/api/memories/:id", async (c) => {
40 const id = c.req.param("id");
41 const body = await c.req.json<Partial<Omit<Memory, "id">>>();
58});
59
60// DELETE /api/memories/:id - Delete a memory
61app.delete("/api/memories/:id", async (c) => {
62 const id = c.req.param("id");
63 try {
75// --- Blob Image Serving Routes ---
76
77// GET /api/images/:filename - Serve images from blob storage
78app.get("/api/images/:filename", async (c) => {
79 const filename = c.req.param("filename");
80

mod-interview-api1 file match

@twschiller•Updated 16 hours ago

daily-advice-app1 file match

@dcm31•Updated 3 days ago
Random advice app using Advice Slip API
apiv1
papimark21