The TheSportsDB client.
const db = new SportsDb(); // free key 123: v1 onlyconst arsenal = await db.v1.lookup.team(133604);const premium = new SportsDb({ apiKey: process.env.THESPORTSDB_API_KEY, cache: new InMemoryResponseCache() });const tv = await premium.v2.tv.country("Canada"); Copy
const db = new SportsDb(); // free key 123: v1 onlyconst arsenal = await db.v1.lookup.team(133604);const premium = new SportsDb({ apiKey: process.env.THESPORTSDB_API_KEY, cache: new InMemoryResponseCache() });const tv = await premium.v2.tv.country("Canada");
Reuse one client per key: its rate limiter, cache and de-duplication cover every call made through it.
Readonly
Common tasks in one call, using v2 or v1 depending on the key.
The v1 API (free and premium keys).
The v2 API (premium keys only).
Whether v2 accepts the key. One call (v2 lookup/league/4328) unless it's a free key.
The TheSportsDB client.
Reuse one client per key: its rate limiter, cache and de-duplication cover every call made through it.