32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
|
|
import type { FetchedStandingsRecord, StandingsSyncAdapter } from "./types";
|
||
|
|
|
||
|
|
/**
|
||
|
|
* F1 / IndyCar championship standings adapter.
|
||
|
|
*
|
||
|
|
* TODO: Implement using one of:
|
||
|
|
* - OpenF1 API: https://openf1.org/ (free, real-time, no key required)
|
||
|
|
* - Ergast API: https://ergast.com/mrd/ (free, historical, being deprecated)
|
||
|
|
* - Official F1 API: requires a key but is comprehensive
|
||
|
|
*
|
||
|
|
* NOTE: For season_standings sports, the sync result should upsert into
|
||
|
|
* participantSeasonResults (currentPoints + currentPosition) rather than
|
||
|
|
* regularSeasonStandings. The orchestrator in index.ts handles the routing.
|
||
|
|
*/
|
||
|
|
export class F1StandingsAdapter implements StandingsSyncAdapter {
|
||
|
|
async fetchStandings(): Promise<FetchedStandingsRecord[]> {
|
||
|
|
throw new Error(
|
||
|
|
"F1/IndyCar standings sync not yet implemented. " +
|
||
|
|
"Implement using OpenF1 API (https://openf1.org/) or Ergast API."
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export class IndyCarStandingsAdapter implements StandingsSyncAdapter {
|
||
|
|
async fetchStandings(): Promise<FetchedStandingsRecord[]> {
|
||
|
|
throw new Error(
|
||
|
|
"IndyCar standings sync not yet implemented. " +
|
||
|
|
"Implement using the IndyCar official results API."
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|