public static ConvertListToRdioResultSet ( IEnumerable | ||
results | IEnumerable | |
Résultat | RdioResultSet |
/// <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.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)); }