diff --git a/src/server/NeynarClient.ts b/src/server/NeynarClient.ts index b786f94..7c99f5e 100644 --- a/src/server/NeynarClient.ts +++ b/src/server/NeynarClient.ts @@ -2,6 +2,7 @@ import { Hash } from 'viem' import { mnemonicToAccount } from 'viem/accounts' import { Cast, + CastWithViewerContext, GeneratedSigner, PendingSigner, Signer, @@ -130,6 +131,22 @@ export default class NeynarClient { return this.get<{ cast: Cast }>('cast', params) } + getCastsInThread( + threadHash: string, + viewer?: null, + ): Promise<{ result: { casts: Cast[] } }> + getCastsInThread( + threadHash: string, + viewer: number, + ): Promise<{ result: { casts: CastWithViewerContext[] } }> + getCastsInThread(threadHash: string, viewer?: number | null) { + const params = new URLSearchParams({ threadHash }) + if (viewer) params.set('viewerFid', viewer.toString()) + return this.get<{ + result: { casts: Cast[] | CastWithViewerContext[] } + }>('all-casts-in-thread', params, 1) + } + postCast( signerUuid: string, text: string, diff --git a/src/server/types/Cast.ts b/src/server/types/Cast.ts index ff8888c..64586d5 100644 --- a/src/server/types/Cast.ts +++ b/src/server/types/Cast.ts @@ -35,6 +35,13 @@ export type Cast = { } } +export type CastWithViewerContext = Cast & { + viewerContext: { + liked: boolean + recasted: boolean + } +} + type Embed = { url: string }