Exemplo n.º 1
0
        /// <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());
        }
Exemplo n.º 2
0
        /// <summary>
        ///     おすすめのイラスト一覧を取得します。
        /// </summary>
        /// <param name="includeRankingIllusts">ランキング上位のイラストをレスポンスに含むか</param>
        /// <param name="minBookmarkIdForRecentIllust">TODO</param>
        /// <param name="maxBookmarkIdForRecommend">TODO</param>
        /// <param name="offset">オフセット</param>
        /// <param name="filter">フィルター (`for_ios` が有効)</param>
        /// <returns>
        ///     <see cref="IllustCollection" />
        /// </returns>
        public async Task <IllustCollection> RecommendedAsync(bool includeRankingIllusts     = false, long minBookmarkIdForRecentIllust = 0,
                                                              long maxBookmarkIdForRecommend = 0, long offset = 0, string filter = "")
        {
            var parameters = new List <KeyValuePair <string, string> >();

            if (includeRankingIllusts)
            {
                parameters.Add(new KeyValuePair <string, string>("include_ranking_illusts", "true"));
            }
            if (minBookmarkIdForRecentIllust > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("min_bookmark_id_for_recent_illusts", minBookmarkIdForRecentIllust.ToString()));
            }
            if (maxBookmarkIdForRecommend > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("max_bookmark_id_for_recent_illust", maxBookmarkIdForRecommend.ToString()));
            }
            if (offset > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("offset", offset.ToString()));
            }
            if (!string.IsNullOrWhiteSpace(filter))
            {
                parameters.Add(new KeyValuePair <string, string>("offset", offset.ToString()));
            }

            return(await PixivClient.GetAsync <IllustCollection>("https://app-api.pixiv.net/v1/illust/recommended", parameters).Stay());
        }
Exemplo n.º 3
0
        /// <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> >());
        }
Exemplo n.º 4
0
        /// <summary>
        ///     指定した公開制限のブックマークで、小説に対して付けたタグのリストを取得します。
        /// </summary>
        /// <param name="restrict">
        ///     公開制限
        /// </param>
        /// <returns>
        ///     <see cref="BookmarkTagCollection" />
        /// </returns>
        public async Task <BookmarkTagCollection> NovelAsync(Restrict restrict = Restrict.Public)
        {
            Ensure.InvalidEnumValue(restrict == Restrict.All, nameof(restrict));
            Ensure.InvalidEnumValue(restrict == Restrict.Mypixiv, nameof(restrict));

            var parameters = new List <KeyValuePair <string, string> > {
                new KeyValuePair <string, string>("restrict", restrict.ToParameter())
            };

            return(await PixivClient.GetAsync <BookmarkTagCollection>("https://app-api.pixiv.net/v1/user/bookmark-tags/novel", parameters).Stay());
        }
Exemplo n.º 5
0
        /// <summary>
        ///     マイピクユーザーの新着イラストを取得します。
        /// </summary>
        /// <param name="offset">オフセット</param>
        /// <returns>
        ///     <see cref="IllustCollection" />
        /// </returns>
        public async Task <IllustCollection> MypixivAsync(long offset = 0)
        {
            var parameters = new List <KeyValuePair <string, string> >();

            if (offset > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("offset", offset.ToString()));
            }

            return(await PixivClient.GetAsync <IllustCollection>("https://app-api.pixiv.net/v2/illust/mypixiv", parameters).Stay());
        }
Exemplo n.º 6
0
        /// <summary>
        ///     全ユーザーの投稿した新着小説を取得します。
        /// </summary>
        /// <param name="maxNovelId">最大小説 ID</param>
        /// <returns>
        ///     <see cref="NovelCollection" />
        /// </returns>
        public async Task <NovelCollection> NewAsync(long maxNovelId = 0)
        {
            var parameters = new List <KeyValuePair <string, string> >();

            if (maxNovelId > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("max_novel_id", maxNovelId.ToString()));
            }

            return(await PixivClient.GetAsync <NovelCollection>("https://app-api.pixiv.net/v1/novel/new", parameters).Stay());
        }
Exemplo n.º 7
0
        /// <summary>
        ///     小説の本文情報を取得します。
        /// </summary>
        /// <param name="novelId">小説 ID</param>
        /// <returns>
        ///     <see cref="NovelText" />
        /// </returns>
        public async Task <NovelText> TextAsync(long novelId)
        {
            Ensure.GreaterThanZero(novelId, nameof(novelId));

            var parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("novel_id", novelId.ToString())
            };

            return(await PixivClient.GetAsync <NovelText>("https://app-api.pixiv.net/v1/novel/text", parameters).Stay());
        }
