I’ve thought about making a JS library for SN API. Maybe something we could publish as part of the SN repo
Why as part of the SN repo? We could publish it under the SN organization if we want to officially support it.
I already created a veeery basic one for Golang here (iirc, before my time at SN). This is what @hn and @unpaywall use.
A friend of mine (@shurikencutter) wanted to create one for Python.
Also, for proper support of client libraries, we need to make authentication easier to deal with imo.
Currently, for @hn and @unpaywall, I just login in browser and then copy and paste the cookies into an .env file.
However, the session times out after a while so it's not ideal. (I thought hitting /api/auth/session regularly would be enough to keep the session alive but doesn't seem so)
Maybe we could add support for API keys and then we could even mark anything which was posted using an API key as a bot ? :)
reply
I haven’t given it that much thought, so take it with a grain of salt. Definitely wouldn’t need to be part of the repo. I just thought that if the API evolves in the SN app, having a library as part of the same repo would help keep it in sync. Like a monorepo where one package is published as a lib to npm
I was thinking things like type declarations for resources, etc
reply
21 sats \ 1 reply \ @ek 9 Sep 2023
Ah, I see! Could also be a "reference implementation"
reply
Yes, exactly!
reply
You sneak in a lot of content in edits that I miss! I definitely think API keys would be a good enhancement, but probably not necessary up front.
reply
I know, it's a disease 🙈 lol
reply
I'm like this too, it's so strange how different a text is while it is editable, versus when it is "set in stone". I hear many writers / editors say this too, they will often write on a computer, but then print out the text and read it on paper, in order to improve it!
I wonder why our brains work like that. Something to do with "you can't make bets with money you don't have" I think. Easy to approve of a text while you can directly control it.
reply
I just need to wait to reply to you til 10 minutes is up lol
reply