45 lines
1.5 KiB
TypeScript
45 lines
1.5 KiB
TypeScript
import { BaseApiClient } from '../base/BaseApiClient';
|
|
import type {
|
|
LeagueAdminProtestsDTO,
|
|
ApplyPenaltyCommandDTO,
|
|
RequestProtestDefenseCommandDTO,
|
|
ReviewProtestCommandDTO,
|
|
} from '../../types/generated';
|
|
import type { RaceProtestsDTO } from '../../types';
|
|
|
|
/**
|
|
* Protests API Client
|
|
*
|
|
* Handles all protest-related API operations.
|
|
*/
|
|
export class ProtestsApiClient extends BaseApiClient {
|
|
/** Get protests for a league */
|
|
getLeagueProtests(leagueId: string): Promise<LeagueAdminProtestsDTO> {
|
|
return this.get<LeagueAdminProtestsDTO>(`/leagues/${leagueId}/protests`);
|
|
}
|
|
|
|
/** Get a specific protest for a league */
|
|
getLeagueProtest(leagueId: string, protestId: string): Promise<LeagueAdminProtestsDTO> {
|
|
return this.get<LeagueAdminProtestsDTO>(`/leagues/${leagueId}/protests/${protestId}`);
|
|
}
|
|
|
|
/** Apply a penalty */
|
|
applyPenalty(input: ApplyPenaltyCommandDTO): Promise<void> {
|
|
return this.post<void>('/races/penalties/apply', input);
|
|
}
|
|
|
|
/** Request protest defense */
|
|
requestDefense(input: RequestProtestDefenseCommandDTO): Promise<void> {
|
|
return this.post<void>('/races/protests/defense/request', input);
|
|
}
|
|
|
|
/** Review protest */
|
|
reviewProtest(input: ReviewProtestCommandDTO): Promise<void> {
|
|
return this.post<void>(`/protests/${input.protestId}/review`, input);
|
|
}
|
|
|
|
/** Get protests for a race */
|
|
getRaceProtests(raceId: string): Promise<RaceProtestsDTO> {
|
|
return this.get<RaceProtestsDTO>(`/races/${raceId}/protests`);
|
|
}
|
|
} |