Class DataClientOptionsExtensions
Inherited Members
Namespace: Aydsko.iRacingData
Assembly: Aydsko.iRacingData.dll
Syntax
public static class DataClientOptionsExtensions
Methods
UseOAuthTokenCallback(iRacingDataClientOptions, GetOAuthTokenResponse)
Configure the options to use a callback to retrieve an iRacing authentication token.
Declaration
[Obsolete("Using a callback to retrieve an OAuth token is deprecated. You must use an IOAuthTokenSource implementation instead. See the \"UseOAuthTokenSource\" method for more information.", false)]
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
UseOAuthTokenSource(iRacingDataClientOptions, Func<IServiceProvider, IOAuthTokenSource>)
Configure the options to retrieve an iRacing authentication token.
Declaration
public static iRacingDataClientOptions UseOAuthTokenSource(this iRacingDataClientOptions options, Func<IServiceProvider, IOAuthTokenSource> tokenSourceFactory)
Parameters
| Type | Name | Description |
|---|---|---|
| iRacingDataClientOptions | options | The options object to configure. |
| Func<IServiceProvider, IOAuthTokenSource> | tokenSourceFactory | The factory that produces an IOAuthTokenSource instance that can be interrogated for the token. |
Returns
| Type | Description |
|---|---|
| iRacingDataClientOptions | The configured options object. |
Remarks
The factory method will be registerd as a transient dependency and resolved each time a token is required.
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Either |
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 |
| bool | clientSecretIsEncoded | Indicates that the |
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
[Obsolete("Legacy username/password authentication is deprecated by iRacing. You must use OAuth authentication instead. See https://oauth.iracing.com/oauth2/book/auth_overview.html for more information.", true)]
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 |
Returns
| Type | Description |
|---|---|
| iRacingDataClientOptions | The options object to allow call chaining. |