/// <summary> /// <see cref="IRdioManager.GetTopCharts"/> /// </summary> public IEnumerable <IRdioObject> GetTopCharts(RdioType type, int start = 0, int count = 0, IEnumerable <string> extras = null) { var postData = new NameValueCollection { { "method", "getTopCharts" }, { "type", type.ToString() } }; if (start > 0) { postData.Add("start", start.ToString()); } if (count > 0) { postData.Add("count", count.ToString()); } if (extras != null && extras.Count() > 0) { postData.Add("extras", string.Join(",", extras)); } var result = MakeWebRequest(postData); switch (type) { case RdioType.Album: var albums = Deserialize(result, typeof(RdioResult <IList <RdioAlbum> >)); return(((RdioResult <IList <RdioAlbum> >)albums).Result); case RdioType.Artist: var artists = Deserialize(result, typeof(RdioResult <IList <RdioArtist> >)); return(((RdioResult <IList <RdioArtist> >)artists).Result); case RdioType.Track: var tracks = Deserialize(result, typeof(RdioResult <IList <RdioTrack> >)); return(((RdioResult <IList <RdioTrack> >)tracks).Result); case RdioType.Playlist: var playlists = Deserialize(result, typeof(RdioResult <IList <RdioPlaylist> >)); return(((RdioResult <IList <RdioPlaylist> >)playlists).Result); default: return(null); } }
/// <summary> /// <see cref="IRdioManager.GetHeavyRotation"/> /// </summary> public IEnumerable <IRdioObject> GetHeavyRotation(string user = null, RdioType type = RdioType.Album, bool friends = false, int limit = 0) { var postData = new NameValueCollection { { "method", "getHeavyRotation" }, { "type", type.ToString() } }; if (!string.IsNullOrEmpty(user)) { postData.Add("user", user); } if (friends) { postData.Add("friends", friends.ToString()); } if (limit > 0) { postData.Add("limit", limit.ToString()); } var result = MakeWebRequest(postData); switch (type) { case RdioType.Artist: var artists = Deserialize(result, typeof(RdioResult <IList <RdioArtist> >)); return(((RdioResult <IList <RdioArtist> >)artists).Result); case RdioType.Album: var albums = Deserialize(result, typeof(RdioResult <IList <RdioAlbum> >)); return(((RdioResult <IList <RdioAlbum> >)albums).Result); default: return(null); } }
/// <summary> /// <see cref="IRdioManager.GetTopCharts"/> /// </summary> public IEnumerable<IRdioObject> GetTopCharts(RdioType type, int start = 0, int count = 0, IEnumerable<string> extras = null) { var postData = new NameValueCollection { {"method", "getTopCharts"}, {"type", type.ToString()} }; if (start > 0) postData.Add("start", start.ToString()); if (count > 0) postData.Add("count", count.ToString()); if (extras != null && extras.Count() > 0) postData.Add("extras", string.Join(",", extras)); var result = MakeWebRequest(postData); switch (type) { case RdioType.Album: var albums = Deserialize(result, typeof(RdioResult<IList<RdioAlbum>>)); return ((RdioResult<IList<RdioAlbum>>)albums).Result; case RdioType.Artist: var artists = Deserialize(result, typeof(RdioResult<IList<RdioArtist>>)); return ((RdioResult<IList<RdioArtist>>)artists).Result; case RdioType.Track: var tracks = Deserialize(result, typeof(RdioResult<IList<RdioTrack>>)); return ((RdioResult<IList<RdioTrack>>)tracks).Result; case RdioType.Playlist: var playlists = Deserialize(result, typeof(RdioResult<IList<RdioPlaylist>>)); return ((RdioResult<IList<RdioPlaylist>>)playlists).Result; default: return null; } }
/// <summary> /// <see cref="IRdioManager.GetHeavyRotation"/> /// </summary> public IEnumerable<IRdioObject> GetHeavyRotation(string user = null, RdioType type = RdioType.Album, bool friends = false, int limit = 0) { var postData = new NameValueCollection { {"method", "getHeavyRotation"}, {"type", type.ToString()} }; if (!string.IsNullOrEmpty(user)) postData.Add("user", user); if (friends) postData.Add("friends", friends.ToString()); if (limit > 0) postData.Add("limit", limit.ToString()); var result = MakeWebRequest(postData); switch (type) { case RdioType.Artist: var artists = Deserialize(result, typeof(RdioResult<IList<RdioArtist>>)); return ((RdioResult<IList<RdioArtist>>)artists).Result; case RdioType.Album: var albums = Deserialize(result, typeof(RdioResult<IList<RdioAlbum>>)); return ((RdioResult<IList<RdioAlbum>>)albums).Result; default: return null; } }