refract-rs
v0.0.3
Published
Typed NodeJS HTTP wrapper for the Oldschool Runescape Wiki's Real-time Prices API
Readme
refract-rs
Typed Node.js client for the OSRS Wiki Real-time Prices API.
Installation
npm install refract-rsUsage
import { RefractClient } from 'refract-rs';
const client = new RefractClient({
userAgent: 'my-app/1.0 - [email protected]', // required by the API
});
// Item catalogue (id, name, alch values, GE limit, etc.)
const mapping = await client.fetchMapping();
// Latest high/low prices for all items, or a single item by id
const latest = await client.fetchLatestPrices({ params: { id: 2 } });
// Average prices over a rolling 5-minute or 1-hour window
const hourly = await client.fetchAggregatePriceInfo({ over: '1h' });
// Price history for a single item at a given timestep
const timeseries = await client.fetchTimeseries({
params: { id: 2, timestep: '5m' },
});Client options
| Option | Type | Required | Default |
| ----------- | -------- | -------- | ----------------------------------------------- |
| userAgent | string | Yes | — |
| timeout | number | No | 10000 ms |
| baseUrl | string | No | https://prices.runescape.wiki/api/v1/osrs |
The API asks that you set a descriptive User-Agent that identifies your project and includes a way to reach you. See the API etiquette guidelines for details.
