Aydsko iRacing Data API
Show / Hide Table of Contents

Class ServicesExtensions

Inheritance
object
ServicesExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Aydsko.iRacingData
Assembly: Aydsko.iRacingData.dll
Syntax
public static class ServicesExtensions

Methods

AddIRacingDataApi(IServiceCollection)

Add required types for iRacing Data API to the service collection.

Declaration
public static IHttpClientBuilder AddIRacingDataApi(this IServiceCollection services)
Parameters
Type Name Description
IServiceCollection services

The service collection to configure.

Returns
Type Description
IHttpClientBuilder

The http client builder for further configuration.

Exceptions
Type Condition
ArgumentNullException

One of the arguments is null.

AddIRacingDataApi(IServiceCollection, Action<iRacingDataClientOptions>)

Add required types for iRacing Data API to the service collection.

Declaration
public static IHttpClientBuilder AddIRacingDataApi(this IServiceCollection services, Action<iRacingDataClientOptions> configureOptions)
Parameters
Type Name Description
IServiceCollection services

The service collection to configure.

Action<iRacingDataClientOptions> configureOptions

Action to configure the options for the API client.

Returns
Type Description
IHttpClientBuilder

The http client builder for further configuration.

Exceptions
Type Condition
ArgumentNullException

One of the arguments is null.

AddIRacingDataApiWithCaching(IServiceCollection)

Add required types for iRacing Data API with caching enabled to the service collection.

Declaration
public static IHttpClientBuilder AddIRacingDataApiWithCaching(this IServiceCollection services)
Parameters
Type Name Description
IServiceCollection services

The service collection to configure.

Returns
Type Description
IHttpClientBuilder

The http client builder for further configuration.

Exceptions
Type Condition
ArgumentNullException

One of the arguments is null.

AddIRacingDataApiWithCaching(IServiceCollection, Action<iRacingDataClientOptions>)

Add required types for iRacing Data API with caching enabled to the service collection.

Declaration
public static IHttpClientBuilder AddIRacingDataApiWithCaching(this IServiceCollection services, Action<iRacingDataClientOptions> configureOptions)
Parameters
Type Name Description
IServiceCollection services

The service collection to configure.

Action<iRacingDataClientOptions> configureOptions

Action to configure the options for the API client.

Returns
Type Description
IHttpClientBuilder

The http client builder for further configuration.

Exceptions
Type Condition
ArgumentNullException

One of the arguments is null.

UseOAuthTokenCallback(iRacingDataClientOptions, GetOAuthTokenResponse)

Configure the options to use a callback to retrieve an iRacing authentication token.

Declaration
public static iRacingDataClientOptions UseOAuthTokenCallback(this iRacingDataClientOptions options, GetOAuthTokenResponse getOAuthTokenResponse)
Parameters
Type Name Description
iRacingDataClientOptions options

The options object to configure.

GetOAuthTokenResponse getOAuthTokenResponse

The callback to retrieve an OAuth token response.

Returns
Type Description
iRacingDataClientOptions

The options object to allow call chaining.

Remarks

The getOAuthTokenResponse callback should invoke the /authorize endpoint to retrieve a code and then exchange for a token which is then returned.

If the returned token data includes a refresh token it will be processed automatically. Otherwise the callback will be asked again for an OAuthTokenResponse object.

See Also
https://oauth.iracing.com/oauth2/book/auth_overview.html

UsePasswordLimitedOAuth(iRacingDataClientOptions, string, string, string, string, bool, bool)

Configure the options to use "Password Limited" iRacing authentication.

Declaration
public static iRacingDataClientOptions UsePasswordLimitedOAuth(this iRacingDataClientOptions options, string userName, string password, string clientId, string clientSecret, bool passwordIsEncoded = false, bool clientSecretIsEncoded = false)
Parameters
Type Name Description
iRacingDataClientOptions options

The options object to configure.

string userName

iRacing username

string password

iRacing password

string clientId

The iRacing-supplied Client ID value.

string clientSecret

The iRacing-supplied Client Secret value.

bool passwordIsEncoded

Indicates that the password value is already encoded for supply to the iRacing Authentication API.

bool clientSecretIsEncoded

Indicates that the clientSecret value is already encoded for supply to the iRacing Authentication API.

Returns
Type Description
iRacingDataClientOptions

The options object to allow call chaining.

UseProductUserAgent(iRacingDataClientOptions, string, Version)

Configure the user agent details to use in requests.

Declaration
public static iRacingDataClientOptions UseProductUserAgent(this iRacingDataClientOptions options, string productName, Version productVersion)
Parameters
Type Name Description
iRacingDataClientOptions options

The options object to configure.

string productName

Name of the client.

Version productVersion

Version of the client.

Returns
Type Description
iRacingDataClientOptions

The options object to allow call chaining.

UseUsernamePasswordAuthentication(iRacingDataClientOptions, string, string, bool)

Configure the options to use legacy iRacing username/password authentication.

Declaration
public static iRacingDataClientOptions UseUsernamePasswordAuthentication(this iRacingDataClientOptions options, string userName, string password, bool passwordIsEncoded = false)
Parameters
Type Name Description
iRacingDataClientOptions options

The options object to configure.

string userName

iRacing username

string password

iRacing password

bool passwordIsEncoded

Indicates that the password value is already encoded for supply to the iRacing Authentication API.

Returns
Type Description
iRacingDataClientOptions

The options object to allow call chaining.

In this article
Back to top Generated by DocFX