2022-11-18 11:30:09 +00:00
|
|
|
using System.Threading;
|
2020-05-11 17:43:52 +01:00
|
|
|
using System.Threading.Tasks;
|
|
|
|
using SpotifyAPI.Web.Http;
|
|
|
|
using URLs = SpotifyAPI.Web.SpotifyUrls;
|
|
|
|
|
|
|
|
namespace SpotifyAPI.Web
|
|
|
|
{
|
|
|
|
public class EpisodesClient : APIClient, IEpisodesClient
|
|
|
|
{
|
|
|
|
public EpisodesClient(IAPIConnector apiConnector) : base(apiConnector) { }
|
|
|
|
|
2022-11-18 11:30:09 +00:00
|
|
|
public Task<FullEpisode> Get(string episodeId, CancellationToken cancel = default)
|
2020-05-11 17:43:52 +01:00
|
|
|
{
|
|
|
|
Ensure.ArgumentNotNullOrEmptyString(episodeId, nameof(episodeId));
|
|
|
|
|
2022-11-18 11:30:09 +00:00
|
|
|
return API.Get<FullEpisode>(URLs.Episode(episodeId), cancel);
|
2020-05-11 17:43:52 +01:00
|
|
|
}
|
|
|
|
|
2022-11-18 11:30:09 +00:00
|
|
|
public Task<FullEpisode> Get(string episodeId, EpisodeRequest request, CancellationToken cancel = default)
|
2020-05-11 17:43:52 +01:00
|
|
|
{
|
|
|
|
Ensure.ArgumentNotNullOrEmptyString(episodeId, nameof(episodeId));
|
|
|
|
Ensure.ArgumentNotNull(request, nameof(request));
|
|
|
|
|
2022-11-18 11:30:09 +00:00
|
|
|
return API.Get<FullEpisode>(URLs.Episode(episodeId), request.BuildQueryParams(), cancel);
|
2020-05-11 17:43:52 +01:00
|
|
|
}
|
|
|
|
|
2022-11-18 11:30:09 +00:00
|
|
|
public Task<EpisodesResponse> GetSeveral(EpisodesRequest request, CancellationToken cancel = default)
|
2020-05-11 17:43:52 +01:00
|
|
|
{
|
|
|
|
Ensure.ArgumentNotNull(request, nameof(request));
|
|
|
|
|
2022-11-18 11:30:09 +00:00
|
|
|
return API.Get<EpisodesResponse>(URLs.Episodes(), request.BuildQueryParams(), cancel);
|
2020-05-11 17:43:52 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|