Get more rigorous about getAgent() consistency (#2026)
* Get more rigorous about getAgent() consistency * Update the feed wrapper API to use getAgent() directly
This commit is contained in:
parent
9fb2c29c67
commit
6fe2b52f68
12 changed files with 70 additions and 103 deletions
|
@ -1,18 +1,15 @@
|
|||
import {
|
||||
AppBskyFeedDefs,
|
||||
AppBskyFeedGetAuthorFeed as GetAuthorFeed,
|
||||
BskyAgent,
|
||||
} from '@atproto/api'
|
||||
import {FeedAPI, FeedAPIResponse} from './types'
|
||||
import {getAgent} from '#/state/session'
|
||||
|
||||
export class AuthorFeedAPI implements FeedAPI {
|
||||
constructor(
|
||||
public agent: BskyAgent,
|
||||
public params: GetAuthorFeed.QueryParams,
|
||||
) {}
|
||||
constructor(public params: GetAuthorFeed.QueryParams) {}
|
||||
|
||||
async peekLatest(): Promise<AppBskyFeedDefs.FeedViewPost> {
|
||||
const res = await this.agent.getAuthorFeed({
|
||||
const res = await getAgent().getAuthorFeed({
|
||||
...this.params,
|
||||
limit: 1,
|
||||
})
|
||||
|
@ -26,7 +23,7 @@ export class AuthorFeedAPI implements FeedAPI {
|
|||
cursor: string | undefined
|
||||
limit: number
|
||||
}): Promise<FeedAPIResponse> {
|
||||
const res = await this.agent.getAuthorFeed({
|
||||
const res = await getAgent().getAuthorFeed({
|
||||
...this.params,
|
||||
cursor,
|
||||
limit,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue