Skip to content

Commit 62f5347

Browse files
committed
Implement Current Season Lookup
Add the "/data/lookup/current_season" endpoint. Fixes: #255
1 parent 86c8a62 commit 62f5347

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

src/Aydsko.iRacingData/CompatibilitySuppressions.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@
103103
<Left>lib/netstandard2.0/Aydsko.iRacingData.dll</Left>
104104
<Right>lib/net8.0/Aydsko.iRacingData.dll</Right>
105105
</Suppression>
106+
<Suppression>
107+
<DiagnosticId>CP0006</DiagnosticId>
108+
<Target>M:Aydsko.iRacingData.IDataClient.GetCurrentSeasonLookupAsync(System.Threading.CancellationToken)</Target>
109+
<Left>lib/netstandard2.0/Aydsko.iRacingData.dll</Left>
110+
<Right>lib/netstandard2.0/Aydsko.iRacingData.dll</Right>
111+
<IsBaselineSuppression>true</IsBaselineSuppression>
112+
</Suppression>
106113
<Suppression>
107114
<DiagnosticId>CP0008</DiagnosticId>
108115
<Target>T:Aydsko.iRacingData.Common.EventType</Target>

src/Aydsko.iRacingData/DataClient.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,24 @@ public async Task<DataResponse<LeaguePointsSystems>> GetLeaguePointsSystemsAsync
221221
return response;
222222
}
223223

224+
/// <inheritdoc />
225+
public async Task<DataResponse<LookupGroup[]>> GetCurrentSeasonLookupAsync(CancellationToken cancellationToken = default)
226+
{
227+
logger.LogDebug("Get Current Season Lookup");
228+
using var activity = AydskoDataClientDiagnostics.ActivitySource.StartActivity("Get Current Season Lookup");
229+
230+
var currentSeasonLookupUrl = new Uri(apiBaseUrl, "/data/lookup/current_season");
231+
232+
var response = await apiClient.CreateResponseViaIntermediateResultAsync(currentSeasonLookupUrl,
233+
LinkResultContext.Default.LinkResult,
234+
infoLinkResult => (new Uri(infoLinkResult.Link), infoLinkResult.Expires),
235+
LookupGroupArrayContext.Default.LookupGroupArray,
236+
cancellationToken)
237+
.ConfigureAwait(false);
238+
239+
return response;
240+
}
241+
224242
/// <inheritdoc />
225243
public async Task<DataResponse<CustomerLeagueSessions>> GetCustomerLeagueSessionsAsync(bool mine = false, int? packageId = null, CancellationToken cancellationToken = default)
226244
{

src/Aydsko.iRacingData/IDataClient.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,14 @@ public interface IDataClient
231231
/// <exception cref="iRacingUnauthorizedResponseException">If the iRacing API returns a <c>401 Unauthorized</c> response.</exception>
232232
Task<DataResponse<LicenseLookup[]>> GetLicenseLookupsAsync(CancellationToken cancellationToken = default);
233233

234+
/// <summary>Returns two lookups giving information about the currently-running season. One lookup with the tag &quot;Quarter&quot; and one tagged &quot;Year&quot;.</summary>
235+
/// <param name="cancellationToken">A token to allow the operation to be cancelled.</param>
236+
/// <returns>A <see cref="DataResponse{TData}"/> containing an array of <see cref="LookupGroup"/> objects.</returns>
237+
/// <exception cref="InvalidOperationException">If the client is not currently authenticated.</exception>
238+
/// <exception cref="iRacingDataClientException">If there's a problem processing the result.</exception>
239+
/// <exception cref="iRacingUnauthorizedResponseException">If the iRacing API returns a <c>401 Unauthorized</c> response.</exception>
240+
Task<DataResponse<LookupGroup[]>> GetCurrentSeasonLookupAsync(CancellationToken cancellationToken = default);
241+
234242
/// <summary>Information about reference data defined by the system.</summary>
235243
/// <param name="cancellationToken">A token to allow the operation to be cancelled.</param>
236244
/// <returns>A <see cref="DataResponse{TData}"/> containing an array of <see cref="LookupGroup"/> objects.</returns>

src/Aydsko.iRacingData/Package Release Notes.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
============================
2+
Release Notes for 2601.2.0
3+
============================
4+
5+
FIXES / NEW IMPLEMENTATIONS:
6+
- Implement Current Season Lookup (Issue #255)
7+
18
============================
29
Release Notes for 2601.1.0
310
============================

0 commit comments

Comments
 (0)