Exemplo n.º 8
0
        /// <summary>
        ///     オートコンプリートようの文字列一覧を取得します。
        /// </summary>
        /// <param name="word">キーワード</param>
        /// <returns>
        ///     <see cref="IEnumerable{String}" />
        /// </returns>
        public async Task <IEnumerable <string> > AutocompleteAsync(string word)
        {
            Ensure.NotNullOrWhitespace(word, nameof(word));

            var parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("word", word)
            };

            var response = await PixivClient.GetAsync("https://app-api.pixiv.net/v1/search/autocomplete", parameters).Stay();

            return(response["search_auto_complete_keywords"].ToObject <IEnumerable <string> >());
        }
Exemplo n.º 9
0
        /// <summary>
        ///     小説のトレンドタグ一覧を取得します。
        /// </summary>
        /// <param name="filter">フィルター (`for_ios` が有効)</param>
        /// <returns>
        ///     <see cref="IEnumerable{TrendingTag}" />
        /// </returns>
        public async Task <IEnumerable <TrendingTag> > NovelAsync(string filter = "")
        {
            var parameters = new List <KeyValuePair <string, string> >();

            if (!string.IsNullOrWhiteSpace(filter))
            {
                parameters.Add(new KeyValuePair <string, string>("filter", filter));
            }

            var response = await PixivClient.GetAsync("https://app-api.pixiv.net/v1/trending-tags/novel", parameters).Stay();

            return(response["trending_tags"].ToObject <IEnumerable <TrendingTag> >());
        }
Exemplo n.º 10
0
        /// <summary>
        ///     指定したイラストに対してのブックマーク情報を取得します。
        /// </summary>
        /// <param name="illustId">イラスト ID</param>
        /// <returns>
        ///     <see cref="BookmarkDetail" />
        /// </returns>
        public async Task <BookmarkDetail> DetailAsync(long illustId)
        {
            Ensure.GreaterThanZero(illustId, nameof(illustId));

            var parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("illust_id", illustId.ToString())
            };

            var response = await PixivClient.GetAsync("https://app-api.pixiv.net/v2/illust/bookmark/detail", parameters).Stay();

            return(response["bookmark_detail"].ToObject <BookmarkDetail>());
        }
Exemplo n.º 11
0
        /// <summary>
        ///     生放送の一覧を取得します。
        /// </summary>
        /// <param name="type">取得する配信情報</param>
        /// <param name="offset">オフセット</param>
        /// <returns>
        ///     <see cref="LiveCollection" />
        /// </returns>
        public async Task <LiveCollection> ListAsync(ListType type, long offset = 0)
        {
            var parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("list_type", type.ToParameter())
            };

            if (offset > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("offset", offset.ToString()));
            }

            return(await PixivClient.GetAsync <LiveCollection>("https://app-api.pixiv.net/v1/live/list", parameters).Stay());
        }
Exemplo n.º 12
0
        /// <summary>
        ///     おすすめユーザーを取得します。
        /// </summary>
        /// <param name="offset">オフセット</param>
        /// <param name="filter">フィルター (`for_ios` が有効)</param>
        /// <returns>
        ///     <see cref="UserPreviewCollection" />
        /// </returns>
        public async Task <UserPreviewCollection> RecommendedAsync(long offset = 0, string filter = "")
        {
            var parameters = new List <KeyValuePair <string, string> >();

            if (offset > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("offset", offset.ToString()));
            }
            if (!string.IsNullOrWhiteSpace(filter))
            {
                parameters.Add(new KeyValuePair <string, string>("filter", filter));
            }

            return(await PixivClient.GetAsync <UserPreviewCollection>("https://app-api.pixiv.net/v1/user/recommended", parameters).Stay());
        }
Exemplo n.º 13
0
        /// <summary>
        ///     フォローしているユーザーの新着イラストを取得します。
        /// </summary>
        /// <param name="restrict">公開制限</param>
        /// <param name="offset">オフセット</param>
        /// <returns>
        ///     <see cref="IllustCollection" />
        /// </returns>
        public async Task <IllustCollection> FollowAsync(Restrict restrict = Restrict.All, long offset = 0)
        {
            Ensure.InvalidEnumValue(restrict == Restrict.Mypixiv, nameof(restrict));

            var parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("restrict", restrict.ToParameter())
            };

            if (offset > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("offset", offset.ToString()));
            }

            return(await PixivClient.GetAsync <IllustCollection>("https://app-api.pixiv.net/v2/illust/follow", parameters).Stay());
        }
Exemplo n.º 14
0
        /// <summary>
        ///     指定したイラストのコメントを取得します。
        /// </summary>
        /// <param name="illustId">イラスト ID</param>
        /// <param name="lastCommentId">オフセット</param>
        /// <returns>
        ///     <see cref="CommentCollection" />
        /// </returns>
        public async Task <CommentCollection> CommentAsync(long illustId, long lastCommentId = 0)
        {
            Ensure.GreaterThanZero(illustId, nameof(illustId));

            var parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("illust_id", illustId.ToString())
            };

            if (lastCommentId > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("last_illust_id", lastCommentId.ToString()));
            }

            return(await PixivClient.GetAsync <CommentCollection>("https://app-api.pixiv.net/v2/illust/comments", parameters).Stay());
        }
Exemplo n.º 15
0
        /// <summary>
        ///     指定したユーザーの詳細情報を取得します。
        /// </summary>
        /// <param name="userId">ユーザー ID</param>
        /// <param name="filter">フィルター (`for_ios` が有効)</param>
        /// <returns>
        ///     <see cref="UserDetail" />
        /// </returns>
        public async Task <UserDetail> DetailAsync(long userId, string filter = "")
        {
            Ensure.GreaterThanZero(userId, nameof(userId));

            var parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("user_id", userId.ToString())
            };

            if (!string.IsNullOrWhiteSpace(filter))
            {
                parameters.Add(new KeyValuePair <string, string>("filter", filter));
            }

            return(await PixivClient.GetAsync <UserDetail>("https://app-api.pixiv.net/v1/user/detail", parameters).Stay());
        }
Exemplo n.º 16
0
        /// <summary>
        ///     シリーズについての情報を取得します。
        /// </summary>
        /// <param name="illustId">イラスト ID</param>
        /// <param name="filter">フィルター (`for_ios` が有効)</param>
        /// <returns>
        ///     <see cref="IllustSeries" />
        /// </returns>
        public async Task <IllustSeries> IllustAsync(long illustId, string filter = "")
        {
            Ensure.GreaterThanZero(illustId, nameof(illustId));

            var parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("illust_id", illustId.ToString())
            };

            if (!string.IsNullOrWhiteSpace(filter))
            {
                parameters.Add(new KeyValuePair <string, string>("filter", filter));
            }

            return(await PixivClient.GetAsync <IllustSeries>("https://app-api.pixiv.net/v1/illust-series/illust", parameters).Stay());
        }
Exemplo n.º 17
0
        /// <summary>
        ///     指定したコメント ID に対しての返信を取得します。
        /// </summary>
        /// <param name="commentId">コメント ID</param>
        /// <param name="offset" オフセット></param>
        /// <returns>
        ///     <see cref="CommentCollection" />
        /// </returns>
        public async Task <CommentCollection> RepliesAsync(long commentId, long offset = 0)
        {
            Ensure.GreaterThanZero(commentId, nameof(commentId));

            var parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("comment_id", commentId.ToString())
            };

            if (offset > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("offset", offset.ToString()));
            }

            return(await PixivClient.GetAsync <CommentCollection>("https://app-api.pixiv.net/v1/illust/comment/replies", parameters).Stay());
        }
Exemplo n.º 18
0
        /// <summary>
        ///     指定したイラストをブックマークしているユーザーを取得します。
        /// </summary>
        /// <param name="illustId">イラスト ID</param>
        /// <param name="offset">オフセット</param>
        /// <returns>
        ///     <see cref="UserCollection" />
        /// </returns>
        public async Task <UserCollection> UsersAsync(long illustId, long offset = 0)
        {
            Ensure.GreaterThanZero(illustId, nameof(illustId));

            var parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("illust_id", illustId.ToString())
            };

            if (offset > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("offset", offset.ToString()));
            }

            return(await PixivClient.GetAsync <UserCollection>("https://app-api.pixiv.net/v1/illust/bookmark/users", parameters).Stay());
        }
