Documentation
¶
Overview ¶
Package pica 哔咔漫画Golang客户端
Index ¶
- Constants
- type ActionResponse
- type CategoriesResponse
- type Category
- type ChildOfComment
- type Client
- func (client *Client) Categories() ([]Category, error)
- func (client *Client) Collections() ([]Collection, error)
- func (client *Client) ComicCommentsPage(comicId string, page int) (*CommentsPage, error)
- func (client *Client) ComicEpPage(comicId string, page int) (*EpPage, error)
- func (client *Client) ComicInfo(comicId string) (*ComicInfo, error)
- func (client *Client) ComicPicture(pictureInfo Image) ([]byte, error)
- func (client *Client) ComicPicturePage(comicId string, epOrder int, page int) (*ComicPicturePage, error)
- func (client *Client) ComicPicturePageWithQuality(comicId string, epOrder int, page int, quality string) (*ComicPicturePage, error)
- func (client *Client) ComicRecommendation(comicId string) ([]ComicSimple, error)
- func (client *Client) Comics(category string, tag string, creatorId string, chineseTeam string, sort string, ...) (*ComicsPage, error)
- func (client *Client) CommentChildren(commentId string, page int) (*CommentChildrenPage, error)
- func (client *Client) FavouriteComics(sort string, page int) (*ComicsPage, error)
- func (client *Client) ForgotPassword(email string) (*ForgotPasswordResult, error)
- func (client *Client) GameCommentChildren(commentId string, page int) (*GameCommentChildrenPage, error)
- func (client *Client) GameCommentsPage(gameId string, page int) (*GameCommentsPage, error)
- func (client *Client) GameInfo(gameId string) (*GameInfo, error)
- func (client *Client) GamePage(page int) (*GamePage, error)
- func (client *Client) HideComment(commentId string) error
- func (client *Client) HotKeywords() ([]string, error)
- func (client *Client) InitInfo() (*InitInfo, error)
- func (client *Client) Leaderboard(leaderboardType string) ([]ComicSimple, error)
- func (client *Client) LeaderboardOfKnight() ([]Knight, error)
- func (client *Client) Login(username string, password string) error
- func (client *Client) MyComments(page int) (*MyCommentsPage, error)
- func (client *Client) PostChildComment(commentId string, content string) error
- func (client *Client) PostComment(comicId string, content string) error
- func (client *Client) PostGameComment(gameId string, content string) error
- func (client *Client) PunchIn() (*PunchStatus, error)
- func (client *Client) RandomComics() ([]ComicSimple, error)
- func (client *Client) Register(dto RegisterDto) error
- func (client *Client) ResetPassword(email string, questionNo int, answer string) (*ResetPasswordResult, error)
- func (client *Client) SearchComics(categories []string, keyword string, sort string, page int) (*ComicsPage, error)
- func (client *Client) SearchComicsInCategories(keyword string, sort string, page int, categories []string) (*ComicsPage, error)
- func (client *Client) SwitchFavourite(comicId string) (*string, error)
- func (client *Client) SwitchLike(comicId string) (*string, error)
- func (client *Client) SwitchLikeComment(commentId string) (*string, error)
- func (client *Client) UpdateAvatar(jpegBytes []byte) error
- func (client *Client) UpdatePassword(oldPassword string, newPassword string) error
- func (client *Client) UpdateSlogan(slogan string) error
- func (client *Client) UserProfile() (*UserProfile, error)
- type Collection
- type CollectionsResponse
- type ComicInfo
- type ComicInfoResponse
- type ComicPicture
- type ComicPicturePage
- type ComicPicturePageResponse
- type ComicSimple
- type ComicsPage
- type ComicsPageResponse
- type ComicsResponse
- type Comment
- type CommentBase
- type CommentChild
- type CommentChildrenPage
- type CommentChildrenResponse
- type CommentUser
- type CommentsPage
- type CommentsResponse
- type Creator
- type Ep
- type EpPage
- type EpPageResponse
- type ForgotPasswordResponse
- type ForgotPasswordResult
- type GameComment
- type GameCommentChild
- type GameCommentChildrenPage
- type GameCommentChildrenResponse
- type GameCommentsPage
- type GameCommentsResponse
- type GameInfo
- type GamePage
- type GamePageResponse
- type GameResponse
- type GameSimple
- type HotKeywordsResponse
- type Image
- type InitInfo
- type Knight
- type LeaderboardOfKnightResponse
- type LoginRequest
- type LoginResponse
- type MyComment
- type MyCommentsPage
- type MyCommentsPageResponse
- type PageData
- type PunchResponse
- type PunchStatus
- type RegisterDto
- type ResetPasswordResponse
- type ResetPasswordResult
- type Response
- type UserBasic
- type UserProfile
- type UserProfileResponse
Constants ¶
const ( SortDefault = "ua" SortTimeNewest = "dd" // 新到旧 SortTimeOldest = "da" // 旧到新 SortLikeMost = "ld" // 最多爱心 SortViewMost = "vd" // 最多绅士指名 )
排序方式
const ( ImageQualityOriginal = "original" ImageQualityLow = "low" ImageQualityMedium = "medium" ImageQualityHigh = "high" )
图片质量
const ( ActionLike = "like" ActionUnlike = "unlike" ActionFavourite = "favourite" ActionUnFavourite = "un_favourite" )
请求结果
const ( LeaderboardH24 = "H24" LeaderboardD7 = "D7" LeaderboardD30 = "D30" )
排行榜类型
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionResponse ¶
type ActionResponse struct { Data struct { Action string `json:"action"` } `json:"data"` }
ActionResponse 点赞,收藏 等接口返回体
type CategoriesResponse ¶
type CategoriesResponse struct { Response Data struct { Categories []Category `json:"categories"` } `json:"data"` }
CategoriesResponse 获取分类接口返回体
type Category ¶
type Category struct { Id string `json:"_id"` Title string `json:"title"` Description string `json:"description"` Thumb Image `json:"thumb"` IsWeb bool `json:"isWeb"` Active bool `json:"active"` Link string `json:"link"` }
Category 分类
type ChildOfComment ¶
type ChildOfComment struct {
Parent string `json:"_parent"`
}
ChildOfComment 自评的字段
type Client ¶
Client 客户端 struct
func (*Client) Collections ¶
func (client *Client) Collections() ([]Collection, error)
func (*Client) ComicCommentsPage ¶
func (client *Client) ComicCommentsPage(comicId string, page int) (*CommentsPage, error)
ComicCommentsPage 漫画的评论
func (*Client) ComicEpPage ¶
ComicEpPage 漫画EP信息
func (*Client) ComicPicture ¶
ComicPicture 获取实际的漫画图片,不需要login
func (*Client) ComicPicturePage ¶
func (client *Client) ComicPicturePage(comicId string, epOrder int, page int) (*ComicPicturePage, error)
ComicPicturePage 漫画图片
func (*Client) ComicPicturePageWithQuality ¶
func (client *Client) ComicPicturePageWithQuality(comicId string, epOrder int, page int, quality string) (*ComicPicturePage, error)
ComicPicturePageWithQuality 漫画图片
func (*Client) ComicRecommendation ¶
func (client *Client) ComicRecommendation(comicId string) ([]ComicSimple, error)
ComicRecommendation 看了这个本子的也在看
func (*Client) Comics ¶
func (client *Client) Comics(category string, tag string, creatorId string, chineseTeam string, sort string, page int) (*ComicsPage, error)
Comics 分类下的漫画 category 为空字符串则为所有分类
func (*Client) CommentChildren ¶
func (client *Client) CommentChildren(commentId string, page int) (*CommentChildrenPage, error)
CommentChildren 获取子评论
func (*Client) FavouriteComics ¶
func (client *Client) FavouriteComics(sort string, page int) (*ComicsPage, error)
FavouriteComics 收藏的漫画
func (*Client) ForgotPassword ¶
func (client *Client) ForgotPassword(email string) (*ForgotPasswordResult, error)
ForgotPassword 找回密码, 获取用户问题
func (*Client) GameCommentChildren ¶
func (client *Client) GameCommentChildren(commentId string, page int) (*GameCommentChildrenPage, error)
GameCommentChildren 游戏评论的回复分页 (和漫画接口是同一个, 只有"_comic/_game"字段不一样)
func (*Client) GameCommentsPage ¶
func (client *Client) GameCommentsPage(gameId string, page int) (*GameCommentsPage, error)
GameCommentsPage 游戏评论分页
func (*Client) HideComment ¶
HideComment 哔咔API里的接口, 不知道做什么用的, 推测是管理员用接口
func (*Client) HotKeywords ¶
HotKeywords 大家都在搜
func (*Client) Leaderboard ¶
func (client *Client) Leaderboard(leaderboardType string) ([]ComicSimple, error)
Leaderboard 排行榜
func (*Client) LeaderboardOfKnight ¶
LeaderboardOfKnight 骑士榜
func (*Client) MyComments ¶
func (client *Client) MyComments(page int) (*MyCommentsPage, error)
func (*Client) PostChildComment ¶
PostChildComment 对漫画/游戏的评论进行回复(子评论), 但是评论后无法删除
func (*Client) PostComment ¶
PostComment 对漫画进行评论, 但是评论后无法删除
func (*Client) PostGameComment ¶
PostGameComment 对游戏进行评论, 但是评论后无法删除
func (*Client) RandomComics ¶
func (client *Client) RandomComics() ([]ComicSimple, error)
RandomComics 随机漫画
func (*Client) ResetPassword ¶
func (client *Client) ResetPassword(email string, questionNo int, answer string) (*ResetPasswordResult, error)
ResetPassword 找回密码, 根据问题重置密码
func (*Client) SearchComics ¶
func (client *Client) SearchComics(categories []string, keyword string, sort string, page int) (*ComicsPage, error)
SearchComics 搜索漫画 PS : 此接口并没有返回 PagesCount EpsCount
func (*Client) SearchComicsInCategories ¶
func (client *Client) SearchComicsInCategories(keyword string, sort string, page int, categories []string) (*ComicsPage, error)
SearchComicsInCategories 搜索漫画
func (*Client) SwitchFavourite ¶
SwitchFavourite (取消)收藏漫画 第一次收藏,第二次是取消收藏 action是最终结果
func (*Client) SwitchLike ¶
SwitchLike (取消)喜欢漫画 第一次喜欢,第二次是取消喜欢 action是最终结果
func (*Client) SwitchLikeComment ¶
SwitchLikeComment (取消)喜欢评论/子评论 第一次喜欢,第二次是取消喜欢 action是最终结果 ( ActionLike or ActionUnlike )
func (*Client) UpdateAvatar ¶
UpdateAvatar 修改头像 请压缩头像成正方形, 200x200,并尽量减少图片体积, 编码必须为JPEG
func (*Client) UpdatePassword ¶
UpdatePassword 修改密码
func (*Client) UpdateSlogan ¶
UpdateSlogan 修改签名
func (*Client) UserProfile ¶
func (client *Client) UserProfile() (*UserProfile, error)
UserProfile 用户信息
type Collection ¶
type Collection struct { Title string `json:"title"` Comics []ComicSimple `json:"comics"` }
Collection 合集
type CollectionsResponse ¶
type CollectionsResponse struct { Response Data struct { Collections []Collection `json:"collections"` } `json:"data"` }
CollectionsResponse 合集返回体
type ComicInfo ¶
type ComicInfo struct { ComicSimple Creator Creator `json:"_creator"` Description string `json:"description"` ChineseTeam string `json:"chineseTeam"` Tags []string `json:"tags"` UpdatedAt time.Time `json:"updated_at"` CreatedAt time.Time `json:"created_at"` AllowDownload bool `json:"allowDownload"` ViewsCount int `json:"viewsCount"` IsFavourite bool `json:"isFavourite"` IsLiked bool `json:"isLiked"` CommentsCount int `json:"commentsCount"` }
ComicInfo 漫画详情
type ComicInfoResponse ¶
type ComicInfoResponse struct { Response Data struct { Comic ComicInfo `json:"comic"` } `json:"data" ` }
ComicInfoResponse 获取漫画详情接口返回体
type ComicPicture ¶
ComicPicture 章节的图片
type ComicPicturePage ¶
type ComicPicturePage struct { PageData Docs []ComicPicture `json:"docs"` }
ComicPicturePage 章节图片的分页
type ComicPicturePageResponse ¶
type ComicPicturePageResponse struct { Response Data struct { Pages ComicPicturePage `json:"pages"` Ep Ep `json:"ep"` } `json:"data"` }
ComicPicturePageResponse 获取章节图片接口返回体
type ComicSimple ¶
type ComicSimple struct { Id string `json:"_id"` Title string `json:"title"` Author string `json:"author"` PagesCount int `json:"pagesCount"` EpsCount int `json:"epsCount"` Finished bool `json:"finished"` Categories []string `json:"categories"` Thumb Image `json:"thumb"` LikesCount int `json:"likesCount"` }
ComicSimple 漫画摘要内容, 列表页面使用
type ComicsPage ¶
type ComicsPage struct { PageData Docs []ComicSimple `json:"docs"` }
ComicsPage 漫画的分页
type ComicsPageResponse ¶
type ComicsPageResponse struct { Response Data struct { Comics ComicsPage `json:"comics"` } `json:"data"` }
ComicsPageResponse 漫画列表接口返回体
type ComicsResponse ¶
type ComicsResponse struct { Response Data struct { Comics []ComicSimple `json:"comics"` } `json:"data"` }
ComicsResponse 漫画列表返回体 用于随机漫画, 排行榜等不分页的接口
type CommentBase ¶
type CommentBase struct { Id string `json:"_id"` Content string `json:"content"` User CommentUser `json:"_user"` IsTop bool `json:"isTop"` Hide bool `json:"hide"` CreatedAt time.Time `json:"created_at"` LikesCount int `json:"likesCount"` CommentsCount int `json:"commentsCount"` IsLiked bool `json:"isLiked"` }
CommentBase 评论
type CommentChildrenPage ¶
type CommentChildrenPage struct { PageData Docs []CommentChild `json:"docs"` }
CommentChildrenPage 子评论分页
type CommentChildrenResponse ¶
type CommentChildrenResponse struct { Response Data struct { Comments CommentChildrenPage `json:"comments"` } `json:"data"` }
CommentChildrenResponse 获取子评论接口返回体
type CommentUser ¶
CommentUser 发出此评论的人
type CommentsPage ¶
CommentsPage 漫画评论的分页
type CommentsResponse ¶
type CommentsResponse struct { Response Data struct { Comments CommentsPage `json:"comments"` TopComments []Comment `json:"topComments"` } `json:"data"` }
CommentsResponse 获取漫画评论接口返回体
type Ep ¶
type Ep struct { Id string `json:"_id"` Title string `json:"title"` Order int `json:"order"` UpdatedAt time.Time `json:"updated_at"` }
Ep 漫画的章节
type EpPageResponse ¶
EpPageResponse 获取漫画章节列表接口返回体
type ForgotPasswordResponse ¶
type ForgotPasswordResponse struct { Response Data ForgotPasswordResult `json:"data"` }
ForgotPasswordResponse 找回密码-获取问题-返回
type ForgotPasswordResult ¶
type ForgotPasswordResult struct { Question1 string `json:"question1"` Question2 string `json:"question2"` Question3 string `json:"question3"` }
ForgotPasswordResult 找回密码-获取问题-返回DATA
type GameComment ¶
type GameComment struct { CommentBase Game string `json:"_game"` }
GameComment 游戏的评论
type GameCommentChild ¶
type GameCommentChild struct { GameComment ChildOfComment }
GameCommentChild 游戏子评论
type GameCommentChildrenPage ¶
type GameCommentChildrenPage struct { PageData Docs []GameCommentChild `json:"docs"` }
GameCommentChildrenPage 游戏子评论分页
type GameCommentChildrenResponse ¶
type GameCommentChildrenResponse struct { Response Data struct { Comments GameCommentChildrenPage `json:"comments"` } `json:"data"` }
GameCommentChildrenResponse 获取游戏子评论接口返回体
type GameCommentsPage ¶
type GameCommentsPage struct { PageData Docs []GameComment `json:"docs"` }
GameCommentsPage 游戏评论的分页
type GameCommentsResponse ¶
type GameCommentsResponse struct { Response Data struct { Comments GameCommentsPage `json:"comments"` TopComments []Comment `json:"topComments"` } `json:"data"` }
GameCommentsResponse 获取漫画评论接口返回体
type GameInfo ¶
type GameInfo struct { GameSimple Description string `json:"description"` UpdateContent string `json:"updateContent"` VideoLink string `json:"videoLink"` Screenshots []Image `json:"screenshots"` CommentsCount int `json:"commentsCount"` DownloadsCount int `json:"downloadsCount"` IsLiked bool `json:"isLiked"` AndroidLinks []string `json:"androidLinks"` AndroidSize float32 `json:"androidSize"` IosLinks []string `json:"iosLinks"` IosSize float32 `json:"iosSize"` UpdatedAt time.Time `json:"updated_at"` CreatedAt time.Time `json:"created_at"` }
GameInfo 游戏详情
type GamePageResponse ¶
type GamePageResponse struct { Response Data struct { Games GamePage `json:"games"` } `json:"data"` }
GamePageResponse 游戏列表接口返回体
type GameResponse ¶
GameResponse 游戏详情接口返回体
type GameSimple ¶
type GameSimple struct { Id string `json:"_id"` Title string `json:"title"` Version string `json:"version"` Icon Image `json:"icon"` Publisher string `json:"publisher"` Adult bool `json:"adult"` Suggest bool `json:"suggest"` LikesCount int `json:"likesCount"` Android bool `json:"android"` Ios bool `json:"ios"` }
GameSimple 游戏摘要
type HotKeywordsResponse ¶
type HotKeywordsResponse struct { Response Data struct { Keywords []string `json:"keywords"` } `json:"data"` }
HotKeywordsResponse 大家搜在搜接口返回体
type Image ¶
type Image struct { OriginalName string `json:"originalName"` Path string `json:"path"` FileServer string `json:"fileServer"` }
Image 图片资源
type Knight ¶
type Knight struct { UserBasic Role string `json:"role"` Character string `json:"character"` ComicsUploaded int `json:"comicsUploaded"` }
Knight 用户(骑士榜)
type LeaderboardOfKnightResponse ¶
type LeaderboardOfKnightResponse struct { Response Data struct { Users []Knight `json:"users"` } `json:"data"` }
LeaderboardOfKnightResponse 骑士榜接口返回体
type LoginRequest ¶
LoginRequest 登录的请求体 (PS:Email字段为账号, 并不一定是邮箱格式)
type LoginResponse ¶
LoginResponse 登录的返回体
type MyComment ¶
type MyComment struct { Id string `json:"_id"` Content string `json:"content"` Comic struct { Id string `json:"_id"` Title string `json:"title"` } `json:"_comic"` Hide bool `json:"hide"` CreatedAt time.Time `json:"created_at"` LikesCount int `json:"likesCount"` CommentsCount int `json:"commentsCount"` IsLiked bool `json:"isLiked"` }
MyComment 我的评论
type MyCommentsPage ¶
MyCommentsPage 我的评论分页
type MyCommentsPageResponse ¶
type MyCommentsPageResponse struct { Response Data struct { Comments MyCommentsPage `json:"comments"` } `json:"data"` }
MyCommentsPageResponse 我的评论接口返回体
type PageData ¶
type PageData struct { Total int `json:"total"` Limit int `json:"limit"` Page int `json:"page"` Pages int `json:"pages"` }
PageData 分页格式
type PunchResponse ¶
type PunchResponse struct { Response Data struct { Res PunchStatus `json:"res"` } `json:"data"` }
PunchResponse 打哔咔接口返回体
type PunchStatus ¶
type PunchStatus struct { Status string `json:"status"` PunchInLastDay string `json:"punchInLastDay"` }
PunchStatus 打哔咔接口返回内容
type RegisterDto ¶
type RegisterDto struct { Email string `json:"email"` // 邮箱 Password string `json:"password"` // 8字以上 Name string `json:"name"` // 2 - 50 字 Birthday string `json:"birthday"` // 2012-01-01 Gender string `json:"gender"` // m, f, bot Answer1 string `json:"answer1"` Answer2 string `json:"answer2"` Answer3 string `json:"answer3"` Question1 string `json:"question1"` Question2 string `json:"question2"` Question3 string `json:"question3"` }
RegisterDto 注册接口请求体
type ResetPasswordResponse ¶
type ResetPasswordResponse struct { Response Data ResetPasswordResult `json:"data"` }
ResetPasswordResponse 找回密码-获取问题-返回
type ResetPasswordResult ¶
type ResetPasswordResult struct {
Password string `json:"password"`
}
ResetPasswordResult 找回密码-根据答案重置密码
type Response ¶
type Response struct { Code int `json:"code"` Error string `json:"error"` Message string `json:"message"` Detail string `json:"detail"` }
Response 返回体格式
type UserBasic ¶
type UserBasic struct { Id string `json:"_id"` Gender string `json:"gender"` Name string `json:"name"` Title string `json:"title"` Verified bool `json:"verified"` Exp int `json:"exp"` Level int `json:"level"` Characters []string `json:"characters"` Avatar Image `json:"avatar"` Slogan string `json:"slogan"` // 有可能是null, 从未设置过slogan的人 }
UserBasic 用户的基本信息
type UserProfile ¶
type UserProfile struct { UserBasic Birthday string `json:"birthday"` Email string `json:"email"` CreatedAt time.Time `json:"created_at"` IsPunched bool `json:"isPunched"` // 是否打了哔咔 }
UserProfile 获取个人信息接口返回内容 | 个人信息
type UserProfileResponse ¶
type UserProfileResponse struct { Data struct { User UserProfile `json:"user"` } `json:"data"` }
UserProfileResponse 获取个人信息接口返回体