Пример #1
0
 /// <summary>
 /// Searches requests.
 /// If no arguments are specified then the most recent requests are shown.
 /// </summary>
 /// <param name="options">Object that inherits ISearchRequests.</param>
 /// <returns>JSON response deserialized into Requests object.</returns>
 public Requests GetRequests(ISearchRequests options)
 {
     var builder = new QueryBuilder("ajax.php?action=requests");
     builder.Append("tags_type", options.TagsType);
     builder.Append("show_filled", options.ShowFilled.ToString().ToLower());
     builder.Append("page", options.Page);
     builder.Append("tag", options.Tags);
     builder.Append("search", options.SearchTerm);
     var json = _http.RequestJson(this.RootWhatCDUri, builder.Query.ToString());
     return JsonConvert.DeserializeObject<Requests>(json, JsonSettings);
 }
Пример #2
0
        // TODO: Include options for filter_cat[], releases[], bitrates[], formats[], media[] - as used on requests.php
        /// <summary>
        /// Searches requests.
        /// If no arguments are specified then the most recent requests are shown.
        /// Known issue - artist array nested in an unnecessary array: https://what.cd/forums.php?action=viewthread&threadid=169787
        /// </summary>
        /// <param name="options">Object that inherits ISearchRequests.</param>
        /// <returns>Requests object.</returns>
        public Requests SearchRequests(ISearchRequests options)
        {
            StringBuilder Query = new StringBuilder();
            Query.Append("ajax.php?action=requests");
            if (options.Page > 0) Query.Append(string.Format("&page={0}", options.Page));
            if (!string.IsNullOrWhiteSpace(options.Tags)) Query.Append(string.Format("&tag={0}", options.Tags));
            Query.Append(string.Format("&tags_type={0}", options.TagType));
            if (!string.IsNullOrWhiteSpace(options.SearchTerm)) Query.Append(string.Format("&search={0}", options.SearchTerm));
            if (!string.IsNullOrWhiteSpace(options.Tags)) Query.Append(string.Format("&tags={0}", options.Tags));
            Query.Append(string.Format("&show_filled={0}", options.ShowFilled.ToString().ToLower()));

            string Json = RequestJson(this.RootWhatCDURI, Query.ToString());
            return JsonConvert.DeserializeObject<Requests>(Json);
        }