TypeScript client
A thin typed client with no dependencies. It reads the same envelope as the raw API and throws a typed error on 4xx and 5xx. The package name below is reserved for the first npm release; until it is published, copy packages/data-api-client/src/index.ts from the repository.
npm install @switchwize/data-api
import { SwitchwizeClient } from "@switchwize/data-api"
const sw = new SwitchwizeClient({ apiKey: process.env.SWITCHWIZE_KEY }) // key optional
const rates = await sw.dataset("approved-rates", { category: "hysa", limit: 5 })
console.log(rates.asOf, rates.data)On a 429 the client waits for Retry-After once, then throws SwitchwizeApiError with retryAfter set.