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/?q=fetch&page=7&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 14463 results for "fetch"(2847ms)

Towniestripe-webhook.ts2 matches

@ianmenethil•Updated 1 day ago
47
48 try {
49 // TODO: could not get the SDK working but would be great to use this instead of the fetch
50 //const paymentIntent: Stripe.PaymentIntent = await stripe.paymentIntents.retrieve(session.client_reference_id);
51
52 const response = await fetch(`https://api.stripe.com/v1/payment_intents/${session.client_reference_id}`, {
53 method: 'GET',
54 headers: {

Towniesend-message.ts5 matches

@ianmenethil•Updated 1 day ago
20import {
21 makeChangeValTypeTool,
22 makeFetchTool,
23 makeTextEditorTool,
24 makeTracesTool,
175 }
176
177 // If there are selected files, fetch their content and add them to the messages
178 if (selectedFiles && selectedFiles.length > 0) {
179 const vt = new ValTown({ bearerToken });
197 }\n\`\`\`\n\n`;
198 } catch (error) {
199 console.error(`Error fetching file ${filePath}:`, error);
200 fileContents +=
201 `## File: ${filePath}\nError: Could not fetch file content\n\n`;
202 }
203 }
251 branch_id: branchId,
252 }),
253 fetch: makeFetchTool({ bearerToken, project, branch_id: branchId }),
254 requests: makeTracesTool({ bearerToken, project, branch_id: branchId }),
255 },

TownieREADME.md1 match

@ianmenethil•Updated 1 day ago
8
9- **AI-Assisted Editing**: Chat with Claude 4 Sonnet about your code and let it make changes directly to your project files
10- **Fetch tool**: Townie is able to make HTTP calls to your HTTP services to test them and continue iterating
11- **Branch Management**: View, select, and create branches without leaving the app
12- **Sound Notifications**: Get alerted when Claude finishes responding

Towniepurchase-credits.ts1 match

@ianmenethil•Updated 1 day ago
73 });
74
75 const response = await fetch("https://api.stripe.com/v1/payment_intents", {
76 method: "POST",
77 headers: {

TowniePurchaseCreditsRoute.tsx5 matches

@ianmenethil•Updated 1 day ago
10
11 useEffect(() => {
12 fetchBalance();
13 }, []);
14
15 const fetchBalance = async () => {
16 try {
17 const response = await fetch("/api/credit-balance");
18 if (response.ok) {
19 const data = await response.json();
21 }
22 } catch (err) {
23 console.error("Failed to fetch balance:", err);
24 }
25 };
35
36 try {
37 const response = await fetch("/api/purchase-credits", {
38 method: "POST",
39 headers: { "Content-Type": "application/json" },

Townieproject-files.ts2 matches

@ianmenethil•Updated 1 day ago
30 return c.json({ files: files.data });
31 } catch (error) {
32 console.error("Error fetching project files:", error);
33 return Response.json({ error: "Failed to fetch project files" }, { status: 500 });
34 }
35});

Townieproject-branches.ts2 matches

@ianmenethil•Updated 1 day ago
21 return c.json({ branches: branches.data });
22 } catch (error) {
23 console.error("Error fetching branches:", error);
24 return Response.json({ error: "Failed to fetch branches" }, { status: 500 });
25 }
26});
19solution that changes as little code as possible.
20
21Use your 'fetch' tool to debug HTTP vals making requests to them and examining the responses.
22
23Use your 'requests' tool to debug all kinds of vals. It'll show you the logs made during the file execution and the attributes associated it, including headers, http status, run time, error messages and error stack traces.

TownieMessages.tsx9 matches

@ianmenethil•Updated 1 day ago
256 </>
257 );
258 case "fetch":
259 return (
260 <Details
269 summary={(
270 <>
271 <div>fetch:</div>
272 <div>{args?.valPath}</div>
273 <div>{args?.urlPath || "/"}</div>
275 )}>
276 {result?.type === "success" ? (
277 <div className="fetch-result">
278 <div className="fetch-header">
279 <span className={`status-badge ${result.data.status >= 200 && result.data.status < 300 ? 'success' :
280 result.data.status >= 300 && result.data.status < 400 ? 'redirect' :
284 <span className="response-time">{result.data.responseTime}ms</span>
285 </div>
286 <div className="fetch-section">
287 <h4>Headers</h4>
288 <pre className="fetch-headers">{JSON.stringify(result.data.headers, null, 2)}</pre>
289 </div>
290 <div className="fetch-section">
291 <h4>Response Body</h4>
292 <pre className="fetch-body">
293 {typeof result.data.body === 'object'
294 ? JSON.stringify(result.data.body, null, 2)
298 </div>
299 ) : (
300 <div className="fetch-error">
301 <h4>Error</h4>
302 <pre>{result?.message || "Unknown error"}</pre>

Townieindex.ts1 match

@ianmenethil•Updated 1 day ago
218});
219
220export default app.fetch;

testWeatherFetcher1 file match

@sjaskeprut•Updated 1 day ago

weatherFetcher1 file match

@sjaskeprut•Updated 1 day ago