/// <summary> /// <see cref="IRdioManager.Search"/> /// </summary> public RdioResultSet Search(string query, IEnumerable <RdioType> types, bool neverOr = true, IEnumerable <string> extras = null, int start = 0, int count = 0) { var postData = new NameValueCollection { { "method", "search" }, { "query", query }, { "types", string.Join(",", types) } }; if (!neverOr) { postData.Add("never_or", neverOr.ToString().ToLower()); } if (extras != null && extras.Count() > 0) { postData.Add("extras", string.Join(",", extras)); } if (start > 0) { postData.Add("start", start.ToString()); } if (count > 0) { postData.Add("count", count.ToString()); } var result = MakeWebRequest(postData); var deserialized = Deserialize(result, typeof(RdioResult <object>)); var results = (Dictionary <string, object>)((RdioResult <object>)deserialized).Result; var searchResults = new List <object>((object[])results["results"]); return(RdioFunctions.ConvertListToRdioResultSet(searchResults)); }
/// <summary> /// <see cref="IRdioManager.GetObjectFromUrl"/> /// </summary> public IRdioObject GetObjectFromUrl(string url) { var postData = new NameValueCollection { { "method", "getObjectFromUrl" }, { "url", url } }; var result = MakeWebRequest(postData); var deserialized = Deserialize(result, typeof(RdioResult <object>)); var results = (Dictionary <string, object>)((RdioResult <object>)deserialized).Result; return(RdioFunctions.ConvertDictionaryToRdioObject(results)); }
/// <summary> /// <see cref="IRdioManager.SearchSuggestions"/> /// </summary> public RdioResultSet SearchSuggestions(string query, IEnumerable <string> extras = null) { var postData = new NameValueCollection { { "method", "searchSuggestions" }, { "query", query } }; if (extras != null && extras.Count() > 0) { postData.Add("extras", string.Join(",", extras)); } var result = MakeWebRequest(postData); var deserialized = Deserialize(result, typeof(RdioResult <object>)); var results = new List <object>((object[])((RdioResult <object>)deserialized).Result); return(RdioFunctions.ConvertListToRdioResultSet(results)); }
/// <summary> /// <see cref="IRdioManager.Get(IEnumerable{string}, IEnumerable{string})"/> /// </summary> public RdioResultSet Get(IEnumerable <string> keys, IEnumerable <string> extras = null) { var postData = new NameValueCollection { { "method", "get" }, { "keys", string.Join(",", keys) } }; if (extras.Boolify()) { postData.Add("extras", string.Join(",", extras)); } var result = MakeWebRequest(postData); var deserialized = Deserialize(result, typeof(RdioResult <object>)); var results = ((RdioResult <object>)deserialized).Result as Dictionary <string, object>; return(results != null?RdioFunctions.ConvertDictionaryToRdioResultSet(results) : null); }
/// <summary> /// <see cref="IRdioManager.GetActivityStream"/> /// </summary> public RdioActivityStream GetActivityStream(string user, RdioScope scope = RdioScope.Friends, long lastId = 0) { var postData = new NameValueCollection { { "method", "getActivityStream" }, { "user", user }, { "scope", scope.ToString().ToLowerInvariant() } }; if (lastId.Boolify()) { postData.Add("last_id", lastId.ToString()); } var result = MakeWebRequest(postData); var deserialized = Deserialize(result, typeof(RdioResult <object>)); var results = ((RdioResult <object>)deserialized).Result as Dictionary <string, object>; return(results != null?RdioFunctions.ConvertDictionaryToRdioActivityStream(results) : null); }