Class DataClient
Default implementation of the client to access the iRacing "/data" API endpoints.
Inherited Members
Namespace: Aydsko.iRacingData
Assembly: Aydsko.iRacingData.dll
Syntax
public class DataClient : IDataClient, IDisposable
Remarks
Instead of creating an instance of this class directly, it is recommended that you register the library components in the services collection using AddIRacingDataApi(IServiceCollection) and resolve IDataClient service from there.
Constructors
DataClient(HttpClient, ILogger<DataClient>, iRacingDataClientOptions, CookieContainer)
Default implementation of the client to access the iRacing "/data" API endpoints.
Declaration
public DataClient(HttpClient httpClient, ILogger<DataClient> logger, iRacingDataClientOptions options, CookieContainer cookieContainer)
Parameters
Type | Name | Description |
---|---|---|
HttpClient | httpClient | |
ILogger<DataClient> | logger | |
iRacingDataClientOptions | options | |
CookieContainer | cookieContainer |
Remarks
Instead of creating an instance of this class directly, it is recommended that you register the library components in the services collection using AddIRacingDataApi(IServiceCollection) and resolve IDataClient service from there.
Properties
IsLoggedIn
Declaration
public bool IsLoggedIn { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
BuildDataResponse<TData>(HttpResponseHeaders, TData, ILogger, DateTimeOffset?)
Declaration
protected static DataResponse<TData> BuildDataResponse<TData>(HttpResponseHeaders headers, TData data, ILogger logger, DateTimeOffset? expires = null)
Parameters
Type | Name | Description |
---|---|---|
HttpResponseHeaders | headers | |
TData | data | |
ILogger | logger | |
DateTimeOffset? | expires |
Returns
Type | Description |
---|---|
DataResponse<TData> |
Type Parameters
Name | Description |
---|---|
TData |
BuildLinkResultAsync(Uri, CancellationToken)
Declaration
protected virtual Task<(LinkResult, HttpResponseHeaders)> BuildLinkResultAsync(Uri infoLinkUri, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Uri | infoLinkUri | |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<(LinkResult, HttpResponseHeaders)> |
CreateResponseFromChunkedDataAsync<TData, THeaderData, TChunkData>(Uri, JsonTypeInfo<TData>, JsonTypeInfo<TChunkData[]>, CancellationToken)
Declaration
protected virtual Task<DataResponse<(TData, TChunkData[])>> CreateResponseFromChunkedDataAsync<TData, THeaderData, TChunkData>(Uri uri, JsonTypeInfo<TData> jsonTypeInfo, JsonTypeInfo<TChunkData[]> chunkArrayTypeInfo, CancellationToken cancellationToken) where TData : IChunkInfoResultHeader<THeaderData> where THeaderData : IChunkInfoResultHeaderData
Parameters
Type | Name | Description |
---|---|---|
Uri | uri | |
JsonTypeInfo<TData> | jsonTypeInfo | |
JsonTypeInfo<TChunkData[]> | chunkArrayTypeInfo | |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<DataResponse<(TData, TChunkData[])>> |
Type Parameters
Name | Description |
---|---|
TData | |
THeaderData | |
TChunkData |
CreateResponseViaInfoLinkAsync<TData>(Uri, JsonTypeInfo<TData>, CancellationToken)
Declaration
protected virtual Task<DataResponse<TData>> CreateResponseViaInfoLinkAsync<TData>(Uri infoLinkUri, JsonTypeInfo<TData> jsonTypeInfo, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Uri | infoLinkUri | |
JsonTypeInfo<TData> | jsonTypeInfo | |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<DataResponse<TData>> |
Type Parameters
Name | Description |
---|---|
TData |
Dispose()
Declaration
public void Dispose()
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing |
EnsureLoggedInAsync(CancellationToken)
Will ensure the client is authenticated by checking the IsLoggedIn property and executing the login process if required.
Declaration
protected Task EnsureLoggedInAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task | A Task that resolves when the process is complete. |
GetBestLapStatisticsAsync(int?, int?, CancellationToken)
The best laps in various cars and tracks for the given customer's career or that or the authenticated user.
Declaration
public Task<DataResponse<MemberBests>> GetBestLapStatisticsAsync(int? customerId = null, int? carId = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int? | customerId | iRacing Customer Id for the member to return statistics for, or null for the currently authenticated user. |
int? | carId | Car to return statistics for. Should pass null for the first call and then should be an identifier from CarsDriven. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<MemberBests>> | A DataResponse<TData> containing the best laps in a MemberBests object. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetCarAssetDetailsAsync(CancellationToken)
Retrieves details about the car assets, including image paths and descriptions.
Declaration
public Task<DataResponse<IReadOnlyDictionary<string, CarAssetDetail>>> GetCarAssetDetailsAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<IReadOnlyDictionary<string, CarAssetDetail>>> | A DataResponse<TData> containing a dictionary which maps the car identifier to a CarAssetDetail object for each car. |
Remarks
All image paths are relative to https://images-static.iracing.com
.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetCarClassesAsync(CancellationToken)
Retrieves details about the car classes.
Declaration
public Task<DataResponse<CarClass[]>> GetCarClassesAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<CarClass[]>> | A DataResponse<TData> containing an array of CarClass objects. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetCareerStatisticsAsync(int?, CancellationToken)
Return a summary of statistics for the given customer's career or that or the authenticated user.
Declaration
public Task<DataResponse<MemberCareer>> GetCareerStatisticsAsync(int? customerId = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int? | customerId | iRacing Customer Id for the member to return statistics for, or null for the currently authenticated user. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<MemberCareer>> | A DataResponse<TData> containing the statistics in a MemberCareer object. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetCarsAsync(CancellationToken)
Retrieves details about the cars.
Declaration
public Task<DataResponse<CarInfo[]>> GetCarsAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<CarInfo[]>> | A DataResponse<TData> containing an array of CarInfo objects. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetCategoriesAsync(CancellationToken)
Retrieves a list of the iRacing Race Categories.
Declaration
public Task<DataResponse<Category[]>> GetCategoriesAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<Category[]>> | A DataResponse<TData> containing an array of Category objects. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetClubHistoryLookupsAsync(int, int, CancellationToken)
Information about the Clubs configured in iRacing.
Declaration
public Task<DataResponse<ClubHistoryLookup[]>> GetClubHistoryLookupsAsync(int seasonYear, int seasonQuarter, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | seasonYear | Year to retrieve club information from. |
int | seasonQuarter | Quarter to retrieve club information from. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<ClubHistoryLookup[]>> | A DataResponse<TData> containing an array of ClubHistoryLookup objects. |
Remarks
Returns an earlier history if requested quarter does not have a club history.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetCountriesAsync(CancellationToken)
Retrieves a list of country lookup values.
Declaration
public Task<DataResponse<Country[]>> GetCountriesAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<Country[]>> | A DataResponse<TData> containing an array of Country objects. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetCustomerLeagueSessionsAsync(bool, int?, CancellationToken)
Retrieves customer league sessions
Declaration
public Task<DataResponse<CustomerLeagueSessions>> GetCustomerLeagueSessionsAsync(bool mine = false, int? packageId = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
bool | mine | If true, return only sessions created by this user. |
int? | packageId | If set, return only sessions using this car or track package ID. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<CustomerLeagueSessions>> | A DataResponse<TData> containing an array of CustomerLeagueSessions objects. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetDivisionsAsync(CancellationToken)
Retrieves a list of the iRacing Divisions.
Declaration
public Task<DataResponse<Division[]>> GetDivisionsAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<Division[]>> | A DataResponse<TData> containing an array of Division objects. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetDriverAwardsAsync(int?, CancellationToken)
Retrieve the awards earned by the given customer or the currently authenticated user.
Declaration
public Task<DataResponse<MemberAward[]>> GetDriverAwardsAsync(int? customerId = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int? | customerId | A customer identifier to retrieve awards for or leave as null to default to the currently authenticated user. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<MemberAward[]>> | A DataResponse<TData> containing an array of MemberAward objects. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetDriverInfoAsync(int[], bool, CancellationToken)
Retrieve information about one or more other drivers by their customer identifier.
Declaration
public Task<DataResponse<DriverInfo[]>> GetDriverInfoAsync(int[] customerIds, bool includeLicenses, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int[] | customerIds | An array of one or more customer identifiers. |
bool | includeLicenses | Indicates if license information should be included. Either true or false to exclude for performance purposes. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<DriverInfo[]>> | A DataResponse<TData> containing an array of DriverInfo objects. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetDriverStatisticsByCategoryCsvAsync(int, CancellationToken)
Retrieve a comma separated value (CSV) file containing driver statistics for the given category.
Declaration
public Task<DriverStatisticsCsvFile> GetDriverStatisticsByCategoryCsvAsync(int categoryId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | categoryId | A valid category identifier. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DriverStatisticsCsvFile> | A Task that resolves to the content of the CSV. |
See Also
GetEventTypesAsync(CancellationToken)
Retrieves a list of the iRacing Event Types.
Declaration
public Task<DataResponse<EventType[]>> GetEventTypesAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<EventType[]>> | A DataResponse<TData> containing an array of EventType objects. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetLeagueAsync(int, bool, CancellationToken)
Get information about a league.
Declaration
public Task<DataResponse<League>> GetLeagueAsync(int leagueId, bool includeLicenses = false, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | leagueId | The unique identifier for the league. |
bool | includeLicenses | Indicates if license information should be included. Either true or false to exclude for performance purposes. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<League>> | A DataResponse<TData> containing the season and optionally series detail in a Track array. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetLeagueMembershipAsync(bool, CancellationToken)
Retrieves league membership.
Declaration
public Task<DataResponse<LeagueMembership[]>> GetLeagueMembershipAsync(bool includeLeague = false, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
bool | includeLeague | Indicates if league information should be included. Either true or false to exclude for performance purposes. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<LeagueMembership[]>> | A DataResponse<TData> containing an array of LeagueMembership objects. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetLeagueMembershipAsync(int, bool, CancellationToken)
Retrieves league membership.
Declaration
public Task<DataResponse<LeagueMembership[]>> GetLeagueMembershipAsync(int customerId, bool includeLeague = false, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | customerId | The customer for which membership should be retrieved. |
bool | includeLeague | Indicates if league information should be included. Either true or false to exclude for performance purposes. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<LeagueMembership[]>> | A DataResponse<TData> containing an array of LeagueMembership objects. |
Remarks
If the value passed for customerId
is different from the authenticated member, the following restrictions apply:
- Caller cannot be on requested customer's block list or an empty list will result;
- Requested customer cannot have their online activity preference set to hidden or an empty list will result;
- Only leagues for which the requested customer is an admin and the league roster is not private are returned.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetLeaguePointsSystemsAsync(int, int?, CancellationToken)
Get information about the points systems available to a league.
Declaration
public Task<DataResponse<LeaguePointsSystems>> GetLeaguePointsSystemsAsync(int leagueId, int? seasonId = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | leagueId | The unique identifier for the league. |
int? | seasonId | If included and the season is using custom points then the custom points option is included in the returned list. Otherwise the custom points option is not returned. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<LeaguePointsSystems>> | A DataResponse<TData> containing the league point system information in a LeaguePointsSystems object. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetLeagueSeasonSessionsAsync(int, int, bool, CancellationToken)
Retrieves league's season's sessions
Declaration
public Task<DataResponse<LeagueSeasonSessions>> GetLeagueSeasonSessionsAsync(int leagueId, int seasonId, bool resultsOnly = false, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | leagueId | League Id to return sessions for. |
int | seasonId | Season Id to return sessions for. |
bool | resultsOnly | If true include only sessions which results are available. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<LeagueSeasonSessions>> | A DataResponse<TData> containing an array of LeagueSeasonSessions objects. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetLeagueSeasonsAsync(int, bool, CancellationToken)
Retrieves league's seasons
Declaration
public Task<DataResponse<LeagueSeasons>> GetLeagueSeasonsAsync(int leagueId, bool includeRetired = false, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | leagueId | League Id to return seasons for. |
bool | includeRetired | If true include seasons which are no longer active. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<LeagueSeasons>> | A DataResponse<TData> containing an array of LeagueSeasons objects. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetLicenseLookupsAsync(CancellationToken)
Information about license levels available in the iRacing system.
Declaration
public Task<DataResponse<LicenseLookup[]>> GetLicenseLookupsAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<LicenseLookup[]>> | A DataResponse<TData> containing an array of LicenseLookup objects. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetLookupsAsync(CancellationToken)
Information about reference data defined by the system.
Declaration
public Task<DataResponse<LookupGroup[]>> GetLookupsAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<LookupGroup[]>> | A DataResponse<TData> containing an array of LookupGroup objects. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetMemberChartData(int?, int, MemberChartType, CancellationToken)
Declaration
[Obsolete("Use \"GetMemberChartDataAsync\" instead.")]
public Task<DataResponse<MemberChart>> GetMemberChartData(int? customerId, int categoryId, MemberChartType chartType, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int? | customerId | |
int | categoryId | |
MemberChartType | chartType | |
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task<DataResponse<MemberChart>> |
GetMemberChartDataAsync(int?, int, MemberChartType, CancellationToken)
Obtains the source data to generate charts about a customer's account.
Declaration
public Task<DataResponse<MemberChart>> GetMemberChartDataAsync(int? customerId, int categoryId, MemberChartType chartType, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int? | customerId | iRacing Customer Id for the member to return statistics for, or null for the currently authenticated user. |
int | categoryId | The category the chart data should be for. 1 - Oval; 2 - Road; 3 - Dirt oval; 4 - Dirt road |
MemberChartType | chartType | Data to return in the chart. 1 - iRating; 2 - TT Rating; 3 - License/SR |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<MemberChart>> | A DataResponse<TData> containing the MemberChart information. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetMemberDivisionAsync(int, EventType, CancellationToken)
Retrieve information about the authenticated member's division.
Declaration
public Task<DataResponse<MemberDivision>> GetMemberDivisionAsync(int seasonId, EventType eventType, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | seasonId | Unique identifier for the racing season. |
EventType | eventType | |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<MemberDivision>> | A MemberDivision object containing the result. |
Remarks
Divisions are 0-based: 0 is Division 1, 10 is Rookie. See GetDivisionsAsync(CancellationToken) for more information.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetMemberParticipationCreditsAsync(CancellationToken)
Retrieves the current member's participation credit status.
Declaration
public Task<DataResponse<ParticipationCredits[]>> GetMemberParticipationCreditsAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<ParticipationCredits[]>> | A DataResponse<TData> containing an array of ParticipationCredits objects. |
Remarks
Always returns information for the currently authenticated member.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetMemberProfileAsync(int?, CancellationToken)
Retrieve the MemberProfile representing details about a driver.
Declaration
public Task<DataResponse<MemberProfile>> GetMemberProfileAsync(int? customerId = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int? | customerId | iRacing Customer Id for the member to return statistics for, or null for the currently authenticated user. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<MemberProfile>> | A DataResponse<TData> containing the statistics in a MemberInfo object. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetMemberRecapAsync(int?, int?, int?, CancellationToken)
Retrieve a summary of the given period for the given driver or currently authenticated member.
Declaration
public Task<DataResponse<MemberRecap>> GetMemberRecapAsync(int? customerId = null, int? seasonYear = null, int? seasonQuarter = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int? | customerId | Optional, if supplied returns statistics for this iRacing Customer Id. Defaults to the currently authenticated user's Customer Id. |
int? | seasonYear | Optional, if supplied limits times to the given year. Defaults to the current calendar year. |
int? | seasonQuarter | Optional, if supplied limits times to a given quarter. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<MemberRecap>> | A DataResponse<TData> containing a MemberRecap object. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetMemberRecentRacesAsync(int?, CancellationToken)
Retrieve the recent race participation for the currently authenticated member.
Declaration
public Task<DataResponse<MemberRecentRaces>> GetMemberRecentRacesAsync(int? customerId = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int? | customerId | iRacing Customer Id for the member to return statistics for, or null for the currently authenticated user. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<MemberRecentRaces>> | A DataResponse<TData> containing the member's recent races in a MemberRecentRaces object. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetMemberSummaryAsync(int?, CancellationToken)
Retrieve overall summary figures for the customerId
given or the current authenticated user.
Declaration
public Task<DataResponse<MemberSummary>> GetMemberSummaryAsync(int? customerId = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int? | customerId | iRacing Customer Id for the member to return statistics for, or null for the currently authenticated user. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<MemberSummary>> | A DataResponse<TData> containing the member's recent races in a MemberRecentRaces object. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetMemberYearlyStatisticsAsync(CancellationToken)
Retrieve the statistics for the currently authenticated member, grouped by year.
Declaration
public Task<DataResponse<MemberYearlyStatistics>> GetMemberYearlyStatisticsAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<MemberYearlyStatistics>> | A DataResponse<TData> containing the member's statistics in a MemberYearlyStatistics object. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetMyInfoAsync(CancellationToken)
Retrieve the MemberInfo for the currently authenticated user.
Declaration
public Task<DataResponse<MemberInfo>> GetMyInfoAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<MemberInfo>> | A DataResponse<TData> containing the statistics in a MemberInfo object. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetPastSeasonsForSeriesAsync(int, CancellationToken)
Get all seasons for a series.
Declaration
public Task<DataResponse<PastSeriesDetail>> GetPastSeasonsForSeriesAsync(int seriesId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | seriesId | The series identifier to return seasons for. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<PastSeriesDetail>> | A DataResponse<TData> containing an array of Country objects. |
Remarks
Filter list by official:true for seasons with standings.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetRaceGuideAsync(DateTimeOffset?, bool?, CancellationToken)
Find sessions that begin or end after the given time.
Declaration
public Task<DataResponse<RaceGuideResults>> GetRaceGuideAsync(DateTimeOffset? from = null, bool? includeEndAfterFrom = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
DateTimeOffset? | from | Optional instant to search from. Must be a time in the future. Defaults to the current instant. |
bool? | includeEndAfterFrom | If true include sessions which begin before the |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<RaceGuideResults>> | A DataResponse<TData> containing the search's results as a RaceGuideResults object. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetSeasonDriverStandingsAsync(int, int, int?, int?, int?, CancellationToken)
Retrieve the driver standings for a season.
Declaration
public Task<DataResponse<(SeasonDriverStandingsHeader Header, SeasonDriverStanding[] Standings)>> GetSeasonDriverStandingsAsync(int seasonId, int carClassId, int? raceWeekIndex = null, int? clubId = null, int? division = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | seasonId | Unique identifier for the racing season. |
int | carClassId | Car class identifier. See GetCarClassesAsync(CancellationToken). |
int? | raceWeekIndex | Week within the given season, starting with 0 for the first week. Defaults to "all" if null. |
int? | clubId | Club identifier to search. Defaults to "all" if null. |
int? | division | Division to search. Note that divisions are zero-based. See GetDivisionsAsync(CancellationToken). Defaults to "all" if null. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<(SeasonDriverStandingsHeader Header, SeasonDriverStanding[] Standings)>> | A header with overall series information and an array of standings. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetSeasonQualifyResultsAsync(int, int, int?, int?, int?, CancellationToken)
Retrieve the qualifying results for a season.
Declaration
public Task<DataResponse<(SeasonQualifyResultsHeader Header, SeasonQualifyResult[] Results)>> GetSeasonQualifyResultsAsync(int seasonId, int carClassId, int? raceWeekIndex = null, int? clubId = null, int? division = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | seasonId | Unique identifier for the racing season. |
int | carClassId | Car class identifier. See GetCarClassesAsync(CancellationToken). |
int? | raceWeekIndex | Week within the given season, starting with 0 for the first week. Defaults to "all" if null. |
int? | clubId | Club identifier to search. Defaults to "all" if null. |
int? | division | Division to search. Note that divisions are zero-based. See GetDivisionsAsync(CancellationToken). Defaults to "all" if null. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<(SeasonQualifyResultsHeader Header, SeasonQualifyResult[] Results)>> | A header with overall series information and an array of qualifying results. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetSeasonResultsAsync(int, EventType, int, CancellationToken)
Retrieve information about the races run during a week in the season.
Declaration
public Task<DataResponse<SeasonResults>> GetSeasonResultsAsync(int seasonId, EventType eventType, int raceWeekNumber, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | seasonId | Unique identifier for the racing season. |
EventType | eventType | The type of events to return. |
int | raceWeekNumber | Week number within the given season, starting with 0 for the first week. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<SeasonResults>> | A DataResponse<TData> containing the races in a SeasonResults object. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetSeasonStandingsAsync(int, int, int?, int?, CancellationToken)
Retrieves league's season's standings
Declaration
public Task<DataResponse<SeasonStandings>> GetSeasonStandingsAsync(int leagueId, int seasonId, int? carClassId = null, int? carId = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | leagueId | League Id to return sessions for. |
int | seasonId | Season Id to return sessions for. |
int? | carClassId | If true include only sessions which results are available. |
int? | carId | A token to allow the operation to be cancelled. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<SeasonStandings>> | A DataResponse<TData> containing SeasonStandings. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetSeasonTeamStandingsAsync(int, int, int?, CancellationToken)
Retrieve the team standings for a season.
Declaration
public Task<DataResponse<(SeasonTeamStandingsHeader Header, SeasonTeamStanding[] Standings)>> GetSeasonTeamStandingsAsync(int seasonId, int carClassId, int? raceWeekIndex = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | seasonId | Unique identifier for the racing season. |
int | carClassId | Car class identifier. See GetCarClassesAsync(CancellationToken). |
int? | raceWeekIndex | Week within the given season, starting with 0 for the first week. Defaults to "all" if null. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<(SeasonTeamStandingsHeader Header, SeasonTeamStanding[] Standings)>> | A header with overall series information and an array of team standings. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetSeasonTimeTrialResultsAsync(int, int, int?, int?, int?, CancellationToken)
Retrieve the time trial results for a season.
Declaration
public Task<DataResponse<(SeasonTimeTrialResultsHeader Header, SeasonTimeTrialResult[] Results)>> GetSeasonTimeTrialResultsAsync(int seasonId, int carClassId, int? raceWeekIndex = null, int? clubId = null, int? division = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | seasonId | Unique identifier for the racing season. |
int | carClassId | Car class identifier. See GetCarClassesAsync(CancellationToken). |
int? | raceWeekIndex | Week within the given season, starting with 0 for the first week. Defaults to "all" if null. |
int? | clubId | Club identifier to search. Defaults to "all" if null. |
int? | division | Division to search. Note that divisions are zero-based. See GetDivisionsAsync(CancellationToken). Defaults to "all" if null. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<(SeasonTimeTrialResultsHeader Header, SeasonTimeTrialResult[] Results)>> | A header with overall series information and an array of time trial results. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetSeasonTimeTrialStandingsAsync(int, int, int?, int?, int?, CancellationToken)
Retrieve the time trial standings for a season.
Declaration
public Task<DataResponse<(SeasonTimeTrialStandingsHeader Header, SeasonTimeTrialStanding[] Standings)>> GetSeasonTimeTrialStandingsAsync(int seasonId, int carClassId, int? raceWeekIndex = null, int? clubId = null, int? division = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | seasonId | Unique identifier for the racing season. |
int | carClassId | Car class identifier. See GetCarClassesAsync(CancellationToken). |
int? | raceWeekIndex | Week within the given season, starting with 0 for the first week. Defaults to "all" if null. |
int? | clubId | Club identifier to search. Defaults to "all" if null. |
int? | division | Division to search. Note that divisions are zero-based. See GetDivisionsAsync(CancellationToken). Defaults to "all" if null. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<(SeasonTimeTrialStandingsHeader Header, SeasonTimeTrialStanding[] Standings)>> | A header with overall series information and an array of time trial standings. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetSeasonsAsync(bool, CancellationToken)
Retrieve information about the season and series.
Declaration
public Task<DataResponse<SeasonSeries[]>> GetSeasonsAsync(bool includeSeries, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
bool | includeSeries | Indicate if the series details should be included. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<SeasonSeries[]>> | A DataResponse<TData> containing the season and optionally series detail in a SeasonSeries array. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetSeriesAssetsAsync(CancellationToken)
Retrieve a the current season's series assets.
Declaration
public Task<DataResponse<IReadOnlyDictionary<string, SeriesAsset>>> GetSeriesAssetsAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<IReadOnlyDictionary<string, SeriesAsset>>> | A DataResponse<TData> containing a dictionary with the series identifier as the key and the assets details in a SeriesAsset item. |
Remarks
All image paths are relative to https://images-static.iracing.com
.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetSeriesAsync(CancellationToken)
Retrieve a list of the current season's series.
Declaration
public Task<DataResponse<SeriesDetail[]>> GetSeriesAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<SeriesDetail[]>> | A DataResponse<TData> containing the series detail in a SeriesDetail array. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetServiceStatusAsync(CancellationToken)
Retrieve the current iRacing Service Status information.
Declaration
public Task<StatusResult> GetServiceStatusAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<StatusResult> | The current status of the various services that make up iRacing. |
Exceptions
Type | Condition |
---|---|
iRacingDataClientException | If there's a problem processing the result. |
GetSingleDriverSubsessionLapsAsync(int, int, int, CancellationToken)
Get the lap details for a particular driver in the given single-driver subsession.
Declaration
public Task<DataResponse<(SubsessionLapsHeader Header, SubsessionLap[] Laps)>> GetSingleDriverSubsessionLapsAsync(int subSessionId, int simSessionNumber, int customerId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | subSessionId | The identifier of the subsession for which results should be returned. |
int | simSessionNumber | The number of the session where |
int | customerId | A customer identifier value for the driver in the race to return laps for. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<(SubsessionLapsHeader Header, SubsessionLap[] Laps)>> | A DataResponse<TData> containing the result details in a SubSessionResult object. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetSpectatorSubsessionDetailsAsync(EventType[]?, int[]?, CancellationToken)
Retrieves the current subsession identifiers available to spectate.
Declaration
public Task<DataResponse<SpectatorDetails>> GetSpectatorSubsessionDetailsAsync(EventType[]? eventTypes = null, int[]? seasonIds = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
EventType[] | eventTypes | Optional, if supplied limits the types of event subsessions to include. Defaults to all. |
int[] | seasonIds | Optional, if supplied limits the seasons to include. Defaults to all. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<SpectatorDetails>> | A DataResponse<TData> containing a MemberRecap object. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetSpectatorSubsessionIdentifiersAsync(EventType[]?, CancellationToken)
Retrieves the current subsession identifiers available to spectate.
Declaration
public Task<DataResponse<SpectatorSubsessionIds>> GetSpectatorSubsessionIdentifiersAsync(EventType[]? eventTypes = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
EventType[] | eventTypes | Optional, if supplied limits the types of event subsessions to include. Defaults to all. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<SpectatorSubsessionIds>> | A DataResponse<TData> containing a MemberRecap object. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetStatisticsSeriesAsync(CancellationToken)
Retrieve a list of series.
Declaration
public Task<DataResponse<StatisticsSeries[]>> GetStatisticsSeriesAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<StatisticsSeries[]>> | A DataResponse<TData> containing the series in a StatisticsSeries array. |
Remarks
To get series and seasons for which standings should be available, filter the list where Official is true.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetSubSessionLapChartAsync(int, int, CancellationToken)
Get the results of a subsession, if the authenticated user is authorized to view them.
Declaration
public Task<DataResponse<(SubsessionLapsHeader Header, SubsessionChartLap[] Laps)>> GetSubSessionLapChartAsync(int subSessionId, int simSessionNumber, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | subSessionId | The identifier of the subsession for which results should be returned. |
int | simSessionNumber | The number of the session where |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<(SubsessionLapsHeader Header, SubsessionChartLap[] Laps)>> | A DataResponse<TData> containing the result details in a SubSessionResult object. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetSubSessionResultAsync(int, bool, CancellationToken)
Get the results of a subsession, if the authenticated user is authorized to view them.
Declaration
public Task<DataResponse<SubSessionResult>> GetSubSessionResultAsync(int subSessionId, bool includeLicenses, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | subSessionId | The identifier of the subsession for which results should be returned. |
bool | includeLicenses | Indicates if license information should be included. Either true or false to exclude for performance purposes. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<SubSessionResult>> | A DataResponse<TData> containing the result details in a SubSessionResult object. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetSubsessionEventLogAsync(int, int, CancellationToken)
Retrieve a list of session events.
Declaration
public Task<DataResponse<(SubsessionEventLogHeader Header, SubsessionEventLogItem[] LogItems)>> GetSubsessionEventLogAsync(int subSessionId, int simSessionNumber, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | subSessionId | The identifier of the subsession for which results should be returned. |
int | simSessionNumber | The number of the session where |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<(SubsessionEventLogHeader Header, SubsessionEventLogItem[] LogItems)>> | A DataResponse<TData> containing the subsession's event log header details in a SubsessionEventLogHeader and SubsessionEventLogItem array. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetTeamAsync(int, CancellationToken)
Information about an iRacing Team.
Declaration
public Task<DataResponse<TeamInfo>> GetTeamAsync(int teamId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | teamId | Unique identifier for the team. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<TeamInfo>> | A DataResponse<TData> containing the team details in a TeamInfo object. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetTeamSubsessionLapsAsync(int, int, int, CancellationToken)
Get the lap details for a team in the given team subsession.
Declaration
public Task<DataResponse<(SubsessionLapsHeader Header, SubsessionLap[] Laps)>> GetTeamSubsessionLapsAsync(int subSessionId, int simSessionNumber, int teamId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | subSessionId | The identifier of the subsession for which results should be returned. |
int | simSessionNumber | The number of the session where |
int | teamId | The unique team identifier value for the team from the race to return laps for. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<(SubsessionLapsHeader Header, SubsessionLap[] Laps)>> | A DataResponse<TData> containing overall session details in a SubsessionLapsHeader object along with an array of SubsessionLap. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetTimeAttackMemberSeasonResultsAsync(int, CancellationToken)
Retrieves the current member's Time Attack results for the given season.
Declaration
public Task<DataResponse<TimeAttackMemberSeasonResult[]>> GetTimeAttackMemberSeasonResultsAsync(int competitionSeasonId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | competitionSeasonId | The Time Attack season identifier to return results for. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<TimeAttackMemberSeasonResult[]>> | A DataResponse<TData> containing an array of TimeAttackMemberSeasonResult objects. |
Remarks
Always returns information for the currently authenticated member.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetTimeAttackSeasonsAsync(CancellationToken)
Get a list of Time Attack series.
Declaration
public Task<TimeAttackSeason[]> GetTimeAttackSeasonsAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<TimeAttackSeason[]> | An array of TimeAttackSeason objects. |
Exceptions
Type | Condition |
---|---|
iRacingDataClientException | If there's a problem processing the result. |
GetTrackAssetScreenshotUris(Track, TrackAssets)
Build a collection of URIs which resolve to screenshots of the track.
Declaration
public IEnumerable<Uri> GetTrackAssetScreenshotUris(Track track, TrackAssets trackAssets)
Parameters
Type | Name | Description |
---|---|---|
Track | track | The track detail for the circuit you want screenshots for. |
TrackAssets | trackAssets | The related track assets detail for the same circuit as |
Returns
Type | Description |
---|---|
IEnumerable<Uri> | A collection of Uri objects containing links that will resolve to images of the track or an empty collection. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Either |
ArgumentException | One of these issues will cause this exception: |
GetTrackAssetScreenshotUrisAsync(int, CancellationToken)
Build a collection of URIs which resolve to screenshots of the track.
Declaration
public Task<IEnumerable<Uri>> GetTrackAssetScreenshotUrisAsync(int trackId, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | trackId | The unique identifier of the track for which the screenshot links should be generated. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<IEnumerable<Uri>> | A Task that resolves to a collection of Uri objects containing links to images of the track or an empty collection. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | The |
GetTrackAssetsAsync(CancellationToken)
Retrieve information about the track assets.
Declaration
public Task<DataResponse<IReadOnlyDictionary<string, TrackAssets>>> GetTrackAssetsAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<IReadOnlyDictionary<string, TrackAssets>>> | A DataResponse<TData> containing the season and optionally series detail in a Track array. |
Remarks
Image paths are relative to https://images-static.iracing.com/.
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetTracksAsync(CancellationToken)
Retrieve information about the tracks.
Declaration
public Task<DataResponse<Track[]>> GetTracksAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<Track[]>> | A DataResponse<TData> containing the season and optionally series detail in a Track array. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
GetWeatherForecastFromUrlAsync(string, CancellationToken)
Retrieves the weather forecast for the given track and session time.
Declaration
public Task<IEnumerable<WeatherForecast>> GetWeatherForecastFromUrlAsync(string url, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | url | Url received from the WeatherUrl property of the season's Schedule. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<IEnumerable<WeatherForecast>> | A collection of WeatherForecast objects detailing the forecasted weather. |
GetWorldRecordsAsync(int, int, int?, int?, CancellationToken)
World record times for a car at a particular track. Optionally by year and season.
Declaration
public Task<DataResponse<(WorldRecordsHeader Header, WorldRecordEntry[] Entries)>> GetWorldRecordsAsync(int carId, int trackId, int? seasonYear = null, int? seasonQuarter = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | carId | Unique identifier for the car. |
int | trackId | Unique identifier for the track. |
int? | seasonYear | Optional, if supplied limits times to the given year. |
int? | seasonQuarter | Optional, if supplied limits times to a given quarter. Must be used with |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<(WorldRecordsHeader Header, WorldRecordEntry[] Entries)>> | A header with overall information and an array of world record results. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
HandleUnsuccessfulResponse(HttpResponseMessage, string, ILogger)
Declaration
protected virtual void HandleUnsuccessfulResponse(HttpResponseMessage httpResponse, string content, ILogger logger)
Parameters
Type | Name | Description |
---|---|---|
HttpResponseMessage | httpResponse | |
string | content | |
ILogger | logger |
ListHostedSessionsAsync(CancellationToken)
Sessions that can be joined as a driver. Without spectator and non-league pending sessions for the user.
Declaration
public Task<DataResponse<HostedSessionsResult>> ListHostedSessionsAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<HostedSessionsResult>> | A DataResponse<TData> containing an array of EventType objects. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
ListHostedSessionsCombinedAsync(int?, CancellationToken)
Sessions that can be joined as a driver or spectator, and also includes non-league pending sessions for the user.
Declaration
public Task<DataResponse<CombinedSessionsResult>> ListHostedSessionsCombinedAsync(int? packageId = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int? | packageId | If set, return only sessions using this car or track package id. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<CombinedSessionsResult>> | A DataResponse<TData> containing an array of EventType objects. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
ListSeasonsAsync(int, int, CancellationToken)
Get a list of the Seasons run during the given year and quarter numbers.
Declaration
public Task<DataResponse<ListOfSeasons>> ListSeasonsAsync(int seasonYear, int seasonQuarter, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
int | seasonYear | The year to list seasons for. |
int | seasonQuarter | The quarter to list seasons for. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<ListOfSeasons>> | A DataResponse<TData> containing the search's results as a ListOfSeasons object. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
SearchDriversAsync(string, int?, CancellationToken)
Search for one or more drivers.
Declaration
public Task<DataResponse<DriverSearchResult[]>> SearchDriversAsync(string searchTerm, int? leagueId = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | searchTerm | A customer id or partial name to search on. |
int? | leagueId | Narrow the search to the roster of the given league. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<DriverSearchResult[]>> | A DataResponse<TData> containing an array of DriverSearchResult objects. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
SearchHostedResultsAsync(HostedSearchParameters, CancellationToken)
Search for hosted and league sessions over a maximum period of 90 days.
Declaration
public Task<DataResponse<(HostedResultsHeader Header, HostedResultItem[] Items)>> SearchHostedResultsAsync(HostedSearchParameters searchParameters, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
HostedSearchParameters | searchParameters | Parameters object containing the values to use in the search. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<(HostedResultsHeader Header, HostedResultItem[] Items)>> | A DataResponse<TData> containing the search's header details in a HostedResultsHeader and HostedResultItem array for the results. |
Remarks
For scraping results the most effective approach is to keep track of the maximum EndTime found during a search then make the subsequent call using that date/time as the FinishRangeBegin and skip any subsessions that are duplicated. Results are ordered by subsessionid which is a proxy for start time.
Valid searches must be structured as follows:
- requires one of: StartRangeBegin, FinishRangeBegin
- requires one of: ParticipantCustomerId, TeamId, HostCustomerId, SessionName
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
SearchLeagueDirectoryAsync(SearchLeagueDirectoryParameters, CancellationToken)
Searches the league directory based on the given parameters.
Declaration
public Task<DataResponse<LeagueDirectoryResultPage>> SearchLeagueDirectoryAsync(SearchLeagueDirectoryParameters searchParameters, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
SearchLeagueDirectoryParameters | searchParameters | Parameters object containing the values to use in the search. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<LeagueDirectoryResultPage>> | A DataResponse<TData> containing the search's results as a LeagueDirectoryResultPage object. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
SearchOfficialResultsAsync(OfficialSearchParameters, CancellationToken)
Search for official sessions over a maximum period of 90 days.
Declaration
public Task<DataResponse<(OfficialSearchResultHeader Header, OfficialSearchResultItem[] Items)>> SearchOfficialResultsAsync(OfficialSearchParameters searchParameters, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
OfficialSearchParameters | searchParameters | Parameters object containing the values to use in the search. |
CancellationToken | cancellationToken | A token to allow the operation to be cancelled. |
Returns
Type | Description |
---|---|
Task<DataResponse<(OfficialSearchResultHeader Header, OfficialSearchResultItem[] Items)>> | A DataResponse<TData> containing the search's header details in a OfficialSearchResultHeader and OfficialSearchResultItem array for the results. |
Remarks
For scraping results the most effective approach is to keep track of the maximum EndTime found during a search then make the subsequent call using that date/time as the FinishRangeBegin and skip any subsessions that are duplicated. Results are ordered by subsessionid which is a proxy for start time.
Valid searches require at least one of:
Exceptions
Type | Condition |
---|---|
InvalidOperationException | If the client is not currently authenticated. |
iRacingDataClientException | If there's a problem processing the result. |
iRacingUnauthorizedResponseException | If the iRacing API returns a |
UseUsernameAndPassword(string, string)
Supply the username and password if they weren't supplied through the iRacingDataClientOptions object.
Declaration
public void UseUsernameAndPassword(string username, string password)
Parameters
Type | Name | Description |
---|---|---|
string | username | iRacing user name to use for authentication. |
string | password | Password associated with the iRacing user name used to authenticate. |
Exceptions
Type | Condition |
---|---|
iRacingClientOptionsValueMissingException | Either |
UseUsernameAndPassword(string, string, bool)
Supply the username and password if they weren't supplied through the iRacingDataClientOptions object.
Declaration
public void UseUsernameAndPassword(string username, string password, bool passwordIsEncoded)
Parameters
Type | Name | Description |
---|---|---|
string | username | iRacing user name to use for authentication. |
string | password | Password associated with the iRacing user name used to authenticate. |
bool | passwordIsEncoded | If true indicates the |
Exceptions
Type | Condition |
---|---|
iRacingClientOptionsValueMissingException | Either |