diff --git a/SpotifyAPI.Web/Clients/Interfaces/ISpotifyClient.cs b/SpotifyAPI.Web/Clients/Interfaces/ISpotifyClient.cs index ed5d267e..29b78400 100644 --- a/SpotifyAPI.Web/Clients/Interfaces/ISpotifyClient.cs +++ b/SpotifyAPI.Web/Clients/Interfaces/ISpotifyClient.cs @@ -120,13 +120,15 @@ namespace SpotifyAPI.Web /// A first page, will be included in the output list! /// A function which maps response objects to the next paging object /// Optional. If not supplied, DefaultPaginator will be used + /// The cancellation-token to allow to cancel the request. /// The Paging-Type /// The Response-Type /// A list containing all fetched pages Task> PaginateAll( IPaginatable firstPage, Func> mapper, - IPaginator? paginator = default! + IPaginator? paginator = default!, + CancellationToken cancellationToken = default! ); /// @@ -142,7 +144,7 @@ namespace SpotifyAPI.Web IAsyncEnumerable Paginate( IPaginatable firstPage, IPaginator? paginator = default!, - CancellationToken cancel = default! + CancellationToken cancel = default ); /// diff --git a/SpotifyAPI.Web/Clients/SpotifyClient.cs b/SpotifyAPI.Web/Clients/SpotifyClient.cs index 93c8b54d..24fdfe3f 100644 --- a/SpotifyAPI.Web/Clients/SpotifyClient.cs +++ b/SpotifyAPI.Web/Clients/SpotifyClient.cs @@ -109,16 +109,18 @@ namespace SpotifyAPI.Web /// A first page, will be included in the output list! /// A function which maps response objects to the next paging object /// Optional. If not supplied, DefaultPaginator will be used + /// The cancellation-token to allow to cancel the request. /// The Paging-Type /// The Response-Type /// A list containing all fetched pages public Task> PaginateAll( IPaginatable firstPage, Func> mapper, - IPaginator? paginator = null + IPaginator? paginator = null, + CancellationToken cancellationToken = default ) { - return (paginator ?? DefaultPaginator).PaginateAll(firstPage, mapper, _apiConnector); + return (paginator ?? DefaultPaginator).PaginateAll(firstPage, mapper, _apiConnector, cancellationToken); } private Task FetchPage(string? nextUrl)