feat: add JavaScript Socialhose API SDK

This commit is contained in:
Mo Elzubeir
2026-05-29 12:46:42 -05:00
commit e34552ac33
12 changed files with 2560 additions and 0 deletions
+60
View File
@@ -0,0 +1,60 @@
# Socialhose SDKs
Official SDKs for the Socialhose Public API.
## SDKs
- `sdks/javascript` — npm package `@socialhose/api`
Future SDKs can live beside it, e.g. `sdks/python`, `sdks/go`, or `sdks/php`.
## JavaScript / TypeScript
```bash
npm install @socialhose/api
```
```ts
import { SocialhoseClient } from '@socialhose/api';
const socialhose = new SocialhoseClient({
apiKey: process.env.SOCIALHOSE_API_KEY!,
});
const mentions = await socialhose.getMentions({
content_search: 'hospital',
ordering: '-published_at',
});
console.log(mentions.count);
```
## Development
Use pnpm 9.x.
```bash
pnpm install
pnpm test
pnpm typecheck
pnpm build
```
On machines where Corepack's pnpm shim is broken, use:
```bash
npx --yes pnpm@9.15.0 install
npx --yes pnpm@9.15.0 test
```
## Publishing JavaScript SDK
```bash
cd sdks/javascript
pnpm test
pnpm typecheck
pnpm build
npm publish --access public --provenance
```
Do not publish `1.0.0` until the API endpoint inventory is complete and at least two real consumers have migrated.