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%20%22Image%20title%22?q=fetch&page=10&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=fetch

Returns an array of strings in format "username" or "username/projectName"

Found 14440 results for "fetch"(1354ms)

ssscQuizadmin.http.ts3 matches

@all•Updated 1 day ago
128 });
129 } catch (error) {
130 return c.json({ error: "Failed to fetch data" }, 500);
131 }
132});
629
630 try {
631 const response = await fetch(\`/api/submissions/\${id}\`, {
632 method: 'DELETE',
633 headers: {
736}
737
738export default app.fetch;

ssscQuizindex.http.ts3 matches

@all•Updated 1 day ago
318 });
319 } catch (error) {
320 console.error("Error fetching analytics:", error);
321 return c.json({ error: "Failed to fetch analytics" }, 500);
322 }
323});
539
540// Export the Hono app as the default export for HTTP val
541export default app.fetch;

townie-testingexample-apis.ts2 matches

@chadparker•Updated 1 day ago
26 }
27
28 const response = await fetch(apiUrl);
29
30 if (!response.ok) {
38
39 } catch (error) {
40 return new Response(`Fetch Error: ${error.message}`, { status: 500 });
41 }
42}

ssscQuizindex.tsx1 match

@all•Updated 1 day ago
70 setIsSubmitting(true);
71 try {
72 const response = await fetch('/api/submit-quiz', {
73 method: 'POST',
74 headers: {
44});
45
46export default app.fetch;
47

tuempresaallinone.tsx26 matches

@arequipe•Updated 1 day ago
1import { blob } from "https://esm.town/v/std/blob";
2import { fetch } from "https://esm.town/v/std/fetch";
3
4export default async function generateCartaPorteCFDI(req: Request): Promise<Response> {
47 };
48
49 const fetchRecord = async (tableId: string, id: string) => {
50 const res = await fetch(`https://api.airtable.com/v0/${AIRTABLE_BASE_ID}/${tableId}/${id}`, {
51 headers: airtableHeaders,
52 });
53 if (!res.ok) {
54 const errorText = await res.text();
55 throw new Error(`Airtable fetch failed for ${tableId}/${id}: ${res.status} - ${errorText}`);
56 }
57 return (await res.json()).fields;
58 };
59
60 const fetchMultipleLinkedRecords = async (tableId: string, recordIds: string[]) => {
61 if (!recordIds || recordIds.length === 0) return [];
62 const records = await Promise.all(recordIds.map(id => fetchRecord(tableId, id)));
63 return records;
64 };
69 form.append("upload_preset", CLOUDINARY_UPLOAD_PRESET);
70
71 const res = await fetch(`https://api.cloudinary.com/v1_1/${CLOUDINARY_CLOUD_NAME}/upload`, {
72 method: "POST",
73 body: form,
83
84 const updateAirtableFields = async (tableId: string, id: string, fields: Record<string, any>) => {
85 const res = await fetch(`https://api.airtable.com/v0/${AIRTABLE_BASE_ID}/${tableId}/${id}`, {
86 method: "PATCH",
87 headers: airtableHeaders,
94 };
95
96 const fetchFromFacturama = async (id: string, type: "xml" | "pdf") => {
97 const url = `https://apisandbox.facturama.mx/api/Cfdi/${type}/issued/${id}`;
98 const res = await fetch(url, {
99 headers: {
100 Authorization: FACTURAMA_AUTH,
104
105 const body = await res.text();
106 if (!res.ok) throw new Error(`Facturama ${type.toUpperCase()} fetch failed: ${res.status} - ${body}`);
107 return JSON.parse(body)?.Content;
108 };
199 console.log("Catálogos JSON cargados exitosamente.");
200
201 // Fetch all related Airtable records in parallel
202 const viajeData = await fetchRecord(VIAJES_TABLE, recordId);
203
204 const emisorId = viajeData.Emisor?.[0];
223 bienes,
224 ] = await Promise.all([
225 emisorId ? fetchRecord(CLIENTES_TABLE, emisorId) : Promise.resolve(null),
226 clienteOrigenId ? fetchRecord(CLIENTES_TABLE, clienteOrigenId) : Promise.resolve(null),
227 clienteDestinoId ? fetchRecord(CLIENTES_TABLE, clienteDestinoId) : Promise.resolve(null),
228 origenId ? fetchRecord(UBICACIONES_TABLE, origenId) : Promise.resolve(null),
229 destinoId ? fetchRecord(UBICACIONES_TABLE, destinoId) : Promise.resolve(null),
230 unidadId ? fetchRecord(UNIDADES_TABLE, unidadId) : Promise.resolve(null),
231 operadorId ? fetchRecord(OPERADORES_TABLE, operadorId) : Promise.resolve(null),
232 fetchMultipleLinkedRecords(REMOLQUES_TABLE, remolqueIds), // Siempre fetch como mĂşltiples
233 fetchMultipleLinkedRecords(BIENES_TABLE, bienesIds),
234 ]);
235
545 let calculatedTotalDistRec = 0;
546 if (viajeData.Ubicaciones && Array.isArray(viajeData.Ubicaciones)) {
547 const ubicacionRecords = await fetchMultipleLinkedRecords(UBICACIONES_TABLE, viajeData.Ubicaciones);
548 for (const ubData of ubicacionRecords) {
549 if (
771 console.log("Receiver Name enviado:", cfdi.Receiver.Name);
772
773 const facturamaRes = await fetch("https://apisandbox.facturama.mx/3/cfdis", {
774 method: "POST",
775 headers: {
813
814 const [xmlBase64, pdfBase64] = await Promise.all([
815 fetchFromFacturama(id, "xml"),
816 fetchFromFacturama(id, "pdf"),
817 ]);
818

Workflow2main.tsx2 matches

@svc•Updated 1 day ago
506 this.addEventListeners();
507 try {
508 const res = await fetch(window.location.pathname + '?action=getWorkflows');
509 this.state.workflows = await res.json();
510 this.renderSelector();
568 this.elements.rejectBtn.disabled = true;
569 try {
570 const res = await fetch(window.location.pathname + \`?action=\${action}\`, {
571 method: 'POST',
572 headers: {'Content-Type': 'application/json'},

Change-Logs-Generatorgh-to-discord.tsx3 matches

@hussufo•Updated 1 day ago
1import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
2import { fetchAndPostCommits } from "./process-commits.tsx";
3
4/**
11 if (lastRunAt instanceof Date && lastRunAt.getTime() <= now.getTime()) {
12 const sinceTimestamp = lastRunAt.toISOString();
13 await fetchAndPostCommits(sinceTimestamp, untilTimestamp);
14 } else {
15 console.log("Skipped commit fetching: No valid or previous lastRunAt.");
16 }
17}

Change-Logs-GeneratorREADME.md2 matches

@hussufo•Updated 1 day ago
1# GitHub to Discord Changelog Notifier
2
3A val that automatically fetches GitHub commits from **multiple repositories** and posts formatted changelog updates to Discord. It categorizes commits based on [conventional commit messages](https://www.conventionalcommits.org/en/v1.0.0/) ie. `feat:`, `fix:` etc., and uses AI to generate user-friendly summaries.
4
5**Example:**
37### How to use
38
39- **`gh-to-discord.tsx`** is a cron that runs automatically based on your configured schedule, fetching commits since the last run
40
41- **`playground.tsx`**

Change-Logs-Generatorprocess-commits.tsx12 matches

@hussufo•Updated 1 day ago
296
297/**
298 * Fetch commits from GitHub for the given date range
299 */
300export async function fetchCommits(
301 since: string,
302 until: string,
310 const octokit = new Octokit({ auth: GITHUB_TOKEN });
311
312 // Fetch commits from all repositories
313 console.log(
314 `Fetching commits from ${REPOS.length} repositories between ${since} and ${until}`,
315 );
316
318
319 try {
320 // Fetch commits from each repository
321 for (const repo of REPOS) {
322 console.log(
323 `Fetching commits from ${repo.owner}/${repo.name} (${repo.branch})`,
324 );
325
346 } catch (repoError) {
347 console.error(
348 `❌ Error fetching commits from ${repo.owner}/${repo.name} (${repo.branch}):`,
349 repoError.message,
350 );
385
386/**
387 * Fetch commits and post to Discord
388 */
389export async function fetchAndPostCommits(
390 since: string,
391 until: string,
395 }
396
397 // Fetch commits from GitHub
398 const commits = await fetchCommits(since, until);
399
400 // If no commits are found, return early
405 return;
406 }
407 console.log(`Fetched ${commits.length} new commits.`);
408
409 // Process commits with LLM summary

testWeatherFetcher1 file match

@sjaskeprut•Updated 23 hours ago

weatherFetcher1 file match

@sjaskeprut•Updated 23 hours ago