Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cancellation token in SpotifyClient::PaginateAll for passing to Paginator #907

Merged
merged 2 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion SpotifyAPI.Web/Clients/Interfaces/ISpotifyClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ public interface ISpotifyClient
/// </summary>
/// <param name="firstPage">The first page, will be included in the output list!</param>
/// <param name="paginator">Optional. If not supplied, DefaultPaginator will be used</param>
/// <param name="cancellationToken">The cancellation-token to allow to cancel the request.</param>
/// <typeparam name="T">The Paging-Type</typeparam>
/// <returns>A list containing all fetched pages</returns>
Task<IList<T>> PaginateAll<T>(IPaginatable<T> firstPage, IPaginator? paginator = default!);
Task<IList<T>> PaginateAll<T>(IPaginatable<T> firstPage, IPaginator? paginator = default!, CancellationToken cancellationToken = default);

/// <summary>
/// Fetches all pages and returns them grouped in a list.
Expand Down
5 changes: 3 additions & 2 deletions SpotifyAPI.Web/Clients/SpotifyClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,12 @@ public SpotifyClient(SpotifyClientConfig config)
/// </summary>
/// <param name="firstPage">The first page, will be included in the output list!</param>
/// <param name="paginator">Optional. If not supplied, DefaultPaginator will be used</param>
/// <param name="cancellationToken">The cancellation-token to allow to cancel the request.</param>
/// <typeparam name="T">The Paging-Type</typeparam>
/// <returns>A list containing all fetched pages</returns>
public Task<IList<T>> PaginateAll<T>(IPaginatable<T> firstPage, IPaginator? paginator = null)
public Task<IList<T>> PaginateAll<T>(IPaginatable<T> firstPage, IPaginator? paginator = null, CancellationToken cancellationToken = default)
{
return (paginator ?? DefaultPaginator).PaginateAll(firstPage, _apiConnector);
return (paginator ?? DefaultPaginator).PaginateAll(firstPage, _apiConnector, cancellationToken);
}

/// <summary>
Expand Down
Loading