From 7fac01fd0b981209e748291f69613b48f23e15b3 Mon Sep 17 00:00:00 2001 From: FirmianaMarsili <804112469@qq.com> Date: Wed, 9 Jun 2021 22:16:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E8=BF=94=E5=9B=9E=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=9A=84=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Http/PicacomicUrl.cs | 117 +++++++------- Http/Response/AddFavourite.cs | 12 ++ Http/Response/AdvancedSearch.cs | 75 +++++++++ Http/Response/CategoriesSearch.cs | 72 +++++++++ Http/Response/EverybodyLoves.cs | 63 ++++++++ Http/Response/Favourite.cs | 76 ++++++++++ Http/Response/{Category.cs => GetCategory.cs} | 18 +-- Http/Response/{Chat.cs => GetChat.cs} | 2 +- Http/Response/GetCollections.cs | 56 +++++++ Http/Response/GetComicsBook.cs | 125 +++++++++++++++ Http/Response/GetComicsBookEps.cs | 47 ++++++ Http/Response/GetComicsBookOrder.cs | 57 +++++++ Http/Response/GetComments.cs | 143 ++++++++++++++++++ Http/Response/GetCommentsChildren.cs | 40 +++++ Http/Response/GetKeywords.cs | 11 ++ .../{MyComments.cs => GetMyComments.cs} | 14 +- Http/Response/{Platform.cs => GetPlatform.cs} | 4 +- Http/Response/GetRandom.cs | 46 ++++++ Http/Response/LikeComment.cs | 12 ++ Http/Response/Rank.cs | 51 +++++++ Http/Response/Recommendation.cs | 15 ++ Http/Response/Search.cs | 71 +++++++++ Http/Response/SendComment.cs | 15 ++ Http/Response/User.cs | 2 +- Program.cs | 15 +- 25 files changed, 1062 insertions(+), 97 deletions(-) create mode 100644 Http/Response/AddFavourite.cs create mode 100644 Http/Response/AdvancedSearch.cs create mode 100644 Http/Response/CategoriesSearch.cs create mode 100644 Http/Response/EverybodyLoves.cs create mode 100644 Http/Response/Favourite.cs rename Http/Response/{Category.cs => GetCategory.cs} (70%) rename Http/Response/{Chat.cs => GetChat.cs} (95%) create mode 100644 Http/Response/GetCollections.cs create mode 100644 Http/Response/GetComicsBook.cs create mode 100644 Http/Response/GetComicsBookEps.cs create mode 100644 Http/Response/GetComicsBookOrder.cs create mode 100644 Http/Response/GetComments.cs create mode 100644 Http/Response/GetCommentsChildren.cs create mode 100644 Http/Response/GetKeywords.cs rename Http/Response/{MyComments.cs => GetMyComments.cs} (82%) rename Http/Response/{Platform.cs => GetPlatform.cs} (95%) create mode 100644 Http/Response/GetRandom.cs create mode 100644 Http/Response/LikeComment.cs create mode 100644 Http/Response/Rank.cs create mode 100644 Http/Response/Recommendation.cs create mode 100644 Http/Response/Search.cs create mode 100644 Http/Response/SendComment.cs diff --git a/Http/PicacomicUrl.cs b/Http/PicacomicUrl.cs index ea3a611..6e51799 100644 --- a/Http/PicacomicUrl.cs +++ b/Http/PicacomicUrl.cs @@ -201,10 +201,10 @@ public static async Task Punch() /// 聊天室 /// /// - public static async Task GetChat() + public static async Task GetChat() { Header header = new(url: "chat"); - return await HttpWeb.SendAsync(header); + return await HttpWeb.SendAsync(header); } /// @@ -212,10 +212,10 @@ public static async Task GetChat() /// /// /// - public static async Task GetMyComments(int page = 1) + public static async Task GetMyComments(int page = 1) { Header header = new($"users/my-comments?page={page.ToString()}"); - return await HttpWeb.SendAsync(header); + return await HttpWeb.SendAsync(header); } @@ -228,30 +228,30 @@ public static async Task GetMyComments(int page = 1) /// 获取App基本信息 /// /// - public static async Task GetPlatform() + public static async Task GetPlatform() { Header header = new(url: "init?platform=android"); - return await HttpWeb.SendAsync(header); + return await HttpWeb.SendAsync(header); } /// /// 获取app主页上几大目录 /// /// - public static async Task GetCategory() + public static async Task GetCategory() { Header header = new(url: "categories"); - return await HttpWeb.SendAsync(header); + return await HttpWeb.SendAsync(header); } /// /// 获取收藏 /// /// - public static Header Favourite(sort sort, int page = 1) + public static async Task Favourite(sort sort = sort.ua, int page = 1) { Header header = new(url: $"users/favourite?s={sort.ToString()}&page={page.ToString()}"); - return header; + return await HttpWeb.SendAsync(header); } /// @@ -259,12 +259,12 @@ public static Header Favourite(sort sort, int page = 1) /// /// /// - public static Header AddFavourite(string bookId) + public static async Task AddFavourite(string bookId) { Header header = new( url: $"comics/{bookId}/favourite", method: HttpMethod.POST); - return header; + return await HttpWeb.SendAsync(header); } @@ -275,26 +275,24 @@ public static Header AddFavourite(string bookId) /// 本子标签 /// 排序 /// - public static Header CategoriesSearch(string categories, sort sort, int page = 1) + public static async Task CategoriesSearch(string categories, int page = 1, sort sort = sort.ua) { Header header = new(url: $"comics?page={page.ToString()}&c={UrlEncode(categories)}&s={sort.ToString()}"); - return header; + return await HttpWeb.SendAsync(header); } /// - /// 高级搜索 + /// 关键词搜索 /// - /// 上同 - /// 上同 - /// 上同 - /// 上同 + /// + /// + /// /// - public static Header AdvancedSearch(string categories, sort sort, string keyword = "", int page = 1) + public static async Task AdvancedSearch(string keyword, int page = 1, sort sort = sort.ua) { JObject jd = new() { - ["categories"] = UrlEncode(categories), - ["keyword"] = UrlEncode(keyword), + ["keyword"] = keyword, ["sort"] = sort.ToString() }; Header header = new( @@ -302,7 +300,7 @@ public static Header AdvancedSearch(string categories, sort sort, string keyword method: HttpMethod.POST, param: jd.ToString()); - return header; + return await HttpWeb.SendAsync(header); } /// @@ -311,10 +309,10 @@ public static Header AdvancedSearch(string categories, sort sort, string keyword /// /// /// - public static Header Search(string keyword, int page = 1) + public static async Task Search(string keyword, int page = 1) { Header header = new(url: $"comics/search?page={page.ToString()}&q={UrlEncode(keyword)}"); - return header; + return await HttpWeb.SendAsync(header); } /// @@ -322,10 +320,10 @@ public static Header Search(string keyword, int page = 1) /// /// H24 D7 D30 /// - public static Header Rank(tt tt) + public static async Task Rank(tt tt) { Header header = new(url: $"comics/leaderboard?tt={tt.ToString()}&ct=VC"); - return header; + return await HttpWeb.SendAsync(header); } /// @@ -333,36 +331,34 @@ public static Header Rank(tt tt) /// /// /// - public static Header GetComicsBook(string bookId) + public static async Task GetComicsBook(string bookId) { Header header = new(url: $"comics/{bookId}"); - return header; + return await HttpWeb.SendAsync(header); } /// /// 看了這本子的人也在看 + /// 暂时无数据 /// /// /// - public static Header Recommendation(string bookId) + public static async Task Recommendation(string bookId) { Header header = new(url: $"comics/{bookId}/recommendation"); - return header; + return await HttpWeb.SendAsync(header); } /// /// 获取本子的章节信息 - /// docs里的_id order 需要记住 - /// 下面的函数需要使用 - /// /// /// /// /// - public static Header GetComicsBookEps(string bookId, int page = 1) + public static async Task GetComicsBookEps(string bookId, int page = 1) { Header header = new(url: $"comics/{bookId}/eps?page={page.ToString()}"); - return header; + return await HttpWeb.SendAsync(header); } @@ -372,40 +368,40 @@ public static Header GetComicsBookEps(string bookId, int page = 1) /// /// 查看上面那个函数 /// - public static Header GetComicsBookOrder(string bookId, int epsId, int page = 1) + public static async Task GetComicsBookOrder(string bookId, int epsId, int page = 1) { Header header = new(url: $"comics/{bookId}/order/{epsId.ToString()}/pages?page={page.ToString()}"); - return header; + return await HttpWeb.SendAsync(header); } /// /// 获取热词 /// /// - public static Header GetKeywords() + public static async Task GetKeywords() { Header header = new(url: "keywords"); - return header; + return await HttpWeb.SendAsync(header); } /// /// 随机一个本子 /// /// - public static Header GetRandom() + public static async Task GetRandom() { Header header = new(url: "comics/random"); - return header; + return await HttpWeb.SendAsync(header); } /// /// 本子神推荐 /// /// - public static Header GetCollections() + public static async Task GetCollections() { Header header = new(url: "collections"); - return header; + return await HttpWeb.SendAsync(header); } /// @@ -413,23 +409,23 @@ public static Header GetCollections() /// /// /// - public static Header EverybodyLoves(int page = 1) + public static async Task EverybodyLoves(int page = 1) { Header header = new(url: $"comics?page={page.ToString()}&c=%E5%A4%A7%E5%AE%B6%E9%83%BD%E5%9C%A8%E7%9C%8B&s=ld"); - return header; + return await HttpWeb.SendAsync(header); } /// /// 下载一个图片 /// 图片信息里包含里此两个参数 + /// 构建一个url,自己实现 /// /// /// /// public static string DownloadBook(string fileServer, string path) { - //使用HttpClient WebClient HttpWebRequest 都可以,不需要设置header return $"{fileServer}/static/{path}"; } @@ -437,13 +433,13 @@ public static string DownloadBook(string fileServer, string path) /// /// 获取某个本子的评论 /// - /// + /// 5822a6e3ad7ede654696e482 此为哔咔留言板默认的ID /// /// - public static Header GetComments(string bookId = "5822a6e3ad7ede654696e482" /*此为哔咔留言板默认的ID*/, int page = 1) + public static async Task GetComments(string bookId = "5822a6e3ad7ede654696e482" , int page = 1) { Header header = new(url: $"comics/{bookId}/comments?page={page.ToString()}"); - return header; + return await HttpWeb.SendAsync(header); } /// @@ -452,37 +448,36 @@ public static Header GetComments(string bookId = "5822a6e3ad7ede654696e482" /* /// /// /// - public static Header GetCommentsChildren(string comentId, int page = 1) + public static async Task GetCommentsChildren(string comentId, int page = 1) { Header header = new(url: $"comments/{comentId}/childrens?page={page.ToString()}"); - return header; + return await HttpWeb.SendAsync(header); } /// /// 点赞某个评论 /// 对已经点赞过的发送会取消点赞 /// 可通过评论里isLiked字段进行判断 - /// 返回的数据里["data"]["action"]也会告诉是点赞还是取消 - /// + /// 返回的数据里["data"]["action"]也会告诉是点赞还是取消 /// /// /// - public static Header LikeComment(string comentId) + public static async Task LikeComment(string comentId) { Header header = new( url: $"comments/{comentId}/like", method: HttpMethod.POST); - return header; + return await HttpWeb.SendAsync(header); } /// /// 发送评论 /// - /// + /// 5822a6e3ad7ede654696e482 此为哔咔留言板默认的ID /// 评论内容 /// - public static Header SendComment(string content, string bookId = "5822a6e3ad7ede654696e482" /*此为哔咔留言板默认的ID*/) + public static async Task SendComment(string content, string bookId = "5822a6e3ad7ede654696e482") { JObject jd = new() { @@ -493,7 +488,7 @@ public static Header SendComment(string content, string bookId = "5822a6e3ad7ede url: $"comics/{bookId}/comments", method: HttpMethod.POST, param: jd.ToString()); - return header; + return await HttpWeb.SendAsync(header); } /// @@ -502,7 +497,7 @@ public static Header SendComment(string content, string bookId = "5822a6e3ad7ede /// /// /// - public static Header SendCommentChild(string comentId, string content) + public static async Task SendCommentChild(string comentId, string content) { JObject jd = new() { @@ -513,7 +508,7 @@ public static Header SendCommentChild(string comentId, string content) url: $"comments/{comentId}", method: HttpMethod.POST, param: jd.ToString()); - return header; + return await HttpWeb.SendAsync(header); } #endregion diff --git a/Http/Response/AddFavourite.cs b/Http/Response/AddFavourite.cs new file mode 100644 index 0000000..e590709 --- /dev/null +++ b/Http/Response/AddFavourite.cs @@ -0,0 +1,12 @@ + + +using Newtonsoft.Json; + +namespace picacomic_api.Http.Response +{ + public class AddFavourite + { + [JsonProperty("action")] + public string Action { get; set; } + } +} diff --git a/Http/Response/AdvancedSearch.cs b/Http/Response/AdvancedSearch.cs new file mode 100644 index 0000000..45d9c07 --- /dev/null +++ b/Http/Response/AdvancedSearch.cs @@ -0,0 +1,75 @@ + + +using Newtonsoft.Json; +using System; + +namespace picacomic_api.Http.Response +{ + public class AdvancedSearch + { + [JsonProperty("comics")] + public Comics_AdvancedSearch Comics { get; set; } + } + public partial class Comics_AdvancedSearch + { + [JsonProperty("total")] + public int Total { get; set; } + + [JsonProperty("page")] + public int Page { get; set; } + + [JsonProperty("pages")] + public int Pages { get; set; } + + [JsonProperty("docs")] + public Doc_AdvancedSearch[] Docs { get; set; } + + [JsonProperty("limit")] + public int Limit { get; set; } + } + + public class Doc_AdvancedSearch + { + [JsonProperty("updated_at")] + public DateTime UpdatedAt { get; set; } + + [JsonProperty("thumb")] + public Thumb Thumb { get; set; } + + [JsonProperty("author")] + public string Author { get; set; } + + [JsonProperty("description")] + public string Description { get; set; } + + [JsonProperty("chineseTeam", NullValueHandling = NullValueHandling.Ignore)] + public string ChineseTeam { get; set; } + + [JsonProperty("created_at")] + public DateTime CreatedAt { get; set; } + + [JsonProperty("finished")] + public int Finished { get; set; } + + [JsonProperty("totalViews")] + public int TotalViews { get; set; } + + [JsonProperty("categories")] + public string[] Categories { get; set; } + + [JsonProperty("totalLikes")] + public int TotalLikes { get; set; } + + [JsonProperty("title")] + public string Title { get; set; } + + [JsonProperty("tags")] + public string[] Tags { get; set; } + + [JsonProperty("_id")] + public string Id { get; set; } + + [JsonProperty("likesCount")] + public int LikesCount { get; set; } + } +} diff --git a/Http/Response/CategoriesSearch.cs b/Http/Response/CategoriesSearch.cs new file mode 100644 index 0000000..fcab821 --- /dev/null +++ b/Http/Response/CategoriesSearch.cs @@ -0,0 +1,72 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace picacomic_api.Http.Response +{ + public class CategoriesSearch + { + [JsonProperty("comics")] + public Comics_CategoriesSearch Comics { get; set; } + } + public class Comics_CategoriesSearch + { + [JsonProperty("docs")] + public Doc_CategoriesSearch[] Docs { get; set; } + + [JsonProperty("total")] + public int Total { get; set; } + + [JsonProperty("limit")] + public int Limit { get; set; } + + [JsonProperty("page")] + public int Page { get; set; } + + [JsonProperty("pages")] + public int Pages { get; set; } + } + + public class Doc_CategoriesSearch + { + [JsonProperty("_id")] + public string Id { get; set; } + + [JsonProperty("title")] + public string Title { get; set; } + + [JsonProperty("author")] + public string Author { get; set; } + + [JsonProperty("totalViews")] + public int TotalViews { get; set; } + + [JsonProperty("totalLikes")] + public int TotalLikes { get; set; } + + [JsonProperty("pagesCount")] + public int PagesCount { get; set; } + + [JsonProperty("epsCount")] + public int EpsCount { get; set; } + + [JsonProperty("finished")] + public bool Finished { get; set; } + + [JsonProperty("categories")] + public string[] Categories { get; set; } + + [JsonProperty("thumb")] + public Thumb Thumb { get; set; } + + [JsonProperty("id")] + public string DocId { get; set; } + + [JsonProperty("likesCount")] + public int LikesCount { get; set; } + } + +} diff --git a/Http/Response/EverybodyLoves.cs b/Http/Response/EverybodyLoves.cs new file mode 100644 index 0000000..3f97bb3 --- /dev/null +++ b/Http/Response/EverybodyLoves.cs @@ -0,0 +1,63 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace picacomic_api.Http.Response +{ + public class EverybodyLoves + { + [JsonProperty("comics")] + public Comics_EverybodyLoves Comics { get; set; } + } + public class Comics_EverybodyLoves + { + [JsonProperty("page")] + public int Page { get; set; } + + [JsonProperty("limit")] + public int Limit { get; set; } + + [JsonProperty("docs")] + public Doc_EverybodyLoves[] Docs { get; set; } + + [JsonProperty("total")] + public int Total { get; set; } + + [JsonProperty("pages")] + public int Pages { get; set; } + } + + public class Doc_EverybodyLoves + { + [JsonProperty("_id")] + public string Id { get; set; } + + [JsonProperty("title")] + public string Title { get; set; } + + [JsonProperty("author")] + public string Author { get; set; } + + [JsonProperty("pagesCount")] + public int PagesCount { get; set; } + + [JsonProperty("epsCount")] + public int EpsCount { get; set; } + + [JsonProperty("finished")] + public bool Finished { get; set; } + + [JsonProperty("categories")] + public string[] Categories { get; set; } + + [JsonProperty("thumb")] + public Thumb Thumb { get; set; } + + [JsonProperty("likesCount")] + public int LikesCount { get; set; } + } + +} diff --git a/Http/Response/Favourite.cs b/Http/Response/Favourite.cs new file mode 100644 index 0000000..f38fff6 --- /dev/null +++ b/Http/Response/Favourite.cs @@ -0,0 +1,76 @@ +using Newtonsoft.Json; +using System; + +namespace picacomic_api.Http.Response +{ + public class Favourite + { + [JsonProperty("comics")] + public Comics_Favourite Comics { get; set; } + } + public class Comics_Favourite + { + [JsonProperty("pages")] + public int Pages { get; set; } + + [JsonProperty("total")] + public int Total { get; set; } + + [JsonProperty("docs")] + public Doc_Favourite[] Docs { get; set; } + + [JsonProperty("page")] + public int Page { get; set; } + + [JsonProperty("limit")] + public int Limit { get; set; } + } + + public class Doc_Favourite + { + [JsonProperty("_id")] + public string Id { get; set; } + + [JsonProperty("title")] + public string Title { get; set; } + + [JsonProperty("author")] + public string Author { get; set; } + + [JsonProperty("totalViews")] + public long TotalViews { get; set; } + + [JsonProperty("totalLikes")] + public long TotalLikes { get; set; } + + [JsonProperty("pagesCount")] + public long PagesCount { get; set; } + + [JsonProperty("epsCount")] + public long EpsCount { get; set; } + + [JsonProperty("finished")] + public bool Finished { get; set; } + + [JsonProperty("categories")] + public string[] Categories { get; set; } + + [JsonProperty("thumb")] + public Thumb Thumb { get; set; } + + [JsonProperty("likesCount")] + public long LikesCount { get; set; } + } + + public class Thumb + { + [JsonProperty("fileServer")] + public Uri FileServer { get; set; } + + [JsonProperty("path")] + public string Path { get; set; } + + [JsonProperty("originalName")] + public string OriginalName { get; set; } + } +} diff --git a/Http/Response/Category.cs b/Http/Response/GetCategory.cs similarity index 70% rename from Http/Response/Category.cs rename to Http/Response/GetCategory.cs index 188f7bb..707b9d7 100644 --- a/Http/Response/Category.cs +++ b/Http/Response/GetCategory.cs @@ -6,12 +6,12 @@ namespace picacomic_api.Http.Response { - public class Categories + public class GetCategory { [JsonProperty("categories")] - public List Categorie { get; set; } + public List Categories { get; set; } } - public class Category + public class Categorie { [JsonProperty("title")] public string Title { get; set; } @@ -34,16 +34,4 @@ public class Category [JsonProperty("description", NullValueHandling = NullValueHandling.Ignore)] public string Description { get; set; } } - - public class Thumb - { - [JsonProperty("originalName")] - public string OriginalName { get; set; } - - [JsonProperty("path")] - public string Path { get; set; } - - [JsonProperty("fileServer")] - public Uri FileServer { get; set; } - } } diff --git a/Http/Response/Chat.cs b/Http/Response/GetChat.cs similarity index 95% rename from Http/Response/Chat.cs rename to Http/Response/GetChat.cs index 45efe40..3c9ce4a 100644 --- a/Http/Response/Chat.cs +++ b/Http/Response/GetChat.cs @@ -4,7 +4,7 @@ namespace picacomic_api.Http.Response { - public class Chat + public class GetChat { [JsonProperty("chatList")] public List ChatList { get; set; } diff --git a/Http/Response/GetCollections.cs b/Http/Response/GetCollections.cs new file mode 100644 index 0000000..8ce4d79 --- /dev/null +++ b/Http/Response/GetCollections.cs @@ -0,0 +1,56 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace picacomic_api.Http.Response +{ + public class GetCollections + { + [JsonProperty("collections")] + public Collection[] Collection { get; set; } + } + public class Collection + { + [JsonProperty("title")] + public string Title { get; set; } + + [JsonProperty("comics")] + public Comic_Collections[] Comics { get; set; } + } + + public class Comic_Collections + { + [JsonProperty("_id")] + public string Id { get; set; } + + [JsonProperty("title")] + public string Title { get; set; } + + [JsonProperty("author")] + public string Author { get; set; } + + [JsonProperty("totalViews")] + public int TotalViews { get; set; } + + [JsonProperty("totalLikes")] + public int TotalLikes { get; set; } + + [JsonProperty("pagesCount")] + public int PagesCount { get; set; } + + [JsonProperty("epsCount")] + public int EpsCount { get; set; } + + [JsonProperty("finished")] + public bool Finished { get; set; } + + [JsonProperty("categories")] + public string[] Categories { get; set; } + + [JsonProperty("thumb")] + public Thumb Thumb { get; set; } + } +} diff --git a/Http/Response/GetComicsBook.cs b/Http/Response/GetComicsBook.cs new file mode 100644 index 0000000..a1f9cc0 --- /dev/null +++ b/Http/Response/GetComicsBook.cs @@ -0,0 +1,125 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace picacomic_api.Http.Response +{ + public class GetComicsBook + { + [JsonProperty("comic")] + public Comic_ComicsBook Comic { get; set; } + } + public class Comic_ComicsBook + { + [JsonProperty("_id")] + public string Id { get; set; } + + [JsonProperty("_creator")] + public Creator Creator { get; set; } + + [JsonProperty("title")] + public string Title { get; set; } + + [JsonProperty("description")] + public string Description { get; set; } + + [JsonProperty("thumb")] + public Thumb Thumb { get; set; } + + [JsonProperty("author")] + public string Author { get; set; } + + [JsonProperty("chineseTeam")] + public string ChineseTeam { get; set; } + + [JsonProperty("categories")] + public string[] Categories { get; set; } + + [JsonProperty("tags")] + public string[] Tags { get; set; } + + [JsonProperty("pagesCount")] + public int PagesCount { get; set; } + + [JsonProperty("epsCount")] + public int EpsCount { get; set; } + + [JsonProperty("finished")] + public bool Finished { get; set; } + + [JsonProperty("updated_at")] + public DateTime UpdatedAt { get; set; } + + [JsonProperty("created_at")] + public DateTime CreatedAt { get; set; } + + [JsonProperty("allowDownload")] + public bool AllowDownload { get; set; } + + [JsonProperty("allowComment")] + public bool AllowComment { get; set; } + + [JsonProperty("totalLikes")] + public int TotalLikes { get; set; } + + [JsonProperty("totalViews")] + public int TotalViews { get; set; } + + [JsonProperty("viewsCount")] + public int ViewsCount { get; set; } + + [JsonProperty("likesCount")] + public int LikesCount { get; set; } + + [JsonProperty("isFavourite")] + public bool IsFavourite { get; set; } + + [JsonProperty("isLiked")] + public bool IsLiked { get; set; } + + [JsonProperty("commentsCount")] + public int CommentsCount { get; set; } + } + + public class Creator + { + [JsonProperty("_id")] + public string Id { get; set; } + + [JsonProperty("gender")] + public string Gender { get; set; } + + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("title")] + public string Title { get; set; } + + [JsonProperty("verified")] + public bool Verified { get; set; } + + [JsonProperty("exp")] + public int Exp { get; set; } + + [JsonProperty("level")] + public int Level { get; set; } + + [JsonProperty("characters")] + public string[] Characters { get; set; } + + [JsonProperty("role")] + public string Role { get; set; } + + [JsonProperty("avatar")] + public Thumb Avatar { get; set; } + + [JsonProperty("slogan")] + public string Slogan { get; set; } + + [JsonProperty("character")] + public Uri Character { get; set; } + } +} diff --git a/Http/Response/GetComicsBookEps.cs b/Http/Response/GetComicsBookEps.cs new file mode 100644 index 0000000..34b3515 --- /dev/null +++ b/Http/Response/GetComicsBookEps.cs @@ -0,0 +1,47 @@ +using Newtonsoft.Json; +using System; + +namespace picacomic_api.Http.Response +{ + public class GetComicsBookEps + { + [JsonProperty("eps")] + public Eps Eps { get; set; } + } + public class Eps + { + [JsonProperty("docs")] + public Doc_ComicsBookEps[] Docs { get; set; } + + [JsonProperty("total")] + public int Total { get; set; } + + [JsonProperty("limit")] + public int Limit { get; set; } + + [JsonProperty("page")] + public int Page { get; set; } + + [JsonProperty("pages")] + public int Pages { get; set; } + } + + public class Doc_ComicsBookEps + { + [JsonProperty("_id")] + public string Id { get; set; } + + [JsonProperty("title")] + public string Title { get; set; } + + [JsonProperty("order")] + public int Order { get; set; } + + [JsonProperty("updated_at")] + public DateTime UpdatedAt { get; set; } + + [JsonProperty("id")] + public string DocId { get; set; } + } + +} diff --git a/Http/Response/GetComicsBookOrder.cs b/Http/Response/GetComicsBookOrder.cs new file mode 100644 index 0000000..c7d8196 --- /dev/null +++ b/Http/Response/GetComicsBookOrder.cs @@ -0,0 +1,57 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace picacomic_api.Http.Response +{ + public class GetComicsBookOrder + { + [JsonProperty("pages")] + public Pages Pages { get; set; } + + [JsonProperty("ep")] + public Ep Ep { get; set; } + } + public class Ep + { + [JsonProperty("_id")] + public string Id { get; set; } + + [JsonProperty("title")] + public string Title { get; set; } + } + + public class Pages + { + [JsonProperty("docs")] + public Doc_ComicsBookOrder[] Docs { get; set; } + + [JsonProperty("total")] + public int Total { get; set; } + + [JsonProperty("limit")] + public int Limit { get; set; } + + [JsonProperty("page")] + public int Page { get; set; } + + [JsonProperty("pages")] + public int PagesPages { get; set; } + } + + public class Doc_ComicsBookOrder + { + [JsonProperty("_id")] + public string Id { get; set; } + + [JsonProperty("media")] + public Thumb Media { get; set; } + + [JsonProperty("id")] + public string DocId { get; set; } + } + +} diff --git a/Http/Response/GetComments.cs b/Http/Response/GetComments.cs new file mode 100644 index 0000000..c8a5001 --- /dev/null +++ b/Http/Response/GetComments.cs @@ -0,0 +1,143 @@ +using Newtonsoft.Json; +using System; + +namespace picacomic_api.Http.Response +{ + public class GetComments + { + [JsonProperty("comments")] + public Comments_GetComments Comment { get; set; } + + [JsonProperty("topComments")] + public TopComment[] TopComments { get; set; } + } + public class Comments_GetComments + { + [JsonProperty("docs")] + public Doc_GetComments[] Docs { get; set; } + + [JsonProperty("total")] + public int Total { get; set; } + + [JsonProperty("limit")] + public int Limit { get; set; } + + [JsonProperty("page")] + [JsonConverter(typeof(ParseStringConverter))] + public int Page { get; set; } + + [JsonProperty("pages")] + public int Pages { get; set; } + } + + public class Doc_GetComments + { + [JsonProperty("_id")] + public string Id { get; set; } + + [JsonProperty("content")] + public string Content { get; set; } + + [JsonProperty("_user")] + public User_GetComments User { get; set; } + + [JsonProperty("_comic")] + public string Comic { get; set; } + + [JsonProperty("isTop")] + public bool IsTop { get; set; } + + [JsonProperty("hide")] + public bool Hide { get; set; } + + [JsonProperty("created_at")] + public DateTime CreatedAt { get; set; } + + [JsonProperty("id")] + public string DocId { get; set; } + + [JsonProperty("likesCount")] + public int LikesCount { get; set; } + + [JsonProperty("commentsCount")] + public int CommentsCount { get; set; } + + [JsonProperty("isLiked")] + public bool IsLiked { get; set; } + } + + public class User_GetComments + { + [JsonProperty("_id")] + public string Id { get; set; } + + [JsonProperty("gender")] + public picacg.PicacomicUrl.gender Gender { get; set; } + + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("title")] + public string Title { get; set; } + + [JsonProperty("verified")] + public bool Verified { get; set; } + + [JsonProperty("exp")] + public long Exp { get; set; } + + [JsonProperty("level")] + public long Level { get; set; } + + [JsonProperty("characters")] + public object[] Characters { get; set; } + + [JsonProperty("role")] + public string Role { get; set; } + + [JsonProperty("avatar")] + public Thumb Avatar { get; set; } + + [JsonProperty("slogan", NullValueHandling = NullValueHandling.Ignore)] + public string Slogan { get; set; } + + [JsonProperty("character", NullValueHandling = NullValueHandling.Ignore)] + public Uri Character { get; set; } + } + + public partial class TopComment + { + [JsonProperty("_id")] + public string Id { get; set; } + + [JsonProperty("content")] + public string Content { get; set; } + + [JsonProperty("_user")] + public User User { get; set; } + + [JsonProperty("ip")] + public string Ip { get; set; } + + [JsonProperty("_comic")] + public string Comic { get; set; } + + [JsonProperty("isTop")] + public bool IsTop { get; set; } + + [JsonProperty("hide")] + public bool Hide { get; set; } + + [JsonProperty("created_at")] + public DateTimeOffset CreatedAt { get; set; } + + [JsonProperty("likesCount")] + public long LikesCount { get; set; } + + [JsonProperty("commentsCount")] + public long CommentsCount { get; set; } + + [JsonProperty("isLiked")] + public bool IsLiked { get; set; } + } +} diff --git a/Http/Response/GetCommentsChildren.cs b/Http/Response/GetCommentsChildren.cs new file mode 100644 index 0000000..c132a40 --- /dev/null +++ b/Http/Response/GetCommentsChildren.cs @@ -0,0 +1,40 @@ +using Newtonsoft.Json; +using System; + +namespace picacomic_api.Http.Response +{ + public class GetCommentsChildren + { + [JsonProperty("comments")] + public Comments_CommentsChildren Comments { get; set; } + } + public class Comments_CommentsChildren + { + [JsonProperty("docs")] + public Doc_CommentsChildren[] Docs { get; set; } + + [JsonProperty("total")] + public int Total { get; set; } + + [JsonProperty("limit")] + public int Limit { get; set; } + + [JsonProperty("page")] + [JsonConverter(typeof(ParseStringConverter))] + public int Page { get; set; } + + [JsonProperty("pages")] + public int Pages { get; set; } + } + + public class Doc_CommentsChildren: Doc_GetComments + { + + [JsonProperty("_parent")] + public string Parent { get; set; } + } + + + + +} diff --git a/Http/Response/GetKeywords.cs b/Http/Response/GetKeywords.cs new file mode 100644 index 0000000..b65879c --- /dev/null +++ b/Http/Response/GetKeywords.cs @@ -0,0 +1,11 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace picacomic_api.Http.Response +{ + public class GetKeywords + { + [JsonProperty("keywords")] + public string[] Keyword { get; set; } + } +} diff --git a/Http/Response/MyComments.cs b/Http/Response/GetMyComments.cs similarity index 82% rename from Http/Response/MyComments.cs rename to Http/Response/GetMyComments.cs index 119476b..0bd52ee 100644 --- a/Http/Response/MyComments.cs +++ b/Http/Response/GetMyComments.cs @@ -4,15 +4,15 @@ namespace picacomic_api.Http.Response { - public class MyComments + public class GetMyComments { [JsonProperty("comments")] - public Comments Comments { get; set; } + public Comments_MyComments Comments { get; set; } } - public class Comments + public class Comments_MyComments { [JsonProperty("docs")] - public List Docs { get; set; } + public List Docs { get; set; } [JsonProperty("total")] public int Total { get; set; } @@ -28,7 +28,7 @@ public class Comments public int Pages { get; set; } } - public class Doc + public class Doc_MyComments { [JsonProperty("_id")] public string Id { get; set; } @@ -37,7 +37,7 @@ public class Doc public string Content { get; set; } [JsonProperty("_comic")] - public Comic Comic { get; set; } + public Comic_MyComments Comic { get; set; } [JsonProperty("hide")] public bool Hide { get; set; } @@ -58,7 +58,7 @@ public class Doc public bool IsLiked { get; set; } } - public class Comic + public class Comic_MyComments { [JsonProperty("_id")] public string Id { get; set; } diff --git a/Http/Response/Platform.cs b/Http/Response/GetPlatform.cs similarity index 95% rename from Http/Response/Platform.cs rename to Http/Response/GetPlatform.cs index cb13759..5dc7006 100644 --- a/Http/Response/Platform.cs +++ b/Http/Response/GetPlatform.cs @@ -4,7 +4,7 @@ namespace picacomic_api.Http.Response { - public class Platform + public class GetPlatform { [JsonProperty("isPunched")] public bool IsPunched { get; set; } @@ -22,7 +22,7 @@ public class Platform public int MinApiLevel { get; set; } [JsonProperty("categories")] - public List Categories { get; set; } + public List Categories { get; set; } [JsonProperty("notification")] public object Notification { get; set; } diff --git a/Http/Response/GetRandom.cs b/Http/Response/GetRandom.cs new file mode 100644 index 0000000..7490881 --- /dev/null +++ b/Http/Response/GetRandom.cs @@ -0,0 +1,46 @@ +using Newtonsoft.Json; +using System; + +namespace picacomic_api.Http.Response +{ + public class GetRandom + { + [JsonProperty("comics")] + public Comic_Random[] Comics { get; set; } + } + public class Comic_Random + { + [JsonProperty("_id")] + public string Id { get; set; } + + [JsonProperty("title")] + public string Title { get; set; } + + [JsonProperty("thumb")] + public Thumb Thumb { get; set; } + + [JsonProperty("author")] + public string Author { get; set; } + + [JsonProperty("categories")] + public string[] Categories { get; set; } + + [JsonProperty("finished")] + public bool Finished { get; set; } + + [JsonProperty("epsCount")] + public int EpsCount { get; set; } + + [JsonProperty("pagesCount")] + public int PagesCount { get; set; } + + [JsonProperty("totalViews")] + public int TotalViews { get; set; } + + [JsonProperty("totalLikes")] + public int TotalLikes { get; set; } + + [JsonProperty("likesCount")] + public int LikesCount { get; set; } + } +} diff --git a/Http/Response/LikeComment.cs b/Http/Response/LikeComment.cs new file mode 100644 index 0000000..c9cbcbd --- /dev/null +++ b/Http/Response/LikeComment.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace picacomic_api.Http.Response +{ + public class LikeComment : AddFavourite + { + } +} diff --git a/Http/Response/Rank.cs b/Http/Response/Rank.cs new file mode 100644 index 0000000..fc927c6 --- /dev/null +++ b/Http/Response/Rank.cs @@ -0,0 +1,51 @@ + + +using Newtonsoft.Json; + +namespace picacomic_api.Http.Response +{ + public class Rank + { + [JsonProperty("comics")] + public Comic_Rank[] Comics { get; set; } + } + + public class Comic_Rank + { + [JsonProperty("_id")] + public string Id { get; set; } + + [JsonProperty("title")] + public string Title { get; set; } + + [JsonProperty("author")] + public string Author { get; set; } + + [JsonProperty("totalViews")] + public int TotalViews { get; set; } + + [JsonProperty("totalLikes")] + public int TotalLikes { get; set; } + + [JsonProperty("pagesCount")] + public int PagesCount { get; set; } + + [JsonProperty("epsCount")] + public int EpsCount { get; set; } + + [JsonProperty("finished")] + public bool Finished { get; set; } + + [JsonProperty("categories")] + public string[] Categories { get; set; } + + [JsonProperty("thumb")] + public Thumb Thumb { get; set; } + + [JsonProperty("viewsCount")] + public int ViewsCount { get; set; } + + [JsonProperty("leaderboardCount")] + public int LeaderboardCount { get; set; } + } +} diff --git a/Http/Response/Recommendation.cs b/Http/Response/Recommendation.cs new file mode 100644 index 0000000..096a157 --- /dev/null +++ b/Http/Response/Recommendation.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace picacomic_api.Http.Response +{ + /// + /// TODO:接口暂时没找到数据 备用 + /// + public class Recommendation + { + } +} diff --git a/Http/Response/Search.cs b/Http/Response/Search.cs new file mode 100644 index 0000000..d698246 --- /dev/null +++ b/Http/Response/Search.cs @@ -0,0 +1,71 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace picacomic_api.Http.Response +{ + public class Search + { + [JsonProperty("comics")] + public Comics_Search Comics { get; set; } + } + public class Comics_Search + { + [JsonProperty("docs")] + public Doc_Search[] Docs { get; set; } + + [JsonProperty("total")] + public int Total { get; set; } + + [JsonProperty("limit")] + public int Limit { get; set; } + + [JsonProperty("page")] + public int Page { get; set; } + + [JsonProperty("pages")] + public int Pages { get; set; } + } + + public class Doc_Search + { + [JsonProperty("_id")] + public string Id { get; set; } + + [JsonProperty("title")] + public string Title { get; set; } + + [JsonProperty("author")] + public string Author { get; set; } + + [JsonProperty("totalViews")] + public int TotalViews { get; set; } + + [JsonProperty("totalLikes")] + public int TotalLikes { get; set; } + + [JsonProperty("pagesCount")] + public int PagesCount { get; set; } + + [JsonProperty("epsCount")] + public int EpsCount { get; set; } + + [JsonProperty("finished")] + public bool Finished { get; set; } + + [JsonProperty("categories")] + public string[] Categories { get; set; } + + [JsonProperty("thumb")] + public Thumb Thumb { get; set; } + + [JsonProperty("id")] + public string DocId { get; set; } + + [JsonProperty("likesCount")] + public int LikesCount { get; set; } + } +} diff --git a/Http/Response/SendComment.cs b/Http/Response/SendComment.cs new file mode 100644 index 0000000..4f8f2af --- /dev/null +++ b/Http/Response/SendComment.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace picacomic_api.Http.Response +{ + /// + /// 不出错就是成功 + /// + public class SendComment + { + } +} diff --git a/Http/Response/User.cs b/Http/Response/User.cs index ea35a59..a9caf8a 100644 --- a/Http/Response/User.cs +++ b/Http/Response/User.cs @@ -34,7 +34,7 @@ public class User public int Level { get; set; } [JsonProperty("characters")] - public List Characters { get; set; } + public object[] Characters { get; set; } [JsonProperty("created_at")] public DateTime CreatedAt { get; set; } diff --git a/Program.cs b/Program.cs index 282379c..e133e91 100644 --- a/Program.cs +++ b/Program.cs @@ -5,20 +5,15 @@ namespace picacomic_api { class Program - { - public static string token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MGMwOTFlOWQ2MmEyYzc3Mjg3YTBiYjEiLCJlbWFpbCI6InF3ZXJ0cmZ4ZGQiLCJyb2xlIjoibWVtYmVyIiwibmFtZSI6Im1tLjJkIiwidmVyc2lvbiI6IjIuMi4xLjIuMy40IiwiYnVpbGRWZXJzaW9uIjoiNDUiLCJwbGF0Zm9ybSI6ImFuZHJvaWQiLCJpYXQiOjE2MjMyMzMxNjYsImV4cCI6MTYyMzgzNzk2Nn0.hOoJX8ONhpVSVlDimsdtKDw9fwmakKF3muFgfbq_3tM"; - public static string token_a = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1Y2Y4OTgxM2FhZTFjYjI4ODM1Y2RjNTUiLCJlbWFpbCI6ImE2MjE0MDE2Iiwicm9sZSI6Im1lbWJlciIsIm5hbWUiOiJtaWtvdCIsInZlcnNpb24iOiIyLjIuMS4yLjMuNCIsImJ1aWxkVmVyc2lvbiI6IjQ1IiwicGxhdGZvcm0iOiJhbmRyb2lkIiwiaWF0IjoxNjIzMjMzNDQ2LCJleHAiOjE2MjM4MzgyNDZ9.X9Xm8elvwwMby0yXNepox2Xfl5Js63jD9eQLR3FYi-U"; + { static async System.Threading.Tasks.Task Main(string[] args) { - Header.SetAuthorization(token_a); - var login = await PicacomicUrl.GetPlatform(); + + var login = await PicacomicUrl.Login("username","password");// if (login != null) { - ; - } - - - + Header.SetAuthorization(login.Authorization); + } Console.ReadLine(); }