Skip to content

Commit 8bde064

Browse files
committed
Added alternative way to get the next page
1 parent a4c76ec commit 8bde064

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

SpotifyAPI/Web/SpotifyWebAPI.cs

+28-8
Original file line numberDiff line numberDiff line change
@@ -1767,32 +1767,52 @@ public async Task<SeveralAudioFeatures> GetSeveralAudioFeaturesAsync(List<string
17671767

17681768
#region Util
17691769

1770-
public Paging<T> GetNextPage<T>(Paging<T> paging)
1770+
public TOut GetNextPage<TOut, TIn>(Paging<TIn> paging)
17711771
{
17721772
if (!paging.HasNextPage())
17731773
throw new InvalidOperationException("This Paging-Object has no Next-Page");
1774-
return DownloadData<Paging<T>>(paging.Next);
1774+
return DownloadData<TOut>(paging.Next);
17751775
}
17761776

1777-
public async Task<Paging<T>> GetNextPageAsync<T>(Paging<T> paging)
1777+
public Paging<T> GetNextPage<T>(Paging<T> paging)
1778+
{
1779+
return GetNextPage<Paging<T>, T>(paging);
1780+
}
1781+
1782+
public async Task<TOut> GetNextPageAsync<TOut, TIn>(Paging<TIn> paging)
17781783
{
17791784
if (!paging.HasNextPage())
17801785
throw new InvalidOperationException("This Paging-Object has no Next-Page");
1781-
return await DownloadDataAsync<Paging<T>>(paging.Next);
1786+
return await DownloadDataAsync<TOut>(paging.Next);
17821787
}
17831788

1784-
public Paging<T> GetPreviousPage<T>(Paging<T> paging)
1789+
public async Task<Paging<T>> GetNextPageAsync<T>(Paging<T> paging)
1790+
{
1791+
return await GetNextPageAsync<Paging<T>, T>(paging);
1792+
}
1793+
1794+
public TOut GetPreviousPage<TOut, TIn>(Paging<TIn> paging)
17851795
{
17861796
if (!paging.HasPreviousPage())
17871797
throw new InvalidOperationException("This Paging-Object has no Previous-Page");
1788-
return DownloadData<Paging<T>>(paging.Previous);
1798+
return DownloadData<TOut>(paging.Previous);
17891799
}
17901800

1791-
public async Task<Paging<T>> GetPreviousPageAsync<T>(Paging<T> paging)
1801+
public Paging<T> GetPreviousPage<T>(Paging<T> paging)
1802+
{
1803+
return GetPreviousPage<Paging<T>, T>(paging);
1804+
}
1805+
1806+
public async Task<TOut> GetPreviousPageAsync<TOut, TIn>(Paging<TIn> paging)
17921807
{
17931808
if (!paging.HasPreviousPage())
17941809
throw new InvalidOperationException("This Paging-Object has no Previous-Page");
1795-
return await DownloadDataAsync<Paging<T>>(paging.Previous);
1810+
return await DownloadDataAsync<TOut>(paging.Previous);
1811+
}
1812+
1813+
public async Task<Paging<T>> GetPreviousPageAsync<T>(Paging<T> paging)
1814+
{
1815+
return await GetPreviousPageAsync<Paging<T>, T>(paging);
17961816
}
17971817

17981818
public T UploadData<T>(string url, string uploadData, string method = "POST")

0 commit comments

Comments
 (0)