flowxo-http-bot-samplescript.js6 matches
34},
35};
36return fetch("/in", opts).then(() => payload);
37}
386061function resetMessages() {
62return fetch("/reset");
63}
6465function getMessages() {
66return fetch("/messages")
67.then((response) => response.json())
68.then((data) => data.messages);
74}
7576// fetch the initial list of messages
77fetch("/messages")
78.then((response) => response.json()) // parse the JSON from the server
79.then((data) => {
84data.messages.forEach(appendNewMessage);
8586//set a timer to continuously fetch new messages
87setInterval(() => getMessages().then(displayMessages), 1000);
88
Gemini-2-5-Pro-O-01main.tsx3 matches
262async function imageToBase64(imageUrl: string): Promise<{ data: string; mimeType: string }> {
263try {
264const response = await fetch(imageUrl, { timeout: 8000 });
265if (!response.ok) {
266throw new Error(`Failed to fetch image: ${response.status}`);
267}
268const arrayBuffer = await response.arrayBuffer();
309310const url = `${config.endpoint}?key=${process.env.GEMINI_API_KEY}`;
311const response = await fetch(url, {
312method: "POST",
313headers: config.headers,
SonarMiniAppScreen.tsx2 matches
6import { Debug, NavOutlet, PaddedError, PaddedSpinner } from '../components/ui.tsx'
7import { Header } from '../util/misc.tsx'
8import { fetchMiniApp } from '../util/neynar.ts'
910export function MiniAppScreen() {
60function useMiniAppFromParams() {
61const { url } = useParams()
62return useQuery({ queryKey: ['mini-app', url], queryFn: () => fetchMiniApp(url), staleTime: 1000 * 60 * 5 })
63}
64
Gemini-2-5-Pro-O-02main.tsx3 matches
262async function imageToBase64(imageUrl: string): Promise<{ data: string; mimeType: string }> {
263try {
264const response = await fetch(imageUrl, { timeout: 8000 });
265if (!response.ok) {
266throw new Error(`Failed to fetch image: ${response.status}`);
267}
268const arrayBuffer = await response.arrayBuffer();
309310const url = `${config.endpoint}?key=${process.env.GEMINI_API_KEY}`;
311const response = await fetch(url, {
312method: "POST",
313headers: config.headers,
flowxo-http-bot-samplebot.ts2 matches
65};
66console.log("MESSAGES", messages);
67return fetch(BOT_URL, options).catch((ex) => {
68return c.json({ ok: false, ex: ex.message });
69}).then((res) => {
76});
7778export default app.fetch;
1112async function main() {
13const grid_shader = await (await fetch(`${module_path}/grid.wgsl`)).text();
1415const adapter = await navigator.gpu?.requestAdapter();
SonarMiniAppsScreen.tsx2 matches
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'
926<Feed
27queryKey={['trending-mini-apps']}
28queryFn={({ pageParam }) => fetchTrendingMiniApps(pageParam)}
29renderItem={(item) => <MiniApp miniapp={item} />}
30containerClass="grid grid-cols-2 gap-4 p-4"
SonarSearchScreen.tsx1 match
56import { Button, Input, PaddedError, Section } from '../components/ui.tsx'
7import { fetchStarterPack, TitleHeader } from '../util/misc.tsx'
89export function SearchScreen() {
69const credentials = btoa(`${ZOOM_CLIENT_ID}:${ZOOM_CLIENT_SECRET}`);
7071const response = await fetch(tokenUrl, {
72method: "POST",
73headers: {
93const credentials = btoa(`${ZOOM_CLIENT_ID}:${ZOOM_CLIENT_SECRET}`);
9495const response = await fetch(tokenUrl, {
96method: "POST",
97headers: {
1030oauthStatusBtn.addEventListener('click', async () => {
1031try {
1032const response = await fetch('/oauth/status');
1033const status = await response.json();
10341071rtmsStatusBtn.addEventListener('click', async () => {
1072try {
1073const response = await fetch('/oauth/status'); // Reuse OAuth status for now
1074const status = await response.json();
10751122};
11231124const response = await fetch('/webhook', {
1125method: 'POST',
1126headers: {
11901191try {
1192const response = await fetch('/boink', {
1193method: 'POST',
1194headers: {
1247];
12481249const response = await fetch(pipeline_url, {
1250method: "POST",
1251headers: {
13191320try {
1321const response = await fetch('https://openrouter.ai/api/v1/chat/completions', {
1322method: 'POST',
1323headers: {
1659app.route('/analysis', analysisApp);
16601661export default (typeof Deno !== "undefined" && Deno.env.get("valtown")) ? app.fetch : app;
1662
2// const baseUrl = "https://api.neynar.com/v2/farcaster/";
34export async function fetchNeynarGet(path: string) {
5const res = await fetch(baseUrl + encodeURIComponent(path), {
6method: 'GET',
7headers: {
15}
1617export async function fetchNeynarGetPages(path: string, pages: number, dataKey: string) {
18let data: any = []
19let cursor = ''
20let pagesLeft = pages
21while (true) {
22const res = await fetchNeynarGet(`${path}&cursor=${cursor}`)
23data = [...data, ...res[dataKey]]
24cursor = res?.next?.cursor
35//////////
3637export function fetchUser(username: string) {
38if (username.startsWith('fid:')) {
39return fetchUsersById(username.replace('fid:', '')).then((users) => users[0])
40}
41return fetchNeynarGet(`user/by_username?username=${username}`).then((r) => r.user)
42}
43export function fetchUsersById(fids: string) {
44return fetchNeynarGet(`user/bulk?fids=${fids}`).then((r) => r.users)
45}
4647export function fetchUserFeed(fid: string, cursor: string = '') {
48return 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}
5253export function fetchChannel(channelId: string) {
54return fetchNeynarGet(`channel?id=${channelId}`).then((r) => r.channel)
55}
5657export function fetchChannelFeed(channelId: string, cursor: string = '') {
58return fetchNeynarGet(`feed/channels?channel_ids=${channelId}&with_recasts=false&limit=100&cursor=${cursor}`).then(
59defaultCastFeedTransform
60)
61}
6263export function fetchChannelsFeed(channelIds: string[], cursor: string = '') {
64return fetchNeynarGet(
65`feed/channels?channel_ids=${channelIds.join(',')}&with_recasts=false&limit=100&cursor=${cursor}`
66).then(defaultCastFeedTransform)
67}
6869export function fetchExploreFeed(cursor: string = '') {
70// return fetchNeynarGet(`feed/trending?time_window=24h&limit=10`).then(defaultCastFeedTransform)
71return fetchNeynarGet(`feed?feed_type=filter&filter_type=global_trending&limit=100&cursor=${cursor}`).then(
72defaultCastFeedTransform
73)
74}
7576export function fetchUsersFeed(fids: string, cursor: string = '') {
77const url = `feed?feed_type=filter&filter_type=fids&fids=${fids}&limit=100&cursor=${cursor}`
78return fetchNeynarGet(url).then(defaultCastFeedTransform)
79}
8081export function fetchCast(hash: string) {
82return fetchNeynarGet(`cast?type=hash&identifier=${hash}`).then((r) => r.cast)
83}
8485export function fetchCastReplies(hash: string, cursor: string = '') {
86return 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}
9394export function fetchTrendingChannels() {
95return fetchNeynarGet(`channel/trending?time_window=30d&limit=24`).then((r) => r.channels?.map((c) => c.channel))
96}
9798export function fetchTrendingMiniApps(cursor: string = '') {
99return fetchNeynarGet(`frame/catalog?limit=100&cursor=${cursor}`).then((r) => ({
100items: r.frames || [],
101nextPageParam: r?.next?.cursor || null,
103}
104105export function fetchMiniApp(url: string) {
106return fetchNeynarGet(`cast/embed/crawl/?url=${url}`).then((r) => r.metadata)
107}
108