SDKs
Official client libraries for TypeScript, Python, and Go. Available for both the REST API and the Realtime WebSocket API.
REST SDKs
The REST SDKs wrap the NewsRank HTTP API with typed methods, automatic pagination, and built-in retries. Install the package for your language and start fetching articles, stories, entities, and more.
Install
npm install @newsrank/sdkQuick Start
Fetch the 5 most recent stories with a single method call:
import { NewsRank } from '@newsrank/sdk';
const nr = new NewsRank('nrf_your_api_key');
const stories = await nr.stories.list({ limit: 5 });
console.log(stories);npm
@newsrank/sdk
PyPI
newsrank
Go Module
github.com/newsrank-ai/newsrank-go
Realtime SDKs
NewThe Realtime SDKs connect to the NewsRank WebSocket API and provide typed event handlers, automatic reconnection with exponential backoff, and subscription management. Receive new articles, story developments, and ranking changes the moment they happen.
Install
npm install @newsrank/realtimeQuick Start
Connect to the WebSocket, subscribe to politics articles, and log new items:
import { NewsRankRealtime } from '@newsrank/realtime';
const rt = new NewsRankRealtime('nrf_your_api_key');
await rt.connect();
rt.subscribe({ categories: ['politics'], topics: ['articles'] });
rt.on('item.new', (e) => console.log(e.data.title));npm
@newsrank/realtime
PyPI
newsrank-realtime
Go Module
github.com/newsrank-ai/newsrank-go/realtime
SDK Features
All three language SDKs share the same feature set across both REST and Realtime packages.
| Feature | TypeScript | Python | Go |
|---|---|---|---|
| Typed responses | ✓ | ✓ | ✓ |
| Auto-pagination | ✓ | ✓ | ✓ |
| Automatic retries | ✓ | ✓ | ✓ |
| Auto-reconnect (Realtime) | ✓ | ✓ | ✓ |
| Typed events (Realtime) | ✓ | ✓ | ✓ |
| Subscription filters | ✓ | ✓ | ✓ |
| Exponential backoff | ✓ | ✓ | ✓ |
| Connection health monitoring | ✓ | ✓ | ✓ |