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