mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-24 15:06:26 +00:00
b8a2190168
* feat: implements markets API * fix: use correct constructor name * feat: allow to pass a cancellation token * pass cancellation token * pass cancellation token only >NETSTANDARD2_1 Co-authored-by: Jonas Dellinger <jonas@dellinger.dev>
50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
using System.Threading;
|
|
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)
|
|
{
|
|
Ensure.ArgumentNotNullOrEmptyString(showId, nameof(showId));
|
|
|
|
return API.Get<FullShow>(URLs.Show(showId), cancel);
|
|
}
|
|
|
|
public Task<FullShow> Get(string showId, ShowRequest request, CancellationToken cancel = default)
|
|
{
|
|
Ensure.ArgumentNotNullOrEmptyString(showId, nameof(showId));
|
|
Ensure.ArgumentNotNull(request, nameof(request));
|
|
|
|
return API.Get<FullShow>(URLs.Show(showId), request.BuildQueryParams(), cancel);
|
|
}
|
|
|
|
public Task<ShowsResponse> GetSeveral(ShowsRequest request, CancellationToken cancel = default)
|
|
{
|
|
Ensure.ArgumentNotNull(request, nameof(request));
|
|
|
|
return API.Get<ShowsResponse>(URLs.Shows(), request.BuildQueryParams(), cancel);
|
|
}
|
|
|
|
public Task<Paging<SimpleEpisode>> GetEpisodes(string showId, CancellationToken cancel = default)
|
|
{
|
|
Ensure.ArgumentNotNullOrEmptyString(showId, nameof(showId));
|
|
|
|
return API.Get<Paging<SimpleEpisode>>(URLs.ShowEpisodes(showId), cancel);
|
|
}
|
|
|
|
public Task<Paging<SimpleEpisode>> GetEpisodes(string showId, ShowEpisodesRequest request, CancellationToken cancel = default)
|
|
{
|
|
Ensure.ArgumentNotNullOrEmptyString(showId, nameof(showId));
|
|
Ensure.ArgumentNotNull(request, nameof(request));
|
|
|
|
return API.Get<Paging<SimpleEpisode>>(URLs.ShowEpisodes(showId), request.BuildQueryParams(), cancel);
|
|
}
|
|
}
|
|
}
|