26 lines
978 B
TypeScript
26 lines
978 B
TypeScript
import { ApplyPenaltyCommandDTO } from '../../../types/generated/ApplyPenaltyCommandDTO';
|
|
import { RacePenaltiesDTO } from '../../../types/generated/RacePenaltiesDTO';
|
|
import type { PenaltyTypesReferenceDTO } from '../../../types/PenaltyTypesReferenceDTO';
|
|
import { BaseApiClient } from '../base/BaseApiClient';
|
|
|
|
/**
|
|
* Penalties API Client
|
|
*
|
|
* Handles all penalty-related API operations.
|
|
*/
|
|
export class PenaltiesApiClient extends BaseApiClient {
|
|
/** Get penalties for a race */
|
|
getRacePenalties(raceId: string): Promise<RacePenaltiesDTO> {
|
|
return this.get<RacePenaltiesDTO>(`/races/${raceId}/penalties`);
|
|
}
|
|
|
|
/** Get allowed penalty types and semantics */
|
|
getPenaltyTypesReference(): Promise<PenaltyTypesReferenceDTO> {
|
|
return this.get<PenaltyTypesReferenceDTO>('/races/reference/penalty-types');
|
|
}
|
|
|
|
/** Apply a penalty */
|
|
applyPenalty(input: ApplyPenaltyCommandDTO): Promise<void> {
|
|
return this.post<void>('/races/penalties/apply', input);
|
|
}
|
|
} |