Exemplo n.º 19
0
        /// <summary>
        ///     指定したユーザーの小説を取得します。
        /// </summary>
        /// <param name="userId">ユーザー ID</param>
        /// <param name="offset">オフセット</param>
        /// <returns>
        ///     <see cref="NovelCollection" />
        /// </returns>
        public async Task <NovelCollection> NovelsAsync(long userId, long offset = 0)
        {
            Ensure.GreaterThanZero(userId, nameof(userId));

            var parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("user_id", userId.ToString())
            };

            if (offset > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("offset", offset.ToString()));
            }

            return(await PixivClient.GetAsync <NovelCollection>("https://app-api.pixiv.net/v1/user/novels", parameters).Stay());
        }
Exemplo n.º 20
0
        /// <summary>
        ///     指定したカテゴリーの Pixivision (旧 pixiv Spotlight) の記事一覧を取得します。
        /// </summary>
        /// <param name="category">カテゴリー</param>
        /// <param name="offset">オフセット</param>
        /// <param name="filter">フィルター (`for_ios` が有効)</param>
        /// <returns>
        ///     <see cref="SpotlightArticleCollection" />
        /// </returns>
        public async Task <SpotlightArticleCollection> ArticlesAsync(string category = "all", long offset = 0, string filter = "")
        {
            var parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("category", category)
            };

            if (offset > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("offset", offset.ToString()));
            }
            if (!string.IsNullOrWhiteSpace(filter))
            {
                parameters.Add(new KeyValuePair <string, string>("filter", filter));
            }

            return(await PixivClient.GetAsync <SpotlightArticleCollection>("https://app-api.pixiv.net/v1/spotlight/article", parameters).Stay());
        }
Exemplo n.º 21
0
        /// <summary>
        ///     おすすめ小説を取得します。
        /// </summary>
        /// <param name="includeRankingNovels">ランキング上位の小説をレスポンスに含むか</param>
        /// <param name="maxBookmarkIdForRecommend">TODO</param>
        /// <param name="offset">オフセット</param>
        /// <returns>
        ///     <see cref="NovelCollection" />
        /// </returns>
        public async Task <NovelCollection> RecommendedAsync(bool includeRankingNovels = false, long maxBookmarkIdForRecommend = 0, long offset = 0)
        {
            var parameters = new List <KeyValuePair <string, string> >();

            if (includeRankingNovels)
            {
                parameters.Add(new KeyValuePair <string, string>("include_ranking_novels", "true"));
            }
            if (maxBookmarkIdForRecommend > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("max_bookmark_id_for_recommend", maxBookmarkIdForRecommend.ToString()));
            }
            if (offset > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("offset", offset.ToString()));
            }

            return(await PixivClient.GetAsync <NovelCollection>("https://app-api.pixiv.net/v1/novel/recommend", parameters).Stay());
        }
Exemplo n.º 22
0
        /// <summary>
        ///     おすすめのマンガ一覧を取得します。
        /// </summary>
        /// <param name="bookmarkIllustIds">TODO</param>
        /// <param name="includeRankingIllusts">ランキング上位のイラストをレスポンスに含むか</param>
        /// <param name="filter">フィルター (`for_ios` が有効)</param>
        /// <returns>
        ///     <see cref="IllustCollection" />
        /// </returns>
        public async Task <IllustCollection> RecommendedAsync(List <long> bookmarkIllustIds = null, bool includeRankingIllusts = false, string filter = "")
        {
            var parameters = new List <KeyValuePair <string, string> >();

            if (bookmarkIllustIds != null)
            {
                parameters.Add(new KeyValuePair <string, string>("bookmark_illust_ids", string.Join(",", bookmarkIllustIds)));
            }
            if (includeRankingIllusts)
            {
                parameters.Add(new KeyValuePair <string, string>("include_ranking_illusts", true.ToString()));
            }
            if (!string.IsNullOrWhiteSpace(filter))
            {
                parameters.Add(new KeyValuePair <string, string>("filter", filter));
            }

            return(await PixivClient.GetAsync <IllustCollection>("https://app-api.pixiv.net/v1/manga/recommended", parameters).Stay());
        }
