import {AppBskyFeedDefs, BskyAgent} from '@atproto/api' import {FeedAPI, FeedAPIResponse} from './types' export class FollowingFeedAPI implements FeedAPI { getAgent: () => BskyAgent constructor({getAgent}: {getAgent: () => BskyAgent}) { this.getAgent = getAgent } async peekLatest(): Promise { const res = await this.getAgent().getTimeline({ limit: 1, }) return res.data.feed[0] } async fetch({ cursor, limit, }: { cursor: string | undefined limit: number }): Promise { const res = await this.getAgent().getTimeline({ cursor, limit, }) if (res.success) { return { cursor: res.data.cursor, feed: res.data.feed, } } return { feed: [], } } }