Something went wrong. Try again.
Bluesky app fork with some witchin' additions 💫 forked from jollywhoppers.com/witchsky.app
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455import { type Agent, type AppBskyFeedDefs, type AppBskyFeedGetListFeed as GetListFeed,} from '@atproto/api'
import {type FeedAPI, type FeedAPIResponse} from './types'
export class ListFeedAPI implements FeedAPI { agent: Agent params: GetListFeed.QueryParams
constructor({ agent, feedParams, }: { agent: Agent feedParams: GetListFeed.QueryParams }) { this.agent = agent this.params = feedParams }
async peekLatest(): Promise<AppBskyFeedDefs.FeedViewPost> { const res = await this.agent.app.bsky.feed.getListFeed({ ...this.params, limit: 1, }) return res.data.feed[0] }
async fetch({ cursor, limit, }: { cursor: string | undefined limit: number }): Promise<FeedAPIResponse> { const res = await this.agent.app.bsky.feed.getListFeed({ ...this.params, cursor, limit, }) if (res.success) { return { cursor: res.data.cursor, feed: res.data.feed, } } return { feed: [], } }}