Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
feat: allow casting with embeds and parent
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-grover committed Sep 26, 2023
1 parent ef64982 commit f5aadda
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This repo is a work in progress, use at your own risk! Currently, the following
- [x] Sign in
- [x] Get user profile by FID
- [x] Fetch feed by following/channel/FID list
- [x] Post casts (currently limited to text without embeds or channels)
- [x] Post casts
- [x] Cast reactions (like/unlike/recast/unrecast)
- [ ] Search users
- [ ] Follow/unfollow
Expand Down Expand Up @@ -355,7 +355,11 @@ export async function POST(request: Request) {

const data = Object.fromEntries((await request.formData()).entries())
if (!data.text) const { signerUuid, text } = parseResult.data
await neynarClient.postCast(signerUuid, text)
await neynarClient.postCast(
signerUuid,
text,
// { embeds: [{ url: '' }], parent: '' }
)

return NextResponse.json({}, { status: 201 })
}
Expand Down
7 changes: 3 additions & 4 deletions src/server/NeynarClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,17 @@ export default class NeynarClient {
return this.get<FeedResponse>('feed', params)
}

// TODO: validate format of extra parameters
postCast(
signerUuid: string,
text: string,
// extra?: { embeds?: { url: string }[]; parent?: string },
extra?: { embeds?: { url: string }[]; parent?: string },
) {
const params: Json = {
signer_uuid: signerUuid,
text,
}
// if (extra?.embeds) params.embeds = extra.embeds
// if (extra?.parent) params.parent = extra.parent
if (extra?.embeds) params.embeds = extra.embeds
if (extra?.parent) params.parent = extra.parent
return this.post('cast', params)
}

Expand Down

0 comments on commit f5aadda

Please sign in to comment.