コード例 #1
0
ファイル: PixeeSharpAppApi.cs プロジェクト: jerwyk/PixeeSharp
        public async Task <PixivResult <PixivIllustration> > GetFollowIllutration(string restrict = "public", int offset = -1, bool requireAuth = true)
        {
            Uri url = new Uri(baseUrl + "/v2/illust/follow");
            PixivRequestContent query = new PixivRequestContent(("restrict", restrict));

            if (offset >= 0)
            {
                query.Add("offset", offset.ToString());
            }
            var resJson = await GetStringRequest(Method.GET, url, query : query, requireAuth : requireAuth).ConfigureAwait(false);

            return(PixivResult <PixivIllustration> .Parse(resJson, "illusts", this));
        }
コード例 #2
0
ファイル: PixeeSharpAppApi.cs プロジェクト: jerwyk/PixeeSharp
        /// <summary>
        /// Get the related illustrations for a specific illustration
        /// </summary>
        /// <param name="id">The id of the illustration</param>
        /// <param name="seedIllustIds">Not sure what this does</param>
        /// <returns>A PixivResult object that contains the related illustrations</returns>
        public async Task <PixivResult <PixivIllustration> > GetRelatedIllustration(string id, List <string> seedIllustIds = null, bool requireAuth = true)
        {
            Uri url = new Uri(baseUrl + "/v2/illust/related");
            PixivRequestContent query = new PixivRequestContent
                                        (
                ("illust_id", id),
                ("filter", Filter)
                                        );

            foreach (var seed in seedIllustIds ?? Enumerable.Empty <string>())
            {
                query.Add("seed_illust_ids[]", seed);
            }
            string resJson = await GetStringRequest(Method.GET, url, query : query, requireAuth : requireAuth).ConfigureAwait(false);

            return(PixivResult <PixivIllustration> .Parse(resJson, "illusts", this));
        }
コード例 #3
0
ファイル: PixeeSharpAppApi.cs プロジェクト: jerwyk/PixeeSharp
        /// <summary>
        /// Get the illustration that a user bookmarked
        /// </summary>
        /// <param name="id">The id of the user, if not specified it will be the current login user</param>
        /// <param name="restrict">The restriction type of the bookmarks: public, private</param>
        /// <param name="maxBookmarkId">The max bookmark id</param>
        /// <param name="tag">The tag of the bookmarks</param>
        /// <returns>A PixivResult object that contains the bookmarked illustrations</returns>
        public async Task <PixivResult <PixivIllustration> > GetUserBookmarksIllust(string id = null, string restrict = "public", string maxBookmarkId = null, string tag = null, bool requireAuth = true)
        {
            id = id ?? UserID;
            Uri url = new Uri(baseUrl + "/v1/user/bookmarks/illust");
            PixivRequestContent query = new PixivRequestContent
                                        (
                ("user_id", id),
                ("restrict", restrict),
                ("filter", Filter)
                                        );

            query.Add("max_bookmark_id", maxBookmarkId);
            query.Add("tag", tag);
            var resJson = await GetStringRequest(Method.GET, url, query : query, requireAuth : requireAuth).ConfigureAwait(false);

            return(PixivResult <PixivIllustration> .Parse(resJson, "illusts", this));
        }
コード例 #4
0
ファイル: PixeeSharpAppApi.cs プロジェクト: jerwyk/PixeeSharp
        /// <summary>
        /// Get the MyPixiv (friend) of a certain user
        /// </summary>
        /// <param name="id">The id of the user, if not specified it will be the current login user</param>
        /// <param name="restrict">The restriction of the MyPixiv</param>
        /// <param name="offset">The offset of the results</param>
        /// <returns>A PixivResult object that contains the user previews</returns>
        public async Task <PixivResult <PixivUserPreview> > GetUserMyPixiv(string id = null, string restrict = "public", int offset = -1, bool requireAuth = true)
        {
            id = id ?? UserID;
            Uri url = new Uri(baseUrl + "/v1/user/mypixiv");
            PixivRequestContent query = new PixivRequestContent
                                        (
                ("restrict", restrict),
                ("user_id", id)
                                        );

            if (offset >= 0)
            {
                query.Add("offset", offset.ToString());
            }
            var resJson = await GetStringRequest(Method.GET, url, query : query, requireAuth : requireAuth).ConfigureAwait(false);

            return(PixivResult <PixivUserPreview> .Parse(resJson, "user_previews", this));
        }
