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/$%7Burl%7D?q=fetch&page=2&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 8136 results for "fetch"(1199ms)

slack-prgithub-pr-inherit-labels.ts10 matches

@charmaineโ€ขUpdated 5 hours ago
108 console.log("๐Ÿ” Current PR labels:", currentLabels);
109
110 // Fetch labels from all linked issues
111 const repo = payload.repository.full_name;
112 let allIssueLabels: string[] = [];
113
114 for (const issueNumber of issueNumbers) {
115 console.log(`๐Ÿ” Fetching labels for issue #${issueNumber}`);
116 try {
117 const issue = await fetchIssue(repo, issueNumber);
118 const issueLabels = issue.labels.map(label => label.name);
119 console.log(`๐Ÿ” Labels for issue #${issueNumber}:`, issueLabels);
126 }
127 } catch (error) {
128 console.error(`โŒ Error fetching issue #${issueNumber}:`, error);
129 // Continue with other issues even if one fails
130 }
190}
191
192// Fetch issue details
193async function fetchIssue(repo: string, issueNumber: number): Promise<GitHubIssue> {
194 const token = Deno.env.get("GITHUB_TOKEN");
195
199
200 const url = `https://api.github.com/repos/${repo}/issues/${issueNumber}`;
201 console.log("๐Ÿ” Fetching issue from:", url);
202
203 const response = await fetch(url, {
204 headers: {
205 "Authorization": `token ${token}`,
221 console.error("โŒ GitHub API error text:", errorText);
222 }
223 throw new Error(`Failed to fetch issue: ${errorMessage}`);
224 }
225
240 console.log("๐Ÿ” Sending labels update request to:", url);
241
242 const response = await fetch(url, {
243 method: "POST",
244 headers: {

slack-prREADME.md1 match

@charmaineโ€ขUpdated 5 hours ago
712. This Val filters for approval events
723. When an approval is detected, it:
73 - Fetches detailed PR information
74 - Checks if the PR is mergeable and all required checks are passing
75 - Sends a formatted message to Slack

slack-prgithub-pr-auto-assign.ts1 match

@charmaineโ€ขUpdated 5 hours ago
158 console.log("๐Ÿ” Sending assignee request to:", url);
159
160 const response = await fetch(url, {
161 method: "POST",
162 headers: {

slack-prgithub-pr-title-prefix.ts1 match

@charmaineโ€ขUpdated 5 hours ago
165 console.log("๐Ÿ” Sending title update request to:", url);
166
167 const response = await fetch(url, {
168 method: "PATCH",
169 headers: {

slack-prgithub-slack-pr-approvals.ts25 matches

@charmaineโ€ขUpdated 5 hours ago
204
205 // Get detailed PR info including checks status
206 console.log("๐Ÿ” Fetching detailed PR info...");
207 try {
208 const prDetails = await fetchPRDetails(repository.full_name, pull_request.number);
209 console.log("๐Ÿ” PR details fetched successfully");
210 console.log("๐Ÿ” PR mergeable status:", prDetails.mergeable);
211 console.log("๐Ÿ” PR mergeable state:", prDetails.mergeable_state);
236 return new Response("Notification sent to Slack", { status: 200 });
237 } catch (prError) {
238 console.error("โŒ Error fetching PR details or sending notification:", prError);
239 console.error("โŒ Error stack:", prError.stack);
240 return new Response(`Error: ${prError.message}\nStack: ${prError.stack}`, { status: 500 });
360}
361
362// Fetch detailed PR information including checks status
363async function fetchPRDetails(repo: string, prNumber: number) {
364 console.log(`๐Ÿ” Starting fetchPRDetails for PR #${prNumber} in ${repo}`);
365
366 const token = Deno.env.get("GITHUB_TOKEN");
373 // Get PR details
374 const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}`;
375 console.log("๐Ÿ” Fetching from GitHub API URL:", url);
376
377 let response;
378 try {
379 response = await fetch(url, {
380 headers: {
381 "Authorization": `token ${token}`,
388 console.log("๐Ÿ” Response status text:", response.statusText);
389 console.log("๐Ÿ” Response headers:", JSON.stringify(Object.fromEntries([...response.headers])));
390 } catch (fetchError) {
391 console.error("โŒ Network error fetching PR details:", fetchError);
392 console.error("โŒ Error stack:", fetchError.stack);
393 throw new Error(`Network error fetching PR details: ${fetchError.message}`);
394 }
395
413 }
414
415 throw new Error(`Failed to fetch PR details: ${response.status} ${response.statusText}`);
416 }
417
461 console.log("๐Ÿ” Verifying PR is still mergeable before attempting merge");
462 try {
463 const prDetails = await fetchPRDetails(repo, prNumber);
464 console.log("๐Ÿ” PR current mergeable status:", prDetails.mergeable);
465 console.log("๐Ÿ” PR current mergeable state:", prDetails.mergeable_state);
504 let response;
505 try {
506 response = await fetch(url, {
507 method: "PUT",
508 headers: {
518 console.log("๐Ÿ” Response status text:", response.statusText);
519 console.log("๐Ÿ” Response headers:", JSON.stringify(Object.fromEntries([...response.headers])));
520 } catch (fetchError) {
521 console.error("โŒ Network error during merge request:", fetchError);
522 console.error("โŒ Error stack:", fetchError.stack);
523 return {
524 success: false,
525 message: `Network error during merge: ${fetchError.message}`
526 };
527 }
676 let response;
677 try {
678 response = await fetch(slackWebhookUrl, {
679 method: "POST",
680 headers: {
687 console.log("๐Ÿ” Response status text:", response.statusText);
688 console.log("๐Ÿ” Response headers:", JSON.stringify(Object.fromEntries([...response.headers])));
689 } catch (fetchError) {
690 console.error("โŒ Network error sending to Slack:", fetchError);
691 console.error("โŒ Error stack:", fetchError.stack);
692 throw new Error(`Network error sending to Slack: ${fetchError.message}`);
693 }
694

TownieuseAuth.tsx1 match

@valdottownโ€ขUpdated 6 hours ago
15 // replace all this with oauth when it's ready
16 try {
17 const res = await fetch("/api/user", {
18 headers: {
19 "Authorization": "Bearer " + valTownAPIKey,

helloooooooindex.ts1 match

@charmaineโ€ขUpdated 8 hours ago
129
130// This is the entry point for HTTP vals
131export default app.fetch;

helloooooooindex.html2 matches

@charmaineโ€ขUpdated 8 hours ago
116 posts = window.INITIAL_DATA.posts;
117 } else {
118 const response = await fetch('/api/posts');
119 posts = await response.json();
120 }
156
157 try {
158 const response = await fetch(`/api/posts/${params.slug}`);
159
160 if (!response.ok) {

sqliteExplorerApp2main.tsx4 matches

@shouserโ€ขUpdated 8 hours ago
1/** @jsxImportSource npm:hono/jsx **/
2
3import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import { iframeHandler } from "https://esm.town/v/nbbaier/iframeHandler";
5import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
16import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
17import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
18import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
19import { Hono } from "npm:hono";
20import type { FC } from "npm:hono/jsx";
175});
176
177export const handler = app.fetch;
178export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));

blogggggindex.ts1 match

@charmaineโ€ขUpdated 8 hours ago
167}
168
169export default app.fetch;

fetchPaginatedData2 file matches

@nbbaierโ€ขUpdated 1 week ago

FetchBasic1 file match

@fredmoonโ€ขUpdated 1 week ago