26 lines
1,009 B
TypeScript
26 lines
1,009 B
TypeScript
|
|
import type { FetchedStandingsRecord, StandingsSyncAdapter } from "./types";
|
||
|
|
|
||
|
|
/**
|
||
|
|
* TheSportsDB standings adapter.
|
||
|
|
*
|
||
|
|
* TODO: Implement when TheSportsDB adds reliable NBA/NHL standings support.
|
||
|
|
*
|
||
|
|
* Status (as of 2026-03): The free-tier lookuptable.php endpoint is documented
|
||
|
|
* as "soccer only" and returns empty results for NBA (4387) and NHL (4380).
|
||
|
|
* A premium v2 API key ($9/mo) may unlock broader support — test with:
|
||
|
|
* GET https://www.thesportsdb.com/api/v2/json/lookuptable.php?l={leagueId}
|
||
|
|
* Headers: { "X-API-KEY": process.env.THESPORTSDB_API_KEY }
|
||
|
|
*
|
||
|
|
* Reference: https://www.thesportsdb.com/forum_topic.php?t=5772
|
||
|
|
*/
|
||
|
|
export class TheSportsDbAdapter implements StandingsSyncAdapter {
|
||
|
|
constructor(private readonly leagueId: string) {}
|
||
|
|
|
||
|
|
async fetchStandings(): Promise<FetchedStandingsRecord[]> {
|
||
|
|
throw new Error(
|
||
|
|
`TheSportsDB standings sync not yet implemented (league ${this.leagueId}). ` +
|
||
|
|
"Use NhlStandingsAdapter or NbaStandingsAdapter instead."
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|