Exemplo n.º 23
0
        /// <summary>
        ///     指定したユーザーの小説ブックマークを取得します。
        /// </summary>
        /// <param name="userId">ユーザー ID</param>
        /// <param name="restrict">公開制限 (自分以外は Public のみ取得可能)</param>
        /// <param name="tag">絞り込みタグ (自分に対してのみ使用可能)</param>
        /// <returns>
        ///     <see cref="NovelCollection" />
        /// </returns>
        public async Task <NovelCollection> NovelAsync(long userId, Restrict restrict = Restrict.Public, string tag = null)
        {
            Ensure.GreaterThanZero(userId, nameof(userId));
            Ensure.InvalidEnumValue(restrict == Restrict.All, nameof(restrict));
            Ensure.InvalidEnumValue(restrict == Restrict.Mypixiv, nameof(restrict));

            var parameter = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("user_id", userId.ToString()),
                new KeyValuePair <string, string>("restrict", restrict.ToParameter())
            };

            if (!string.IsNullOrWhiteSpace(tag))
            {
                parameter.Add(new KeyValuePair <string, string>("tag", tag));
            }

            return(await PixivClient.GetAsync <NovelCollection>("https://app-api.pixiv.net/v1/user/bookmarks/novel", parameter).Stay());
        }
Exemplo n.º 24
0
        /// <summary>
        ///     新着イラストを取得します。
        /// </summary>
        /// <param name="contentType">イラストの種類</param>
        /// <param name="maxIllustId">最大イラスト ID</param>
        /// <param name="filter">フィルター (`for_ios` が有効)</param>
        /// <returns>
        ///     <see cref="IllustCollection" />
        /// </returns>
        public async Task <IllustCollection> NewAsync(IllustType contentType, long maxIllustId = 0, string filter = "")
        {
            Ensure.InvalidEnumValue(contentType == IllustType.Ugoira, nameof(contentType));

            var parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("content_type", contentType.ToParameter())
            };

            if (maxIllustId > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("max_illust_id", maxIllustId.ToString()));
            }
            if (!string.IsNullOrWhiteSpace(filter))
            {
                parameters.Add(new KeyValuePair <string, string>("filter", filter));
            }

            return(await PixivClient.GetAsync <IllustCollection>("https://app-api.pixiv.net/v1/illust/new", parameters).Stay());
        }
Exemplo n.º 25
0
        /// <summary>
        ///     ユーザーを検索します。
        /// </summary>
        /// <param name="word">検索ワード</param>
        /// <param name="offset">オフセット</param>
        /// <param name="filter">フィルター (`for_ios` が有効)</param>
        /// <returns>
        ///     <see cref="UserPreviewCollection" />
        /// </returns>
        public async Task <UserPreviewCollection> UserAsync(string word, long offset = 0, string filter = "")
        {
            Ensure.NotNullOrWhitespace(word, nameof(word));

            var parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("word", word)
            };

            if (offset > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("offset", offset.ToString()));
            }
            if (!string.IsNullOrWhiteSpace(filter))
            {
                parameters.Add(new KeyValuePair <string, string>("filter", filter));
            }

            return(await PixivClient.GetAsync <UserPreviewCollection>("https://app-api.pixiv.net/v1/search/user", parameters).Stay());
        }
Exemplo n.º 26
0
        /// <summary>
        ///     指定したイラストに関連するイラストを取得します。
        /// </summary>
        /// <param name="illustId">イラスト ID</param>
        /// <param name="seedIllustIds">元となるイラスト ID</param>
        /// <param name="filter">フィルター (`for_ios` が有効)</param>
        /// <returns>
        ///     <see cref="IllustSeriesCollection" />
        /// </returns>
        public async Task <IllustCollection> RelatedAsync(long illustId, long[] seedIllustIds = null, string filter = "")
        {
            Ensure.GreaterThanZero(illustId, nameof(illustId));

            var parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("illust_id", illustId.ToString())
            };

            if (seedIllustIds?.Length > 0)
            {
                parameters.AddRange(seedIllustIds.Select(seedIllustId => new KeyValuePair <string, string>("seed_illust_ids[]", seedIllustId.ToString())));
            }
            if (!string.IsNullOrWhiteSpace(filter))
            {
                parameters.Add(new KeyValuePair <string, string>("filter", filter));
            }

            return(await PixivClient.GetAsync <IllustCollection>("https://app-api.pixiv.net/v1/illust/related", parameters).Stay());
        }
