mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 14:46:26 +00:00
add cancellationToken to another override of PaginateAll
This commit is contained in:
parent
21d9a5ff16
commit
16d898b344
@ -120,13 +120,15 @@ namespace SpotifyAPI.Web
|
|||||||
/// <param name="firstPage">A first page, will be included in the output list!</param>
|
/// <param name="firstPage">A first page, will be included in the output list!</param>
|
||||||
/// <param name="mapper">A function which maps response objects to the next paging object</param>
|
/// <param name="mapper">A function which maps response objects to the next paging object</param>
|
||||||
/// <param name="paginator">Optional. If not supplied, DefaultPaginator will be used</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>
|
/// <typeparam name="T">The Paging-Type</typeparam>
|
||||||
/// <typeparam name="TNext">The Response-Type</typeparam>
|
/// <typeparam name="TNext">The Response-Type</typeparam>
|
||||||
/// <returns>A list containing all fetched pages</returns>
|
/// <returns>A list containing all fetched pages</returns>
|
||||||
Task<IList<T>> PaginateAll<T, TNext>(
|
Task<IList<T>> PaginateAll<T, TNext>(
|
||||||
IPaginatable<T, TNext> firstPage,
|
IPaginatable<T, TNext> firstPage,
|
||||||
Func<TNext, IPaginatable<T, TNext>> mapper,
|
Func<TNext, IPaginatable<T, TNext>> mapper,
|
||||||
IPaginator? paginator = default!
|
IPaginator? paginator = default!,
|
||||||
|
CancellationToken cancellationToken = default!
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -142,7 +144,7 @@ namespace SpotifyAPI.Web
|
|||||||
IAsyncEnumerable<T> Paginate<T>(
|
IAsyncEnumerable<T> Paginate<T>(
|
||||||
IPaginatable<T> firstPage,
|
IPaginatable<T> firstPage,
|
||||||
IPaginator? paginator = default!,
|
IPaginator? paginator = default!,
|
||||||
CancellationToken cancel = default!
|
CancellationToken cancel = default
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -109,16 +109,18 @@ namespace SpotifyAPI.Web
|
|||||||
/// <param name="firstPage">A first page, will be included in the output list!</param>
|
/// <param name="firstPage">A first page, will be included in the output list!</param>
|
||||||
/// <param name="mapper">A function which maps response objects to the next paging object</param>
|
/// <param name="mapper">A function which maps response objects to the next paging object</param>
|
||||||
/// <param name="paginator">Optional. If not supplied, DefaultPaginator will be used</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>
|
/// <typeparam name="T">The Paging-Type</typeparam>
|
||||||
/// <typeparam name="TNext">The Response-Type</typeparam>
|
/// <typeparam name="TNext">The Response-Type</typeparam>
|
||||||
/// <returns>A list containing all fetched pages</returns>
|
/// <returns>A list containing all fetched pages</returns>
|
||||||
public Task<IList<T>> PaginateAll<T, TNext>(
|
public Task<IList<T>> PaginateAll<T, TNext>(
|
||||||
IPaginatable<T, TNext> firstPage,
|
IPaginatable<T, TNext> firstPage,
|
||||||
Func<TNext, IPaginatable<T, TNext>> mapper,
|
Func<TNext, IPaginatable<T, TNext>> 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<T> FetchPage<T>(string? nextUrl)
|
private Task<T> FetchPage<T>(string? nextUrl)
|
||||||
|
Loading…
Reference in New Issue
Block a user