No matches found in users.
Try switching to another result type using the tabs above.
You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/?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 15666 results for "fetch"(4501ms)
No matches found in users.
Try switching to another result type using the tabs above.
100}
101102return fetch(requestParams.url, preload).catch((err) => new Response(err.stack, { status: 500 }));
103});
104112// app.post("/v1/chat/completions", handleChatCompletionWrap);
113114export default app.fetch;
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) {
48return fetchNeynarGet(
49`feed?feed_type=filter&filter_type=fids&fids=${fid}&with_recasts=false&with_replies=false&limit=100&cursor=`
50).then((r) => r.casts)
51}
5253export function fetchChannel(channelId: string) {
54return fetchNeynarGet(`channel?id=${channelId}`).then((r) => r.channel)
55}
5657export function fetchChannelFeed(channelId: string) {
58return fetchNeynarGet(`feed/channels?channel_ids=${channelId}&with_recasts=false&limit=100`).then((r) => r.casts)
59}
6061export function fetchChannelsFeed(channelIds: string[]) {
62return fetchNeynarGet(`feed/channels?channel_ids=${channelIds.join(',')}&with_recasts=false&limit=100`).then(
63(r) => r.casts
64)
65}
6667export function fetchCast(hash: string) {
68return fetchNeynarGet(`cast?type=hash&identifier=${hash}`).then((r) => r.cast)
69}
7071export function fetchCastReplies(hash: string) {
72return fetchNeynarGet(
73`cast/conversation?identifier=${hash}&type=hash&reply_depth=2&include_chronological_parent_casts=false&sort_type=algorithmic&fold=above&limit=20`
74).then((r) => r?.conversation?.cast?.direct_replies)