Exemplo n.º 1
0
 public static Task <BookmarkTagsPage> GetUserBookmarkTagsAsync(this PixivClient client, Restrict restrict = Restrict.Public)
 {
     client.RequireAuth();
     return(client.GetAsync <BookmarkTagsPage>("/v1/user/bookmark-tags/illust", new HttpForm {
         { "restrict", restrict.GetSymbol() }
     }));
 }
Exemplo n.º 2
0
 // TODO support tag
 public static Task AddIllustBookmarkAsync(this PixivClient client, IllustID id, Restrict restrict = Restrict.Public)
 {
     client.RequireAuth();
     return(client.PostAsync("/v2/illust/bookmark/add", new HttpForm {
         { "illust_id", id }, { "restrict", restrict.GetSymbol() }
     }));
 }
Exemplo n.º 3
0
 public static Task <IllustsPage> GetFollowedUsersIllustAsync(this PixivClient client, Restrict restrict = Restrict.Public, int offset = 0)
 {
     client.RequireAuth();
     return(client.GetAsync <IllustsPage>("/v2/illust/follow", new HttpForm {
         { "restrict", restrict.GetSymbol() }, { "offset", offset.ToString() }
     }));
 }
Exemplo n.º 4
0
 public static Task DeleteIllustBookmarkAsync(this PixivClient client, IllustID id)
 {
     client.RequireAuth();
     return(client.PostAsync("/v1/illust/bookmark/delete", new HttpForm {
         { "illust_id", id }
     }));
 }
Exemplo n.º 5
0
 public static Task <T> GetNextPageAsync <T>(this PixivClient client, IPage <T> page) where T : IPage <T>
 {
     if (page.NextUrl == null)
     {
         throw new EndOfPageException();
     }
     return(client.GetNotStandardAPIAsync <T>(page.NextUrl));
 }
Exemplo n.º 6
0
 public static Task <CommentPage> GetIllustCommentsAsync(this PixivClient client, IllustID id, int offset = 0, bool includeTotalComments = true)
 {
     return(client.GetAsync <CommentPage>("/v1/illust/comments", new HttpForm
     {
         { "illust_id", id },
         { "offset", offset.ToString() },
         { "include_total_comments", includeTotalComments.ToString().ToLower() }
     }));
 }
Exemplo n.º 7
0
        public static Task <RecommendIllustsPage> GetIllustRecommendAsync(this PixivClient client, ContentType type = ContentType.Illust, bool includeRankingIllusts = true)
        {
            client.RequireAuth();
            var url = "/v1/illust/recommended";

            return(client.GetAsync <RecommendIllustsPage>(url, new HttpForm
            {
                { "content_type", type.GetSymbol() },
                { "include_ranking_illusts", includeRankingIllusts.ToString().ToLower() },
                { "include_ranking_label", "true" } // 我就是不给参数 你能奈我何?
            }));
        }
Exemplo n.º 8
0
        public static Task <IllustsPage> SearchIllustAsync(this PixivClient client, string word, SearchMode mode = SearchMode.PartialMatchTags, SortOptions sortOptions = SortOptions.DateDecreasing, SearchDuration?duration = default, int offset = 0)
        {
            var data = new HttpForm {
                { "word", word }, { "search_target", mode.GetSymbol() }, { "sort", sortOptions.GetSymbol() }, { "offset", offset.ToString() }
            };

            if (duration != null)
            {
                data.Add("duration", duration.GetSymbol());
            }

            return(client.GetAsync <IllustsPage>("/v1/search/illust"));
        }
Exemplo n.º 9
0
        public static Task <IllustsPage> GetIllustRankingAsync(this PixivClient client, RankMode mode = RankMode.Day, DateTime?date = default, int offset = 0)
        {
            var data = new HttpForm {
                { "offset", offset.ToString() }, { "mode", mode.GetSymbol() }
            };

            if (date != null)
            {
                data.Add("date", date.Value.ToString("yyyy-MM-dd"));
            }

            return(client.GetAsync <IllustsPage>("/v1/illust/ranking", data));
        }
