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:
Paul Frazee 2023-11-29 10:10:04 -08:00 committed by GitHub
parent 9fb2c29c67
commit 6fe2b52f68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 70 additions and 103 deletions

View file

@ -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,