Spotify.NET/SpotifyAPI.Web/Clients/ShowsClient.cs

50 lines
1.7 KiB
C#
Raw Normal View History

using System.Threading;
2020-05-02 21:48:21 +01:00
using System.Threading.Tasks;
using SpotifyAPI.Web.Http;
using URLs = SpotifyAPI.Web.SpotifyUrls;
namespace SpotifyAPI.Web
{
public class ShowsClient : APIClient, IShowsClient
{
public ShowsClient(IAPIConnector connector) : base(connector) { }
public Task<FullShow> Get(string showId, CancellationToken cancel = default)
2020-05-02 21:48:21 +01:00
{
Ensure.ArgumentNotNullOrEmptyString(showId, nameof(showId));
return API.Get<FullShow>(URLs.Show(showId), cancel);
2020-05-02 21:48:21 +01:00
}
public Task<FullShow> Get(string showId, ShowRequest request, CancellationToken cancel = default)
2020-05-02 21:48:21 +01:00
{
Ensure.ArgumentNotNullOrEmptyString(showId, nameof(showId));
Ensure.ArgumentNotNull(request, nameof(request));
return API.Get<FullShow>(URLs.Show(showId), request.BuildQueryParams(), cancel);
2020-05-02 21:48:21 +01:00
}
public Task<ShowsResponse> GetSeveral(ShowsRequest request, CancellationToken cancel = default)
2020-05-02 21:48:21 +01:00
{
Ensure.ArgumentNotNull(request, nameof(request));
return API.Get<ShowsResponse>(URLs.Shows(), request.BuildQueryParams(), cancel);
2020-05-02 21:48:21 +01:00
}
public Task<Paging<SimpleEpisode>> GetEpisodes(string showId, CancellationToken cancel = default)
2020-05-02 21:48:21 +01:00
{
Ensure.ArgumentNotNullOrEmptyString(showId, nameof(showId));
return API.Get<Paging<SimpleEpisode>>(URLs.ShowEpisodes(showId), cancel);
2020-05-02 21:48:21 +01:00
}
public Task<Paging<SimpleEpisode>> GetEpisodes(string showId, ShowEpisodesRequest request, CancellationToken cancel = default)
2020-05-02 21:48:21 +01:00
{
Ensure.ArgumentNotNullOrEmptyString(showId, nameof(showId));
Ensure.ArgumentNotNull(request, nameof(request));
return API.Get<Paging<SimpleEpisode>>(URLs.ShowEpisodes(showId), request.BuildQueryParams(), cancel);
2020-05-02 21:48:21 +01:00
}
}
}