UNPKG

iracing-api

Version:

Javascript client for iracing API

34 lines (33 loc) 1.21 kB
import { API } from './api'; /** * Provides methods for retrieving constant data like categories, divisions, and event types. */ export class ConstantsAPI extends API { constructor() { super(...arguments); /** * Get the list of iRacing racing categories (e.g., Oval, Road). * * @returns A promise resolving to an array of category objects, or undefined on error. */ this.getCategories = async () => { return await this._getData('data/constants/categories'); }; /** * Get the list of iRacing divisions (e.g., Division 1, Rookie). * * @returns A promise resolving to an array of division objects, or undefined on error. */ this.getDivisions = async () => { return await this._getData('data/constants/divisions'); }; /** * Get the list of iRacing event types (e.g., Practice, Race). * * @returns A promise resolving to an array of event type objects, or undefined on error. */ this.getEventTypes = async () => { return await this._getData('data/constants/event_types'); }; } }