|
| 1 | +using System.Threading.Tasks; |
| 2 | +using SpotifyAPI.Web.Http; |
| 3 | +using URLs = SpotifyAPI.Web.SpotifyUrls; |
| 4 | + |
| 5 | +namespace SpotifyAPI.Web |
| 6 | +{ |
| 7 | + public class ShowsClient : APIClient, IShowsClient |
| 8 | + { |
| 9 | + public ShowsClient(IAPIConnector connector) : base(connector) { } |
| 10 | + |
| 11 | + public Task<FullShow> Get(string showId) |
| 12 | + { |
| 13 | + Ensure.ArgumentNotNullOrEmptyString(showId, nameof(showId)); |
| 14 | + |
| 15 | + return API.Get<FullShow>(URLs.Show(showId)); |
| 16 | + } |
| 17 | + |
| 18 | + public Task<FullShow> Get(string showId, ShowRequest request) |
| 19 | + { |
| 20 | + Ensure.ArgumentNotNullOrEmptyString(showId, nameof(showId)); |
| 21 | + Ensure.ArgumentNotNull(request, nameof(request)); |
| 22 | + |
| 23 | + return API.Get<FullShow>(URLs.Show(showId), request.BuildQueryParams()); |
| 24 | + } |
| 25 | + |
| 26 | + public Task<ShowsResponse> GetSeveral(ShowsRequest request) |
| 27 | + { |
| 28 | + Ensure.ArgumentNotNull(request, nameof(request)); |
| 29 | + |
| 30 | + return API.Get<ShowsResponse>(URLs.Shows(), request.BuildQueryParams()); |
| 31 | + } |
| 32 | + |
| 33 | + public Task<Paging<SimpleEpisode>> GetEpisodes(string showId) |
| 34 | + { |
| 35 | + Ensure.ArgumentNotNullOrEmptyString(showId, nameof(showId)); |
| 36 | + |
| 37 | + return API.Get<Paging<SimpleEpisode>>(URLs.ShowEpisodes(showId)); |
| 38 | + } |
| 39 | + |
| 40 | + public Task<Paging<SimpleEpisode>> GetEpisodes(string showId, ShowEpisodesRequest request) |
| 41 | + { |
| 42 | + Ensure.ArgumentNotNullOrEmptyString(showId, nameof(showId)); |
| 43 | + Ensure.ArgumentNotNull(request, nameof(request)); |
| 44 | + |
| 45 | + return API.Get<Paging<SimpleEpisode>>(URLs.ShowEpisodes(showId), request.BuildQueryParams()); |
| 46 | + } |
| 47 | + } |
| 48 | +} |
0 commit comments