Exemplo n.º 27
0
        /// <summary>
        ///     指定したシリーズ ID の詳細を取得します。
        /// </summary>
        /// <param name="illustSeriesId">シリーズ ID</param>
        /// <param name="offset">オフセット</param>
        /// <param name="filter">フィルター (`for_ios` が有効)</param>
        /// <returns>
        ///     <see cref="IllustSeriesCollection" />
        /// </returns>
        public async Task <IllustSeriesCollection> SeriesAsync(long illustSeriesId, long offset = 0, string filter = "")
        {
            Ensure.GreaterThanZero(illustSeriesId, nameof(illustSeriesId));

            var parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("illust_series_id", illustSeriesId.ToString())
            };

            if (offset > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("offset", offset.ToString()));
            }
            if (!string.IsNullOrWhiteSpace(filter))
            {
                parameters.Add(new KeyValuePair <string, string>("offset", offset.ToString()));
            }

            return(await PixivClient.GetAsync <IllustSeriesCollection>("https://app-api.pixiv.net/v1/illust/series", parameters).Stay());
        }
Exemplo n.º 28
0
        /// <summary>
        ///     指定したユーザーのマイピクを取得します。
        /// </summary>
        /// <param name="userId">ユーザー ID</param>
        /// <param name="offset">オフセット</param>
        /// <param name="filter">フィルター (`for_ios` が有効)</param>
        /// <returns>
        ///     <see cref="UserPreviewCollection" />
        /// </returns>
        public async Task <UserPreviewCollection> MypixivAsync(long userId, long offset = 0, string filter = "")
        {
            Ensure.GreaterThanZero(userId, nameof(userId));

            var parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("user_id", userId.ToString())
            };

            if (offset > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("offset", offset.ToString()));
            }
            if (!string.IsNullOrWhiteSpace(filter))
            {
                parameters.Add(new KeyValuePair <string, string>("filter", filter));
            }

            return(await PixivClient.GetAsync <UserPreviewCollection>("https://app-api.pixiv.net/v1/user/mypixiv", parameters).Stay());
        }
Exemplo n.º 29
0
        /// <summary>
        ///     指定したユーザーが投稿したイラスト・マンガを取得します。
        /// </summary>
        /// <param name="userId">ユーザー ID</param>
        /// <param name="type">イラストもしくはマンガ</param>
        /// <param name="offset">オフセット</param>
        /// <param name="filter">フィルター (`for_ios` が有効)</param>
        /// <returns>
        ///     <see cref="IllustCollection" />
        /// </returns>
        public async Task <IllustCollection> IllustsAsync(long userId, IllustType type, long offset = 0, string filter = "")
        {
            Ensure.GreaterThanZero(userId, nameof(userId));
            Ensure.InvalidEnumValue(type == IllustType.Ugoira, nameof(type));

            var parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("user_id", userId.ToString()),
                new KeyValuePair <string, string>("type", type.ToParameter())
            };

            if (offset > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("offset", offset.ToString()));
            }
            if (!string.IsNullOrWhiteSpace(filter))
            {
                parameters.Add(new KeyValuePair <string, string>("filter", filter));
            }

            return(await PixivClient.GetAsync <IllustCollection>("https://app-api.pixiv.net/v1/user/illusts", parameters).Stay());
        }
Exemplo n.º 30
0
        /// <summary>
        ///     指定したユーザーがフォローしているユーザーを取得します。
        /// </summary>
        /// <param name="userId">ユーザー ID</param>
        /// <param name="restrict">公開制限</param>
        /// <param name="offset">オフセット</param>
        /// <param name="filter">フィルター (`for_ios` が有効)</param>
        /// <returns>
        ///     <see cref="UserPreviewCollection" />
        /// </returns>
        public async Task <UserPreviewCollection> FollowingAsync(long userId, Restrict restrict = Restrict.Public, long offset = 0, string filter = "")
        {
            Ensure.GreaterThanZero(userId, nameof(userId));
            Ensure.InvalidEnumValue(restrict == Restrict.Mypixiv, nameof(restrict));

            var parameters = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("user_id", userId.ToString()),
                new KeyValuePair <string, string>("restrict", restrict.ToParameter())
            };

            if (offset > 0)
            {
                parameters.Add(new KeyValuePair <string, string>("offset", offset.ToString()));
            }
            if (!string.IsNullOrWhiteSpace(filter))
            {
                parameters.Add(new KeyValuePair <string, string>("filter", filter));
            }

            return(await PixivClient.GetAsync <UserPreviewCollection>("https://app-api.pixiv.net/v1/user/following", parameters).Stay());
        }