From 16d898b344af6a74d13ca1d1a5228a9244381b81 Mon Sep 17 00:00:00 2001 From: Jonas Dellinger Date: Fri, 3 Nov 2023 22:50:45 +0100 Subject: [PATCH] add cancellationToken to another override of PaginateAll --- SpotifyAPI.Web/Clients/Interfaces/ISpotifyClient.cs | 6 ++++-- SpotifyAPI.Web/Clients/SpotifyClient.cs | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) 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)