iracing-api
Version:
Javascript client for iracing API
36 lines (35 loc) • 1.43 kB
JavaScript
import { API } from './api';
/**
* Provides methods for interacting with hosted session endpoints.
*/
export class HostedAPI extends API {
constructor() {
super(...arguments);
/**
* Get a list of combined hosted sessions.
*
* Includes sessions that can be joined as a driver or spectator,
* and also includes non-league pending sessions for the user.
*
* @param {GetHostedCombinedSessionsParams} [params] - Optional parameters to filter the sessions.
* @param {number} [params.packageId] - If set, return only sessions using this car or track package ID.
*
* @returns A promise resolving to the combined hosted sessions data, or undefined on error.
*/
this.getHostedCombinedSessions = async (params) => {
return await this._getData('data/hosted/combined_sessions', {
package_id: params === null || params === void 0 ? void 0 : params.packageId,
});
};
/**
* Get a list of hosted sessions that can be joined as a driver.
*
* Excludes spectator sessions and non-league pending sessions.
*
* @returns A promise resolving to the hosted sessions data, or undefined on error.
*/
this.getHostedSessions = async () => {
return await this._getData('data/hosted/sessions');
};
}
}