using System.Threading;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using SpotifyAPI.Web.Http;
using SpotifyAPI.Web;
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
/// Paging Type
/// A list containing all pages, including the firstPage
Task> PaginateAll(IPaginatable firstPage, IAPIConnector connector);
///
/// 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
/// Paging Type
/// Outer response Type
/// A list containing all pages, including the firstPage
Task> PaginateAll(
IPaginatable firstPage,
Func> mapper,
IAPIConnector connector
);
#if NETSTANDARD2_1
///
/// 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 CancellationToken
/// 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 CancellationToken
/// Paging Type
/// Outer response Type
///
IAsyncEnumerable Paginate(
IPaginatable firstPage,
Func> mapper,
IAPIConnector connector,
CancellationToken cancel = default
);
#endif
}
}