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//%22https:/esm.town/v/stevekrouse/passkey_script/%22?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 19116 results for "fetch"(811ms)

flowxo-http-bot-samplescript.js6 matches

@flowxo•Updated 24 mins ago
34 },
35 };
36 return fetch("/in", opts).then(() => payload);
37}
38
60
61function resetMessages() {
62 return fetch("/reset");
63}
64
65function getMessages() {
66 return fetch("/messages")
67 .then((response) => response.json())
68 .then((data) => data.messages);
74}
75
76// fetch the initial list of messages
77fetch("/messages")
78 .then((response) => response.json()) // parse the JSON from the server
79 .then((data) => {
84 data.messages.forEach(appendNewMessage);
85
86 //set a timer to continuously fetch new messages
87 setInterval(() => getMessages().then(displayMessages), 1000);
88
Gemini-2-5-Pro-O-01

Gemini-2-5-Pro-O-01main.tsx3 matches

@aibotcommander•Updated 27 mins ago
262async function imageToBase64(imageUrl: string): Promise<{ data: string; mimeType: string }> {
263 try {
264 const response = await fetch(imageUrl, { timeout: 8000 });
265 if (!response.ok) {
266 throw new Error(`Failed to fetch image: ${response.status}`);
267 }
268 const arrayBuffer = await response.arrayBuffer();
309
310 const url = `${config.endpoint}?key=${process.env.GEMINI_API_KEY}`;
311 const response = await fetch(url, {
312 method: "POST",
313 headers: config.headers,

SonarMiniAppScreen.tsx2 matches

@moe•Updated 30 mins ago
6import { Debug, NavOutlet, PaddedError, PaddedSpinner } from '../components/ui.tsx'
7import { Header } from '../util/misc.tsx'
8import { fetchMiniApp } from '../util/neynar.ts'
9
10export function MiniAppScreen() {
60function useMiniAppFromParams() {
61 const { url } = useParams()
62 return useQuery({ queryKey: ['mini-app', url], queryFn: () => fetchMiniApp(url), staleTime: 1000 * 60 * 5 })
63}
64
Gemini-2-5-Pro-O-02

Gemini-2-5-Pro-O-02main.tsx3 matches

@aibotcommander•Updated 31 mins ago
262async function imageToBase64(imageUrl: string): Promise<{ data: string; mimeType: string }> {
263 try {
264 const response = await fetch(imageUrl, { timeout: 8000 });
265 if (!response.ok) {
266 throw new Error(`Failed to fetch image: ${response.status}`);
267 }
268 const arrayBuffer = await response.arrayBuffer();
309
310 const url = `${config.endpoint}?key=${process.env.GEMINI_API_KEY}`;
311 const response = await fetch(url, {
312 method: "POST",
313 headers: config.headers,

flowxo-http-bot-samplebot.ts2 matches

@flowxo•Updated 36 mins ago
65 };
66 console.log("MESSAGES", messages);
67 return fetch(BOT_URL, options).catch((ex) => {
68 return c.json({ ok: false, ex: ex.message });
69 }).then((res) => {
76});
77
78export default app.fetch;

webgpu_2main.tsx1 match

@saolsen•Updated 36 mins ago
11
12async function main() {
13 const grid_shader = await (await fetch(`${module_path}/grid.wgsl`)).text();
14
15 const adapter = await navigator.gpu?.requestAdapter();

SonarMiniAppsScreen.tsx2 matches

@moe•Updated 40 mins ago
5import { PaddedError, PaddedSpinner, Section, Button } from '../components/ui.tsx'
6import { TitleHeader, useFarcasterMiniApp } from '../util/misc.tsx'
7import { fetchTrendingMiniApps } from '../util/neynar.ts'
8import { Feed } from '../components/Post.tsx'
9
26 <Feed
27 queryKey={['trending-mini-apps']}
28 queryFn={({ pageParam }) => fetchTrendingMiniApps(pageParam)}
29 renderItem={(item) => <MiniApp miniapp={item} />}
30 containerClass="grid grid-cols-2 gap-4 p-4"

SonarSearchScreen.tsx1 match

@moe•Updated 43 mins ago
5
6import { Button, Input, PaddedError, Section } from '../components/ui.tsx'
7import { fetchStarterPack, TitleHeader } from '../util/misc.tsx'
8
9export function SearchScreen() {

zoomtestmain.js9 matches

@yawnxyz•Updated 57 mins ago
69 const credentials = btoa(`${ZOOM_CLIENT_ID}:${ZOOM_CLIENT_SECRET}`);
70
71 const response = await fetch(tokenUrl, {
72 method: "POST",
73 headers: {
93 const credentials = btoa(`${ZOOM_CLIENT_ID}:${ZOOM_CLIENT_SECRET}`);
94
95 const response = await fetch(tokenUrl, {
96 method: "POST",
97 headers: {
1030 oauthStatusBtn.addEventListener('click', async () => {
1031 try {
1032 const response = await fetch('/oauth/status');
1033 const status = await response.json();
1034
1071 rtmsStatusBtn.addEventListener('click', async () => {
1072 try {
1073 const response = await fetch('/oauth/status'); // Reuse OAuth status for now
1074 const status = await response.json();
1075
1122 };
1123
1124 const response = await fetch('/webhook', {
1125 method: 'POST',
1126 headers: {
1190
1191 try {
1192 const response = await fetch('/boink', {
1193 method: 'POST',
1194 headers: {
1247 ];
1248
1249 const response = await fetch(pipeline_url, {
1250 method: "POST",
1251 headers: {
1319
1320 try {
1321 const response = await fetch('https://openrouter.ai/api/v1/chat/completions', {
1322 method: 'POST',
1323 headers: {
1659app.route('/analysis', analysisApp);
1660
1661export default (typeof Deno !== "undefined" && Deno.env.get("valtown")) ? app.fetch : app;
1662

Sonarneynar.ts32 matches

@moe•Updated 1 hour ago
2// const baseUrl = "https://api.neynar.com/v2/farcaster/";
3
4export async function fetchNeynarGet(path: string) {
5 const res = await fetch(baseUrl + encodeURIComponent(path), {
6 method: 'GET',
7 headers: {
15}
16
17export async function fetchNeynarGetPages(path: string, pages: number, dataKey: string) {
18 let data: any = []
19 let cursor = ''
20 let pagesLeft = pages
21 while (true) {
22 const res = await fetchNeynarGet(`${path}&cursor=${cursor}`)
23 data = [...data, ...res[dataKey]]
24 cursor = res?.next?.cursor
35//////////
36
37export function fetchUser(username: string) {
38 if (username.startsWith('fid:')) {
39 return fetchUsersById(username.replace('fid:', '')).then((users) => users[0])
40 }
41 return fetchNeynarGet(`user/by_username?username=${username}`).then((r) => r.user)
42}
43export function fetchUsersById(fids: string) {
44 return fetchNeynarGet(`user/bulk?fids=${fids}`).then((r) => r.users)
45}
46
47export function fetchUserFeed(fid: string, cursor: string = '') {
48 return fetchNeynarGet(
49 `feed?feed_type=filter&filter_type=fids&fids=${fid}&with_recasts=false&with_replies=false&limit=100&cursor=${cursor}`
50 ).then(defaultCastFeedTransform)
51}
52
53export function fetchChannel(channelId: string) {
54 return fetchNeynarGet(`channel?id=${channelId}`).then((r) => r.channel)
55}
56
57export function fetchChannelFeed(channelId: string, cursor: string = '') {
58 return fetchNeynarGet(`feed/channels?channel_ids=${channelId}&with_recasts=false&limit=100&cursor=${cursor}`).then(
59 defaultCastFeedTransform
60 )
61}
62
63export function fetchChannelsFeed(channelIds: string[], cursor: string = '') {
64 return fetchNeynarGet(
65 `feed/channels?channel_ids=${channelIds.join(',')}&with_recasts=false&limit=100&cursor=${cursor}`
66 ).then(defaultCastFeedTransform)
67}
68
69export function fetchExploreFeed(cursor: string = '') {
70 // return fetchNeynarGet(`feed/trending?time_window=24h&limit=10`).then(defaultCastFeedTransform)
71 return fetchNeynarGet(`feed?feed_type=filter&filter_type=global_trending&limit=100&cursor=${cursor}`).then(
72 defaultCastFeedTransform
73 )
74}
75
76export function fetchUsersFeed(fids: string, cursor: string = '') {
77 const url = `feed?feed_type=filter&filter_type=fids&fids=${fids}&limit=100&cursor=${cursor}`
78 return fetchNeynarGet(url).then(defaultCastFeedTransform)
79}
80
81export function fetchCast(hash: string) {
82 return fetchNeynarGet(`cast?type=hash&identifier=${hash}`).then((r) => r.cast)
83}
84
85export function fetchCastReplies(hash: string, cursor: string = '') {
86 return fetchNeynarGet(
87 `cast/conversation?identifier=${hash}&type=hash&reply_depth=2&include_chronological_parent_casts=false&sort_type=algorithmic&fold=above&limit=20&cursor=${cursor}`
88 ).then((r) => ({
92}
93
94export function fetchTrendingChannels() {
95 return fetchNeynarGet(`channel/trending?time_window=30d&limit=24`).then((r) => r.channels?.map((c) => c.channel))
96}
97
98export function fetchTrendingMiniApps(cursor: string = '') {
99 return fetchNeynarGet(`frame/catalog?limit=100&cursor=${cursor}`).then((r) => ({
100 items: r.frames || [],
101 nextPageParam: r?.next?.cursor || null,
103}
104
105export function fetchMiniApp(url: string) {
106 return fetchNeynarGet(`cast/embed/crawl/?url=${url}`).then((r) => r.metadata)
107}
108
bible

bible2 file matches

@cameronpak•Updated 4 hours ago
fetch(bible) - one-liner Bible reader

FetchBasic2 file matches

@bengold•Updated 2 weeks ago