Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/Turnierplan.Adapter/TurnierplanClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,18 @@ public TurnierplanClient(TurnierplanClientOptions options)
/// Fetches a single tournament from the API and returns the deserialized <see cref="Tournament"/>.
/// </summary>
/// <param name="tournamentId">The ID of the tournament to request.</param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
/// <returns>An instance of the <see cref="Tournament"/> class which contains the data returned by the API.</returns>
/// <exception cref="TurnierplanClientException">
/// <list type="bullet">
/// <item>Thrown if the API returns a non-200 status code or if the response body can not be deserialized.</item>
/// <item>Thrown if the version of the server does not match the version of the <c>Turnierplan.Adapter</c> library.</item>
/// </list>
/// </exception>
public async Task<Tournament> GetTournament(string tournamentId)
public async Task<Tournament> GetTournament(string tournamentId, CancellationToken cancellationToken = default)
{
var request = new HttpRequestMessage(HttpMethod.Get, $"/api/tournaments/{tournamentId}");
var response = await _httpClient.SendAsync(request).ConfigureAwait(false);
var response = await _httpClient.SendAsync(request, cancellationToken).ConfigureAwait(false);

EnsureSuccessResponse(response);
VerifyServerVersion(response);
Expand All @@ -87,18 +88,19 @@ public async Task<Tournament> GetTournament(string tournamentId)
/// <c>0..n</c> entries of the type <see cref="TournamentHeader"/>.
/// </summary>
/// <param name="folderId">The ID of the folder to request.</param>
/// <param name="cancellationToken">The cancellation token to cancel operation.</param>
/// <returns>A list of <see cref="TournamentHeader"/> instances which contains the data returned by the API.</returns>
/// <exception cref="TurnierplanClientException">
/// <list type="bullet">
/// <item>Thrown if the API returns a non-200 status code or if the response body can not be deserialized.</item>
/// <item>Thrown if the version of the server does not match the version of the <c>Turnierplan.Adapter</c> library.</item>
/// </list>
/// </exception>
public async Task<List<TournamentHeader>> GetTournaments(string folderId)
public async Task<List<TournamentHeader>> GetTournaments(string folderId, CancellationToken cancellationToken = default)
{
var query = new QueryBuilder { { "folderId", folderId } };
var request = new HttpRequestMessage(HttpMethod.Get, $"/api/tournaments{query}");
var response = await _httpClient.SendAsync(request).ConfigureAwait(false);
var response = await _httpClient.SendAsync(request, cancellationToken).ConfigureAwait(false);

EnsureSuccessResponse(response);
VerifyServerVersion(response);
Expand Down
Loading