TypeScript SDK for API

Nate Agrin · Friday Demos · May 9, 2025 · 3:24

Another mini app example, this time a Typescript SDK on top of the Omni API.

Transcript

This transcript is auto-generated. Names and product terms may be wrong.

  1. I have two quick demos. Uh, okay. So, I've I've also been vibe coding on the side a little bit. Um, last week I merged a change for uh an embed bug that created another embed bug that was basically harmless, but it was duplicating some embed users. And so this week I I had to go back through uh any customer that was affected and clean them out.

  2. And cleaning them out manually is exhausting. So I I started using the API. Um and then to sort of speed up the API uh interactions. I I just prototyped out a really quick like little TypeScript SDK around it. Um, I did it using cursor and so I was like actually pretty surprised at how accurate uh and how well it structured this SDK based on my instructions.

  3. Um, so you can see like it pulls it pulled in a little library that does some like HP negotiations and then uh created this concept of a client which was cool. And then um you know like I pointed it to the docs for the users uh APIs and it just basically trivially scaffolded out these nice little API calls.

  4. And so what this ends up looking like is sort of ignore this stuff up here, but down here you just basically instantiate an instance of your client with your API URL. So this would be your Omnihost name and then like a an API key and then uh instantiate whatever part of the SDK you want to use like whether it's users or content or whatever and then you can do these sort of more expressive operations like list out users you know iterate over the user list received and print them out and so what that looks like in practice is sort of like this um you know so like up here where I ran it says like found 10 users and then enumerates them.

  5. So this is for me at least being a programmer much easier to to work at this fire level than to have to manipulate all the HTTP requests directly or try to write a bunch of like bash scripts and curl. Um I've actually already published this. I haven't published it publicly but it's in our GitHub repo. Um, and I'm definitely planning on continuing to iterate on it, uh, since it was super useful and helpful to me.

  6. And one thing I wanted to just highlight here is in this age of AI, how important our docs are. So, kudos to all the folks building the docs. Kudos to Corey for keeping the docs up to date. Um, literally all I do to to the sort of like vibe code in this, you know, method is grab a URL to like this page and tell the AI like, hey, go read the dots here and then build, you know, whatever I'm thinking about based on these dots.

  7. And it pretty much gets it correct on the first try. So, that's pretty fun.