Activity notification settings (#8485)

Co-authored-by: Eric Bailey <git@esb.lol>
Co-authored-by: Samuel Newman <mozzius@protonmail.com>
Co-authored-by: hailey <me@haileyok.com>
This commit is contained in:
Samuel Newman
2025-07-02 00:36:04 +03:00
committed by GitHub
parent 8f9a8ddce0
commit bc072570d2
53 changed files with 1810 additions and 288 deletions
+6 -6
View File
@@ -1,20 +1,20 @@
import {
AppBskyFeedDefs,
AppBskyFeedGetListFeed as GetListFeed,
BskyAgent,
type Agent,
type AppBskyFeedDefs,
type AppBskyFeedGetListFeed as GetListFeed,
} from '@atproto/api'
import {FeedAPI, FeedAPIResponse} from './types'
import {type FeedAPI, type FeedAPIResponse} from './types'
export class ListFeedAPI implements FeedAPI {
agent: BskyAgent
agent: Agent
params: GetListFeed.QueryParams
constructor({
agent,
feedParams,
}: {
agent: BskyAgent
agent: Agent
feedParams: GetListFeed.QueryParams
}) {
this.agent = agent
+52
View File
@@ -0,0 +1,52 @@
import {
type Agent,
type AppBskyFeedDefs,
type AppBskyFeedGetPosts,
} from '@atproto/api'
import {logger} from '#/logger'
import {type FeedAPI, type FeedAPIResponse} from './types'
export class PostListFeedAPI implements FeedAPI {
agent: Agent
params: AppBskyFeedGetPosts.QueryParams
peek: AppBskyFeedDefs.FeedViewPost | null = null
constructor({
agent,
feedParams,
}: {
agent: Agent
feedParams: AppBskyFeedGetPosts.QueryParams
}) {
this.agent = agent
if (feedParams.uris.length > 25) {
logger.warn(
`Too many URIs provided - expected 25, got ${feedParams.uris.length}`,
)
}
this.params = {
uris: feedParams.uris.slice(0, 25),
}
}
async peekLatest(): Promise<AppBskyFeedDefs.FeedViewPost> {
if (this.peek) return this.peek
throw new Error('Has not fetched yet')
}
async fetch({}: {}): Promise<FeedAPIResponse> {
const res = await this.agent.app.bsky.feed.getPosts({
...this.params,
})
if (res.success) {
this.peek = {post: res.data.posts[0]}
return {
feed: res.data.posts.map(post => ({post})),
}
}
return {
feed: [],
}
}
}