61 lines
1.0 KiB
Markdown
61 lines
1.0 KiB
Markdown
# 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.
|