コード例 #5
0
ファイル: PixeeSharpAppApi.cs プロジェクト: jerwyk/PixeeSharp
        /// <summary>
        /// Get the illustrations on the pixiv ranking
        /// </summary>
        /// <param name="mode">The mode of the ranking: day, week, month, day_male, day_female, week_original, week_rookie, day_manga</param>
        /// <param name="date">The date of the ranking</param>
        /// <param name="offset">The offset of the result</param>
        /// <returns>A PixivResult object that contains the ranking illustrations</returns>
        public async Task <PixivResult <PixivIllustration> > GetIllustrationRanking(string mode = "day", DateTime?date = null, int offset = -1, bool requireAuth = true)
        {
            Uri url = new Uri(baseUrl + "/v1/illust/ranking");
            PixivRequestContent query = new PixivRequestContent
                                        (
                ("mode", mode),
                ("filter", Filter)
                                        );

            query.Add("date", date?.ToString("yyyy-MM-dd"));
            if (offset >= 0)
            {
                query.Add("offset", offset.ToString());
            }
            var resJson = await GetStringRequest(Method.GET, url, query : query, requireAuth : requireAuth).ConfigureAwait(false);

            return(PixivResult <PixivIllustration> .Parse(resJson, "illusts", this));
        }
コード例 #6
0
ファイル: PixeeSharpAppApi.cs プロジェクト: jerwyk/PixeeSharp
        /// <summary>
        /// Get the uploaded illustrations from a specific user
        /// </summary>
        /// <param name="id">The id of the user, if not specified it will get for the current login user/param>
        /// <param name="type">The type of the work to search for: illust, manga</param>
        /// <param name="offset">The offset of the result</param>
        /// <returns>A PixivResult object that contains the illustrations</returns>
        public async Task <PixivResult <PixivIllustration> > GetUserIllustrations(string id = null, string type = "illust", int offset = -1, bool requireAuth = true)
        {
            id = id ?? UserID;
            Uri url = new Uri(baseUrl + "/v1/user/illusts");
            PixivRequestContent query = new PixivRequestContent
                                        (
                ("user_id", id),
                ("filter", Filter)
                                        );

            query.Add("type", type);
            if (offset >= 0)
            {
                query.Add("offset", offset.ToString());
            }
            var resJson = await GetStringRequest(Method.GET, url, query : query, requireAuth : requireAuth).ConfigureAwait(false);

            return(PixivResult <PixivIllustration> .Parse(resJson, "illusts", this));
        }
コード例 #7
0
ファイル: PixeeSharpAppApi.cs プロジェクト: jerwyk/PixeeSharp
        /// <summary>
        /// Search for illustrations on pixiv
        /// </summary>
        /// <param name="word">The words to search</param>
        /// <param name="searchTarget">The mode to search with, the options are: partial_match_for_tags, exact_match_for_tags, title_and_caption</param>
        /// <param name="sort">The sorting order of the results, can be: date_desc, date_asc</param>
        /// <param name="duration">The search durations: within_last_day, within_last_week, within_last_month</param>
        /// <param name="offset">The offset of the search result</param>
        /// <returns>A PixivResult object that contains the searched illustration</returns>
        public async Task <PixivResult <PixivIllustration> > SearchIllustration(string word, string searchTarget = "partial_match_for_tags",
                                                                                string sort = "date_desc", string duration = null, int offset = -1, bool requireAuth = true)
        {
            Uri url = new Uri(baseUrl + "/v1/search/illust");
            PixivRequestContent query = new PixivRequestContent
                                        (
                ("word", word),
                ("search_target", searchTarget),
                ("sort", sort),
                ("filter", Filter)
                                        );

            query.Add("duration", duration);
            if (offset >= 0)
            {
                query.Add("offset", offset.ToString());
            }
            var resJson = await GetStringRequest(Method.GET, url, query : query, requireAuth : requireAuth).ConfigureAwait(false);

            return(PixivResult <PixivIllustration> .Parse(resJson, "illusts", this));
        }