-
-
Notifications
You must be signed in to change notification settings - Fork 823
Adds summarize action to the public API (proxy to TRPC mutation) #1088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
export const POST = (req: NextRequest) => | ||
buildHandler({ | ||
req, | ||
searchParamsSchema: z.object({ bookmarkId: z.string() }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put this in a query param for now testing, but let me know if it'd be more idiomatic for this code base to use a routeParam (e.g. /api/v1/bookmarks/summary/:bookmark-id), a queryParam, or a structured POST body like: { bookmarkId: foo-id }
. Let me know what you prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'll be more idiomatic if we do it as
POST /bookmarks/[bookmarkId]/summarize
to do that, you can move this file to
apps/web/app/api/v1/bookmarks/[bookmarkId]/summarize/route.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want a GET then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No POST is still the right verb here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack
package.json
Outdated
@@ -32,10 +32,5 @@ | |||
"turbo": "^2.1.2" | |||
}, | |||
"prettier": "@hoarder/prettier-config", | |||
"packageManager": "pnpm@9.0.0-alpha.8+sha256.a433a59569b00389a951352956faf25d1fdf43b568213fbde591c36274d4bc30", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove all of these once the question above is resolved. I just need this for now to keep working :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, thanks for opening the PR. Left a small comment about the endpoint!
export const POST = (req: NextRequest) => | ||
buildHandler({ | ||
req, | ||
searchParamsSchema: z.object({ bookmarkId: z.string() }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'll be more idiomatic if we do it as
POST /bookmarks/[bookmarkId]/summarize
to do that, you can move this file to
apps/web/app/api/v1/bookmarks/[bookmarkId]/summarize/route.ts
Switched to a |
c9fcd1d
to
c6eb789
Compare
Looks green. I'll test locally. Is there somewhere I need to add for docs or are those all autogenerated? |
@erik-nilcoast Oh good catch, we need to update the docs here: https://github.com/hoarder-app/hoarder/blob/main/packages/open-api/lib/bookmarks.ts and then call Also, can we call the endpoint |
Will do. I’ll see if I can actually get the build running locally. It didn’t work well with my setup. Probably a me problem.
…On Sat, Mar 8, 2025, at 9:36 AM, Mohamed Bassem wrote:
@erik-nilcoast <https://github.com/erik-nilcoast> Oh good catch, we need to update the docs here: https://github.com/hoarder-app/hoarder/blob/main/packages/open-api/lib/bookmarks.ts
and then call `pnpm run generate` inside `packages/open-api` to generate the openAPI files.
Also, can we call the endpoint `summarize` instead of `summary`? I feel like here you're not posting a summary but instead triggering a summarize action.
—
Reply to this email directly, view it on GitHub <#1088 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/BA5MB3OEFQTGJKQPE7FZ7LD2TME7VAVCNFSM6AAAAABYFYU6X2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMBYGM2TOMZQGQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
MohamedBassem*MohamedBassem* left a comment (karakeep-app/karakeep#1088) <#1088 (comment)>
@erik-nilcoast <https://github.com/erik-nilcoast> Oh good catch, we need to update the docs here: https://github.com/hoarder-app/hoarder/blob/main/packages/open-api/lib/bookmarks.ts
and then call `pnpm run generate` inside `packages/open-api` to generate the openAPI files.
Also, can we call the endpoint `summarize` instead of `summary`? I feel like here you're not posting a summary but instead triggering a summarize action.
—
Reply to this email directly, view it on GitHub <#1088 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/BA5MB3OEFQTGJKQPE7FZ7LD2TME7VAVCNFSM6AAAAABYFYU6X2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMBYGM2TOMZQGQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Build works great on a mac. ¯_(ツ)_/¯ @MohamedBassem docs are updated and I moved the route to |
Proxy to the TRPC Summarize mutation for use in the public API
I think this is likely good to go. Let me know if there's anything else I can do to get this on the release schedule (I'd love to get off my fork). I may need to add some additional API endpoints in the near future. I'm looking at deploying Hoarder for a client, but would love to give back where I can. RSS of bookmark collections and email newsletter hoarding are things I'm looking to add. |
Thanks a lot @erik-nilcoast (hope your client enjoys hoarder!). If you're planning to be active in the development, you might want to join us in the #development channel on discord :) Also I'd highly recommend before working on a new feature to make sure we have an issue for it with the |
@MohamedBassem Will do, I'll join y'all. |
I added this in two commits. One is just for me. I had a few issues getting this running locally on a Linux box. It could just be a me problem :|
The second commit has the addition of a subroute for the summary mutation. It should return the bookmark object with the summarized contents. Please feel free to add or remove any commits and I'll do my best to address any feedback.
Thanks for a fantastic project.
Addresses: #523