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?q=fetch&page=132&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 9687 results for "fetch"(745ms)

pollinaterpbldemo.tsx4 matches

@armadillomike•Updated 1 week ago
9
10 useEffect(() => {
11 async function fetchSensorData() {
12 try {
13 // Simulated sensor data with realistic bee habitat conditions
19 setLastUpdated(new Date());
20 } catch (error) {
21 console.error("Error fetching sensor data", error);
22 }
23 }
24
25 fetchSensorData();
26 const intervalId = setInterval(fetchSensorData, 5000);
27 return () => clearInterval(intervalId);
28 }, []);

rdo-dailies-webhookmain.ts4 matches

@mmorihara•Updated 1 week ago
1import { discordWebhook } from "https://esm.town/v/mmorihara/coherentVioletFinch";
2
3const strings = await fetch("https://esm.town/v/mmorihara/rdo-dailies-webhook@8-dev/data.json").then(r => r.json());
4
5const templates: { [key: string]: (goalText: string, goalNum: number) => string } = {
82}
83
84async function fetchDailies() {
85 const response = await fetch("https://api.rdo.gg/challenges/index.json");
86 return response.json();
87}
141
142export async function main() {
143 const dailies = await fetchDailies();
144 const formatted = formatDailies(dailies);
145

whatsapp-callbackindex.tsx7 matches

@yawnxyz•Updated 1 week ago
53 console.log(`Attempting to send WhatsApp message to ${phoneNumber}: "${text}"`);
54 const context = originalMessageId ? { context: { message_id: originalMessageId } } : {};
55 const response = await fetch(
56 `https://graph.facebook.com/v22.0/${businessId}/messages`,
57 {
177 try {
178 console.log(`[SmartAck] Attempting to generate smart ack for: "${userQuery.substring(0, 50)}..." with ${QUICK_ACK_MODEL}`);
179 const groqResponse = await fetch("https://api.groq.com/openai/v1/chat/completions", {
180 method: "POST",
181 headers: {
308 console.log(`[initiateChat] Sending to CF Orchestrator (${CLOUDFLARE_WORKER_ORCHESTRATOR_URL}/initiate-async-chat) for ${userIdentifier}:`, JSON.stringify(mcpPayload, null, 2));
309
310 const mcpApiResponse = await fetch(`${CLOUDFLARE_WORKER_ORCHESTRATOR_URL}/initiate-async-chat`, {
311 method: "POST",
312 headers: { "Content-Type": "application/json" },
462 try {
463 console.log(`Marking read for ${userPhoneNumber} (msg_id: ${currentMessageId})`);
464 const markReadResp = await fetch(`https://graph.facebook.com/v22.0/${business_phone_number_id}/messages`, {
465 method: "POST", headers: {"Authorization": `Bearer ${WHATSAPP_GRAPH_API_TOKEN}`, "Content-Type": "application/json"},
466 body: JSON.stringify({messaging_product: "whatsapp", status: "read", message_id: currentMessageId}),
612
613 try {
614 const response = await fetch('/send-welcome', {
615 method: 'POST',
616 headers: { 'Content-Type': 'application/json' },
681 try {
682 console.log(`Attempting to send custom message to ${phoneNumber} via business ID ${WHATSAPP_BUSINESS_ID}: "${messageBody.substring(0,50)}..."`);
683 const response = await fetch(
684 `https://graph.facebook.com/v22.0/${WHATSAPP_BUSINESS_ID}/messages`,
685 {
713});
714
715export default (typeof Deno !== "undefined" && Deno.env.get("valtown")) ? app.fetch : app;

orangeSolemain.tsx6 matches

@temptemp•Updated 1 week ago
1import { fetch as proxiedFetch } from "https://esm.town/v/std/fetch";
2import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
3import { convertHTMLToJSON } from "https://esm.town/v/tempguy/liteutils";
4const baseURLReq = await fetch(
5 "https://multiembed.mov?video_id=114472&tmdb=1&s=1&e=2",
6 {
18};
19
20const baseReq = await proxiedFetch(baseURL, {
21 "headers": headers,
22 "body":
30const source = match[1];
31
32const serverList = await proxiedFetch("https://streamingnow.mov/response.php", {
33 method: "POST",
34 body: `token=${source}`,
45 `https://streamingnow.mov/playvideo.php?video_id=S0dpVVFEbWV3ZDBBNGI3QldBPT0=&server_id=42&token=${source}`,
46);
47const embedPage = await proxiedFetch(
48 `https://streamingnow.mov/playvideo.php?video_id=STJHWFR6aUcxTWdWNWI0PQ==&server_id=21&token=${source}`,
49);
69
70// FOR VIP STREAM ONLY
71const player = await fetch(url[1]);
72const regex = /eval\(function\(h,u,n,t,e,r\).*?\("(.*?)",\d*?,"(.*?)",(\d*?),(\d*?),\d*?\)\)/;
73const linkRegex = /file:"(.*?)"/;

Flarum-Discussion-To-PlainTextapp.tsx3 matches

@tyler71•Updated 1 week ago
122async function getDiscussionPosts(discussionId: string): Promise<PostT[]> {
123 // Used to get the list of post id's for the discussion.
124 const discussionRes = await fetch(`${server}/api/discussions/${discussionId}`);
125 const discussionResJson = await discussionRes.json();
126
134
135 await Promise.all(chunks.map(async (c: string[]) => {
136 const postRes = await fetch(`${server}/api/posts?filter[id]=${c.join(",")}`);
137 const postJson = await postRes.json();
138
215`;
216
217export default app.fetch;
GitHub-Release-Notes

GitHub-Release-NotesReleaseNotes.tsx1 match

@charmaine•Updated 1 week ago
222
223 try {
224 const response = await fetch("/api/share", {
225 method: "POST",
226 headers: {
GitHub-Release-Notes

GitHub-Release-Notesgithub.ts25 matches

@charmaine•Updated 1 week ago
2
3/**
4 * Fetches commits from a GitHub repository within a date range
5 * Implements pagination to fetch all commits
6 */
7export async function fetchCommits(
8 token: string,
9 owner: string,
34 };
35
36 console.log(`Fetching commits between ${sinceISO} and ${untilISO}`);
37
38 // Fetch all pages
39 while (hasMorePages) {
40 const url =
41 `https://api.github.com/repos/${owner}/${repo}/commits?since=${sinceISO}&until=${untilISO}&per_page=100&page=${page}`;
42 console.log(`Fetching page ${page}...`);
43
44 const response = await fetch(url, { headers });
45
46 if (!response.ok) {
64 }
65
66 console.log(`Fetched a total of ${allCommits.length} commits`);
67 return allCommits;
68}
69
70/**
71 * Fetches a pull request by its number
72 */
73export async function fetchPR(
74 token: string,
75 owner: string,
79 const url = `https://api.github.com/repos/${owner}/${repo}/pulls/${prNumber}`;
80
81 const response = await fetch(url, {
82 headers: {
83 "Accept": "application/vnd.github.v3+json",
101
102/**
103 * Fetches pull requests associated with a commit.
104 */
105async function fetchPRsForCommit(
106 token: string,
107 owner: string,
111 const url = `https://api.github.com/repos/${owner}/${repo}/commits/${commitSha}/pulls`;
112
113 const response = await fetch(url, {
114 headers: {
115 "Accept": "application/vnd.github.v3+json",
133
134/**
135 * Fetches issues referenced by a commit or PR using GitHub API
136 */
137async function fetchIssueReferences(
138 token: string,
139 owner: string,
149 const prIssuesUrl = `https://api.github.com/repos/${owner}/${repo}/pulls/${prNumber}/commits`;
150
151 const prResponse = await fetch(prIssuesUrl, {
152 headers: {
153 "Accept": "application/vnd.github.v3+json",
182 const timelineUrl = `https://api.github.com/repos/${owner}/${repo}/issues/${prNumber}/timeline`;
183
184 const timelineResponse = await fetch(timelineUrl, {
185 headers: {
186 "Accept": "application/vnd.github.mockingbird-preview+json",
211
212/**
213 * Fetches commits and their associated PRs
214 * Includes progress tracking for large repositories
215 * Uses GitHub API to find PR and issue references
216 */
217export async function fetchCommitsWithPRs(
218 token: string,
219 owner: string,
222 endDate: string,
223): Promise<CommitWithPR[]> {
224 // Fetch all commits with pagination
225 const commits = await fetchCommits(token, owner, repo, startDate, endDate);
226
227 const commitsWithPRs: CommitWithPR[] = [];
236 const batchPromises = batch.map(async (commit) => {
237 // Use GitHub API to find associated PRs for this commit
238 const associatedPRs = await fetchPRsForCommit(token, owner, repo, commit.sha);
239
240 let pr: GitHubPR | null = null;
246
247 // Get issue references using the GitHub API
248 const prIssueRefs = await fetchIssueReferences(token, owner, repo, commit.sha, pr.number);
249 issueRefs = [...prIssueRefs];
250 } else {
251 // If no PR is associated, still check for issue references in the commit
252 const commitIssueRefs = await fetchIssueReferences(token, owner, repo, commit.sha);
253 issueRefs = [...commitIssueRefs];
254 }

TownieuseProject.tsx5 matches

@jxnblk•Updated 1 week ago
11 const [error, setError] = useState(null);
12
13 const fetchData = async () => {
14 try {
15 const projectEndpoint = new URL(PROJECT_ENDPOINT, window.location.origin);
23 };
24
25 const { project } = await fetch(projectEndpoint, { headers })
26 .then(res => res.json());
27 const { files } = await fetch(filesEndpoint, { headers })
28 .then(res => res.json());
29
40 useEffect(() => {
41 if (!projectId) return;
42 fetchData();
43 }, [projectId, branchId]);
44
45 return { data, loading, error, refetch: fetchData };
46}
47

TownieuseProjects.tsx5 matches

@jxnblk•Updated 1 week ago
10 const [error, setError] = useState(null);
11
12 const fetchData = async () => {
13 try {
14 const res = await fetch(ENDPOINT, {
15 headers: {
16 "Authorization": "Bearer " + token,
18 })
19 const data = await res.json();
20 console.log("useProjects fetchData", { res, data });
21 if (!res.ok) {
22 console.error(data);
39
40 useEffect(() => {
41 fetchData();
42 }, []);
43
44 return { data, loading, error, refetch: fetchData };
45}
46

TownieuseCreateProject.tsx1 match

@jxnblk•Updated 1 week ago
19 setError(null);
20 try {
21 const res = await fetch(ENDPOINT, {
22 method: "POST",
23 headers: {

agentplex-deal-flow-email-fetch1 file match

@anandvc•Updated 1 day ago

proxyFetch2 file matches

@vidar•Updated 3 days ago