From 8bde0643c4a9f391a53c2473b1a3e16bae34cd31 Mon Sep 17 00:00:00 2001 From: "Johnny @PC" Date: Tue, 24 May 2016 18:30:19 +0200 Subject: [PATCH] Added alternative way to get the next page --- SpotifyAPI/Web/SpotifyWebAPI.cs | 38 +++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/SpotifyAPI/Web/SpotifyWebAPI.cs b/SpotifyAPI/Web/SpotifyWebAPI.cs index c7902e7e..ad1b56b5 100644 --- a/SpotifyAPI/Web/SpotifyWebAPI.cs +++ b/SpotifyAPI/Web/SpotifyWebAPI.cs @@ -1767,32 +1767,52 @@ namespace SpotifyAPI.Web #region Util - public Paging GetNextPage(Paging paging) + public TOut GetNextPage(Paging paging) { if (!paging.HasNextPage()) throw new InvalidOperationException("This Paging-Object has no Next-Page"); - return DownloadData>(paging.Next); + return DownloadData(paging.Next); + } + + public Paging GetNextPage(Paging paging) + { + return GetNextPage, T>(paging); + } + + public async Task GetNextPageAsync(Paging paging) + { + if (!paging.HasNextPage()) + throw new InvalidOperationException("This Paging-Object has no Next-Page"); + return await DownloadDataAsync(paging.Next); } public async Task> GetNextPageAsync(Paging paging) { - if (!paging.HasNextPage()) - throw new InvalidOperationException("This Paging-Object has no Next-Page"); - return await DownloadDataAsync>(paging.Next); + return await GetNextPageAsync, T>(paging); + } + + public TOut GetPreviousPage(Paging paging) + { + if (!paging.HasPreviousPage()) + throw new InvalidOperationException("This Paging-Object has no Previous-Page"); + return DownloadData(paging.Previous); } public Paging GetPreviousPage(Paging paging) + { + return GetPreviousPage, T>(paging); + } + + public async Task GetPreviousPageAsync(Paging paging) { if (!paging.HasPreviousPage()) throw new InvalidOperationException("This Paging-Object has no Previous-Page"); - return DownloadData>(paging.Previous); + return await DownloadDataAsync(paging.Previous); } public async Task> GetPreviousPageAsync(Paging paging) { - if (!paging.HasPreviousPage()) - throw new InvalidOperationException("This Paging-Object has no Previous-Page"); - return await DownloadDataAsync>(paging.Previous); + return await GetPreviousPageAsync, T>(paging); } public T UploadData(string url, string uploadData, string method = "POST")