/// <summary> /// TODO /// </summary> /// <param name="word">検索する単語</param> /// <param name="sort">ソート順</param> /// <param name="searchTarget">検索対象</param> /// <param name="bookmarkMinNum">TODO</param> /// <param name="startDate">開始日時</param> /// <param name="endDate">終了日時</param> /// <param name="filter">フィルター (`for_ios` が有効)</param> /// <returns> /// <see cref="IEnumerable{BookmarkRange}" /> /// </returns> public async Task <IEnumerable <BookmarkRange> > NovelAsync(string word, SortOrder sort, SearchTarget searchTarget, string bookmarkMinNum = "", string startDate = "", string endDate = "", string filter = "") { Ensure.NotNullOrWhitespace(word, nameof(word)); var parameters = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("word", word), new KeyValuePair <string, string>("sort", sort.ToParameter()), new KeyValuePair <string, string>("search_target", searchTarget.ToParameter()) }; if (!string.IsNullOrWhiteSpace(bookmarkMinNum)) { parameters.Add(new KeyValuePair <string, string>("bookmark_min_num", bookmarkMinNum)); } if (!string.IsNullOrWhiteSpace(startDate)) { parameters.Add(new KeyValuePair <string, string>("start_date", startDate)); } if (!string.IsNullOrWhiteSpace(endDate)) { parameters.Add(new KeyValuePair <string, string>("end_date", endDate)); } if (!string.IsNullOrWhiteSpace(filter)) { parameters.Add(new KeyValuePair <string, string>("filter", filter)); } var response = await PixivClient.GetAsync("https://app-api.pixiv.net/v1/search/bookmark-ranges/novel", parameters).Stay(); return(response["bookmark_ranges"].ToObject <IEnumerable <BookmarkRange> >()); }
/// <summary> /// 指定された条件に従って小説の検索を行います。 /// </summary> /// <param name="word">検索ワード</param> /// <param name="searchTarget">検索対象</param> /// <param name="sort">ソート順</param> /// <param name="startDate">開始日時 (YYYY-MM-DD)</param> /// <param name="endDate">終了日時 (YYYY-MM-DD)</param> /// <param name="bookmarkNumMin">最小ブックマーク数</param> /// <param name="offset">オフセット</param> /// <returns> /// <see cref="NovelCollection" /> /// </returns> public async Task <NovelCollection> NovelAsync(string word, SearchTarget searchTarget, SortOrder sort, string startDate = "", string endDate = "", int bookmarkNumMin = 0, long offset = 0) { Ensure.NotNullOrWhitespace(word, nameof(word)); Ensure.InvalidEnumValue(searchTarget == SearchTarget.Keyword, nameof(searchTarget)); Ensure.InvalidEnumValue(searchTarget == SearchTarget.Text, nameof(searchTarget)); var parameters = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("word", word), new KeyValuePair <string, string>("search_target", searchTarget.ToParameter()), new KeyValuePair <string, string>("sort", sort.ToParameter()) }; if (!string.IsNullOrWhiteSpace(startDate)) { parameters.Add(new KeyValuePair <string, string>("start_date", startDate)); } if (!string.IsNullOrWhiteSpace(endDate)) { parameters.Add(new KeyValuePair <string, string>("end_date", endDate)); } if (bookmarkNumMin > 0) { parameters.Add(new KeyValuePair <string, string>("bookmark_num_min", bookmarkNumMin.ToString())); } if (offset > 0) { parameters.Add(new KeyValuePair <string, string>("offset", offset.ToString())); } return(await PixivClient.GetAsync <NovelCollection>("https://app-api.pixiv.net/v1/search/novel", parameters).Stay()); }