Something went wrong. Try again.
Mirror — see github.com/blacksky-algorithms/blacksky.community
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041import {type AppBskyFeedDefs, type AtpAgent} from '@atproto/api'
import {type FeedAPI, type FeedAPIResponse} from './types'
export class FollowingFeedAPI implements FeedAPI { agent: AtpAgent
constructor({agent}: {agent: AtpAgent}) { this.agent = agent }
async peekLatest(): Promise<AppBskyFeedDefs.FeedViewPost> { const res = await this.agent.getTimeline({ limit: 1, }) return res.data.feed[0] }
async fetch({ cursor, limit, }: { cursor: string | undefined limit: number }): Promise<FeedAPIResponse> { const res = await this.agent.getTimeline({ cursor, limit, }) if (res.success) { return { cursor: res.data.cursor, feed: res.data.feed, } } return { feed: [], } }}