using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using SpotifyAPI.Web;
using SpotifyAPI.Web.Http;
namespace SpotifyAPI.Web
{
///
/// A paginator allows to cycle through all resources of the spotify API
///
public interface IPaginator
{
///
/// Fetches all pages and returns them grouped in a list
///
/// The first page. Will be included in the result list!
/// An API Connector to make requests to spotify
/// The cancellation-token to allow to cancel the request.
/// Paging Type
/// A list containing all pages, including the firstPage
Task> PaginateAll(IPaginatable firstPage, IAPIConnector connector, CancellationToken cancel = default);
///
/// Fetches all pages and returns them grouped in a list.
/// Supports a mapping method which takes care of JSON mapping problems.
/// To give an example, the Search method always returns the paging objects nested in a key. The mapper functions
/// tells the paginate function where to find the actual paging object in the response.
///
/// The first page. Will be included in the result list!
/// A function which returns the actual paging object in another response object
/// An API Connector to make requests to spotify
/// The cancellation-token to allow to cancel the request.
/// Paging Type
/// Outer response Type
/// A list containing all pages, including the firstPage
Task> PaginateAll(
IPaginatable firstPage,
Func> mapper,
IAPIConnector connector,
CancellationToken cancel = default
);
#if NETSTANDARD2_1_OR_GREATER || NET5_0_OR_GREATER
///
/// Fetches all pages and returns one by one using IAsyncEnumerable
///
/// The first page. Will be included in the result list!
/// An API Connector to make requests to spotify
/// A cancel
/// Paging Type
///
IAsyncEnumerable Paginate(IPaginatable firstPage, IAPIConnector connector, CancellationToken cancel = default);
///
/// Fetches all pages and returns them grouped in a list.
/// Supports a mapping method which takes care of JSON mapping problems.
/// To give an example, the Search method always returns the paging objects nested in a key. The mapper functions
/// tells the paginate function where to find the actual paging object in the response.
///
/// The first page. Will be included in the result list!
/// A function which returns the actual paging object in another response object
/// An API Connector to make requests to spotify
/// A cancel
/// Paging Type
/// Outer response Type
///
IAsyncEnumerable Paginate(
IPaginatable firstPage,
Func> mapper,
IAPIConnector connector,
CancellationToken cancel = default
);
#endif
}
}