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=1&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 8131 results for "fetch"(965ms)

untitled-2604new-file-9513.tsx3 matches

@al0โ€ขUpdated 36 mins ago
77 const url = 'https://api.openai.com/v1/chat/completions';
78
79 const response = await fetch(url, {
80 method: 'POST',
81 headers: {
112 const url = 'https://api.anthropic.com/v1/messages';
113
114 const response = await fetch(url, {
115 method: 'POST',
116 headers: {
374
375 // Enviar solicitud
376 const response = await fetch(endpointUrl, {
377 method: 'POST',
378 headers: {

morningmailmain.tsx1 match

@flymasterโ€ขUpdated 36 mins ago
10
11async function wikitext(): string {
12 const randomArticle = await fetch(
13 "https://en.wikipedia.org/w/api.php?action=query&format=json&prop=extracts&exintro&explaintext&redirects=1&generator=random&formatversion=2&grnnamespace=0&grnlimit=3",
14 );

LEDStrain-Discussion-To-PlainTextapp.tsx2 matches

@tyler71โ€ขUpdated 1 hour ago
81async function getDiscussionPosts(discussionId: string): Promise<PostT[]> {
82 // Used to get the list of post id's for the discussion.
83 const discussionRes = await fetch(`${server}/api/discussions/${discussionId}`);
84 const discussionResJson = await discussionRes.json();
85
93
94 await Promise.all(chunks.map(async (c: string[]) => {
95 const postRes = await fetch(`${server}/api/posts?filter[id]=${c.join(",")}`);
96 const postJson = await postRes.json();
97

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

@charmaineโ€ขUpdated 1 hour 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 1 hour 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 1 hour 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 2 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 2 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

Towniesend-message.ts3 matches

@valdottownโ€ขUpdated 2 hours ago
79 }
80
81 // If there are selected files, fetch their content and add them to the messages
82 if (selectedFiles && selectedFiles.length > 0) {
83 const vt = new ValTown({ bearerToken });
99 fileContents += `## File: ${filePath}\n\`\`\`\n${fileWithLinesNumbers(content)}\n\`\`\`\n\n`;
100 } catch (error) {
101 console.error(`Error fetching file ${filePath}:`, error);
102 fileContents += `## File: ${filePath}\nError: Could not fetch file content\n\n`;
103 }
104 }

TownieuseAuth.tsx1 match

@valdottownโ€ขUpdated 2 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,

fetchPaginatedData2 file matches

@nbbaierโ€ขUpdated 1 week ago

FetchBasic1 file match

@fredmoonโ€ขUpdated 1 week ago