Exemplo n.º 10
0
        // 这里我不写泛型是因为有的东西(如推荐) 一直翻页会瞬间爆炸
        public static async Task <Illust[]> GetAllIllusts(this PixivClient client, IllustsPage page)
        {
            var result      = new List <Illust>(page.Illusts);
            var currentPage = page;

            var count = 0;

            while (currentPage.NextUrl != null)
            {
                var fetchedPage = await client.GetNextPageAsync(currentPage);

                result.AddRange(fetchedPage.Illusts);
                currentPage = fetchedPage;
                Trace.WriteLine($"fetched page: {++count*30}");
            }

            return(result.ToArray());
        }
Exemplo n.º 11
0
 public static Task <UgoiraData> GetUgoiraMetadataAsync(this PixivClient client, IllustID id)
 {
     return(client.GetAsync <UgoiraData>("/v1/ugoira/metadata", new HttpForm {
         { "illust_id", id }
     }));
 }
Exemplo n.º 12
0
 public static Task <BookmarkDetail> GetIllustBookmarkDetailAsync(this PixivClient client, IllustID id)
 {
     return(client.GetAsync <BookmarkDetail>("/v2/illust/bookmark/detail", new HttpForm {
         { "illust_id", id }
     }));
 }
Exemplo n.º 13
0
 public static Task <IllustData> GetIllustDetailAsync(this PixivClient client, IllustID id)
 {
     return(client.GetAsync <IllustData>("/v1/illust/detail", new HttpForm {
         { "illust_id", id }
     }));
 }
Exemplo n.º 14
0
 public static Task <TrendTags> GetTrendingTagsAsync(this PixivClient client)
 {
     return(client.GetAsync <TrendTags>("/v1/trending-tags/illust"));
 }
Exemplo n.º 15
0
 public static Task <IllustsPage> GetUserBookmarksAsync(this PixivClient client, UserID id, Restrict restrict = Restrict.Public)
 {
     return(client.GetAsync <IllustsPage>("/v1/user/bookmarks/illust", new HttpForm {
         { "user_id", id }, { "restrict", restrict.GetSymbol() }
     }));
 }
Exemplo n.º 16
0
 public static Task <IllustsPage> GetUserIllustsAsync(this PixivClient client, UserID id, int offset = 0)
 {
     return(client.GetAsync <IllustsPage>("/v1/user/illusts", new HttpForm {
         { "user_id", id }, { "offset", offset.ToString() }
     }));
 }
Exemplo n.º 17
0
 public static Task <IllustsPage> GetIllustRelatedAsync(this PixivClient client, IllustID id)
 {
     return(client.GetAsync <IllustsPage>("/v2/illust/related", new HttpForm {
         { "user_id", id }
     }));
 }
Exemplo n.º 18
0
 public static Task <UserFollowPage> GetUserFollowersAsync(this PixivClient client, UserID id, Restrict restrict = Restrict.Public)
 {
     return(client.GetAsync <UserFollowPage>("/v1/user/follower", new HttpForm {
         { "user_id", id }, { "restrict", restrict.GetSymbol() }
     }));
 }
Exemplo n.º 19
0
 public static Task <UserDetail> GetUserDetailAsync(this PixivClient client, UserID id)
 {
     return(client.GetAsync <UserDetail>("/v1/user/detail", new HttpForm {
         { "user_id", id }
     }));
 }
Exemplo n.º 20
0
 public async static Task <ShowcaseData[]> GetShowcaseDataAsync(this PixivClient client, long articleId)
 {
     return((await client.GetNotStandardAPIAsync <你不需要管这是啥玩意啊你只需要调用下面的Body>($"https://www.pixiv.net/ajax/showcase/article?article_id={articleId}")).Body);
 }
Exemplo n.º 21
0
 public static Task <Illust[]> GetAllBookmarksAsync(this PixivClient client, UserID id)
 {
 }