Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) ConsolePanelConfig(ctx context.Context, titleSlug string) (res *ConsolePanelConfigRes, err error)
- func (c *Client) ProblemsetQuestionList(ctx context.Context, in ProblemQuestionReq) (res *ProblemQuestionRes, err error)
- func (c *Client) QaQuestionDetail(ctx context.Context, in QaQuestionDetailReq) (res *QaQuestionDetailRes, err error)
- func (c *Client) QuestionData(ctx context.Context, in QuestionDataReq) (res *QuestionDataRes, err error)
- func (c *Client) QuestionOfToday(ctx context.Context, in QuestionOfTodayReq) (res *QuestionOfTodayRes, err error)
- func (c *Client) SolutionArticle(ctx context.Context, in SolutionArticleReq) (res *SolutionArticleRes, err error)
- type ConsolePanelConfigQuestion
- type ConsolePanelConfigRes
- type EnvInfo
- type ExampleTestcase
- type LangToValidPlayground
- type MetaData
- type Opt
- type ProblemQuestionFilters
- type ProblemQuestionReq
- type ProblemQuestionRes
- type ProblemsetExtra
- type ProblemsetQuestion
- type ProblemsetTopicTag
- type QaQuestionDetail
- type QaQuestionDetailReq
- type QaQuestionDetailRes
- type QuestionData
- type QuestionDataCodeSnippet
- type QuestionDataQuestion
- type QuestionDataReq
- type QuestionDataRes
- type QuestionDataSolution
- type QuestionDataTopicTag
- type QuestionOfTodayReq
- type QuestionOfTodayRes
- type SimilarQuestion
- type SolutionArticleReq
- type SolutionArticleRes
- type Stats
Constants ¶
View Source
const ( EndpointZh = "https://leetcode.cn/graphql" EndpointEn = "https://leetcode.com/graphql" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) ConsolePanelConfig ¶
func (*Client) ProblemsetQuestionList ¶
func (c *Client) ProblemsetQuestionList(ctx context.Context, in ProblemQuestionReq) (res *ProblemQuestionRes, err error)
ProblemsetQuestionList 根据搜索条件查看题库列表
func (*Client) QaQuestionDetail ¶
func (c *Client) QaQuestionDetail(ctx context.Context, in QaQuestionDetailReq) (res *QaQuestionDetailRes, err error)
QaQuestionDetail 查看讨论内容
func (*Client) QuestionData ¶
func (c *Client) QuestionData(ctx context.Context, in QuestionDataReq) (res *QuestionDataRes, err error)
QuestionData 返回题目内容和模板代码
func (*Client) QuestionOfToday ¶
func (c *Client) QuestionOfToday(ctx context.Context, in QuestionOfTodayReq) (res *QuestionOfTodayRes, err error)
QuestionOfToday 查看今日的每日一题信息
func (*Client) SolutionArticle ¶
func (c *Client) SolutionArticle(ctx context.Context, in SolutionArticleReq) (res *SolutionArticleRes, err error)
SolutionArticle 查看题解文章
type ConsolePanelConfigQuestion ¶
type ConsolePanelConfigQuestion struct { QuestionId string `json:"questionId"` QuestionFrontendId string `json:"questionFrontendId"` QuestionTitle string `json:"questionTitle"` EnableRunCode bool `json:"enableRunCode"` EnableSubmit bool `json:"enableSubmit"` EnableTestMode bool `json:"enableTestMode"` JsonExampleTestcases string `json:"jsonExampleTestcases"` ExampleTestcases string `json:"exampleTestcases"` MetaData string `json:"metaData"` SampleTestCase string `json:"sampleTestCase"` }
type ConsolePanelConfigRes ¶
type ConsolePanelConfigRes struct {
Question ConsolePanelConfigQuestion `json:"question"`
}
type ExampleTestcase ¶
type ExampleTestcase any
type LangToValidPlayground ¶
type MetaData ¶
type MetaData struct { Name string `json:"name"` // 函数名 Params []struct { Name string `json:"name"` // 参数名 Type string `json:"type"` // 参数类型 } `json:"params"` Return struct { Type string `json:"type"` // 返回值类型 } `json:"return"` Classname string `json:"classname"` Constructor struct { Params []struct { Name string `json:"name"` // 参数名 Type string `json:"type"` // 参数类型 } `json:"params"` } `json:"constructor"` Methods []struct { Params []struct { Type string `json:"type"` Name string `json:"name"` } `json:"params"` Return struct { Type string `json:"type"` } `json:"return"` Name string `json:"name"` } `json:"methods"` Systemdesign bool `json:"systemdesign"` }
type ProblemQuestionFilters ¶
type ProblemQuestionReq ¶
type ProblemQuestionReq struct { CategorySlug string `json:"categorySlug"` Skip int `json:"skip"` Limit int `json:"limit"` Filters ProblemQuestionFilters `json:"filters"` }
type ProblemQuestionRes ¶
type ProblemQuestionRes struct { ProblemsetQuestionList struct { Typename string `json:"__typename"` Questions []ProblemsetQuestion `json:"questions"` HasMore bool `json:"hasMore"` Total int `json:"total"` } `json:"problemsetQuestionList"` }
type ProblemsetExtra ¶
type ProblemsetExtra struct { CompanyTagNum int `json:"companyTagNum"` HasVideoSolution bool `json:"hasVideoSolution"` TopCompanyTags []struct { ImgUrl string `json:"imgUrl"` Slug string `json:"slug"` Typename string `json:"__typename"` } `json:"topCompanyTags"` Typename string `json:"__typename"` }
type ProblemsetQuestion ¶
type ProblemsetQuestion struct { Typename string `json:"__typename"` AcRate float64 `json:"acRate"` Difficulty string `json:"difficulty"` FreqBar int `json:"freqBar"` PaidOnly bool `json:"paidOnly"` Status string `json:"status"` FrontendQuestionId string `json:"frontendQuestionId"` IsFavor bool `json:"isFavor"` SolutionNum int `json:"solutionNum"` Title string `json:"title"` TitleCn string `json:"titleCn"` TitleSlug string `json:"titleSlug"` TopicTags []ProblemsetTopicTag `json:"topicTags"` Extra ProblemsetExtra `json:"extra"` }
type ProblemsetTopicTag ¶
type QaQuestionDetail ¶
type QaQuestionDetail struct { IpRegion string `json:"ipRegion"` Uuid string `json:"uuid"` Slug string `json:"slug"` Title string `json:"title"` Thumbnail string `json:"thumbnail"` Summary string `json:"summary"` Content string `json:"content"` SlateValue string `json:"slateValue"` Sunk bool `json:"sunk"` Pinned bool `json:"pinned"` PinnedGlobally bool `json:"pinnedGlobally"` ByLeetcode bool `json:"byLeetcode"` IsRecommended bool `json:"isRecommended"` IsRecommendedGlobally bool `json:"isRecommendedGlobally"` Subscribed bool `json:"subscribed"` HitCount int `json:"hitCount"` NumAnswers int `json:"numAnswers"` NumPeopleInvolved int `json:"numPeopleInvolved"` NumSubscribed int `json:"numSubscribed"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` Status string `json:"status"` Identifier string `json:"identifier"` ResourceType string `json:"resourceType"` ArticleType string `json:"articleType"` AlwaysShow bool `json:"alwaysShow"` AlwaysExpand bool `json:"alwaysExpand"` Score interface{} `json:"score"` FavoriteCount int `json:"favoriteCount"` IsMyFavorite bool `json:"isMyFavorite"` IsAnonymous bool `json:"isAnonymous"` CanEdit bool `json:"canEdit"` ReactionType interface{} `json:"reactionType"` AtQuestionTitleSlug string `json:"atQuestionTitleSlug"` BlockComments bool `json:"blockComments"` ReactionsV2 []struct { Count int `json:"count"` ReactionType string `json:"reactionType"` Typename string `json:"__typename"` } `json:"reactionsV2"` Tags []struct { Name string `json:"name"` NameTranslated string `json:"nameTranslated"` Slug string `json:"slug"` ImgUrl interface{} `json:"imgUrl"` TagType string `json:"tagType"` Typename string `json:"__typename"` } `json:"tags"` Subject struct { Slug string `json:"slug"` Title string `json:"title"` Typename string `json:"__typename"` } `json:"subject"` ContentAuthor struct { Username string `json:"username"` UserSlug string `json:"userSlug"` RealName string `json:"realName"` Avatar string `json:"avatar"` Typename string `json:"__typename"` } `json:"contentAuthor"` RealAuthor interface{} `json:"realAuthor"` Typename string `json:"__typename"` MyAnswerId interface{} `json:"myAnswerId"` }
type QaQuestionDetailReq ¶
type QaQuestionDetailReq struct {
Uuid string
}
type QaQuestionDetailRes ¶
type QaQuestionDetailRes struct {
QaQuestion QaQuestionDetail `json:"qaQuestion"`
}
type QuestionData ¶
type QuestionData struct { QuestionId string `json:"questionId"` // QuestionFrontendId string `json:"questionFrontendId"` // CategoryTitle string `json:"categoryTitle"` // BoundTopicId int `json:"boundTopicId"` // Title string `json:"title"` // TitleSlug string `json:"titleSlug"` // Content string `json:"content"` // TranslatedTitle string `json:"translatedTitle"` // TranslatedContent string `json:"translatedContent"` // IsPaidOnly bool `json:"isPaidOnly"` // Difficulty string `json:"difficulty"` // Likes int `json:"likes"` // Dislikes int `json:"dislikes"` // IsLiked interface{} `json:"isLiked"` // SimilarQuestions []SimilarQuestion `json:"similarQuestions"` // Contributors []interface{} `json:"contributors"` // LangToValidPlayground LangToValidPlayground `json:"langToValidPlayground"` // TopicTags []QuestionDataTopicTag `json:"topicTags"` // CompanyTagStats interface{} `json:"companyTagStats"` // CodeSnippets []QuestionDataCodeSnippet `json:"codeSnippets"` // Stats Stats `json:"stats"` // Hints []string `json:"hints"` // Solution QuestionDataSolution `json:"solution"` // Status interface{} `json:"status"` // SampleTestCase string `json:"sampleTestCase"` // MetaData MetaData `json:"metaData"` // JudgerAvailable bool `json:"judgerAvailable"` // JudgeType string `json:"judgeType"` // MysqlSchemas []interface{} `json:"mysqlSchemas"` // EnableRunCode bool `json:"enableRunCode"` // EnvInfo EnvInfo `json:"envInfo"` // Book interface{} `json:"book"` // IsSubscribed bool `json:"isSubscribed"` // IsDailyQuestion bool `json:"isDailyQuestion"` // DailyRecordStatus interface{} `json:"dailyRecordStatus"` // EditorType string `json:"editorType"` // UgcQuestionId interface{} `json:"ugcQuestionId"` // Style string `json:"style"` // ExampleTestcases []ExampleTestcase `json:"exampleTestcases"` // JsonExampleTestcases string `json:"jsonExampleTestcases"` // Typename string `json:"__typename"` // }
func (QuestionData) CodeSnippet ¶
func (q QuestionData) CodeSnippet(langSlug string) string
func (QuestionData) Dir ¶
func (q QuestionData) Dir() string
func (QuestionData) NeedDefinition ¶
func (q QuestionData) NeedDefinition() bool
func (QuestionData) NeedMode ¶
func (q QuestionData) NeedMode() bool
func (QuestionData) Pkg ¶
func (q QuestionData) Pkg() string
type QuestionDataCodeSnippet ¶
type QuestionDataQuestion ¶
type QuestionDataQuestion struct { QuestionId string `json:"questionId"` // QuestionFrontendId string `json:"questionFrontendId"` // CategoryTitle string `json:"categoryTitle"` // BoundTopicId int `json:"boundTopicId"` // Title string `json:"title"` // TitleSlug string `json:"titleSlug"` // Content string `json:"content"` // TranslatedTitle string `json:"translatedTitle"` // TranslatedContent string `json:"translatedContent"` // IsPaidOnly bool `json:"isPaidOnly"` // Difficulty string `json:"difficulty"` // Likes int `json:"likes"` // Dislikes int `json:"dislikes"` // IsLiked interface{} `json:"isLiked"` // SimilarQuestions string `json:"similarQuestions"` // json字符串, 需要再次反序列化, 见: SimilarQuestion Contributors []interface{} `json:"contributors"` // LangToValidPlayground string `json:"langToValidPlayground"` // json字符串, 需要再次反序列化, 见: LangToValidPlayground TopicTags []QuestionDataTopicTag `json:"topicTags"` // CompanyTagStats interface{} `json:"companyTagStats"` // CodeSnippets []QuestionDataCodeSnippet `json:"codeSnippets"` // Stats string `json:"stats"` // json字符串, 需要再次反序列化, 见: Stats Hints []string `json:"hints"` // Solution QuestionDataSolution `json:"solution"` // Status interface{} `json:"status"` // SampleTestCase string `json:"sampleTestCase"` // MetaData string `json:"metaData"` // JudgerAvailable bool `json:"judgerAvailable"` // JudgeType string `json:"judgeType"` // MysqlSchemas []interface{} `json:"mysqlSchemas"` // EnableRunCode bool `json:"enableRunCode"` // EnvInfo string `json:"envInfo"` // json字符串, 需要再次反序列化, 见: EnvInfo Book interface{} `json:"book"` // IsSubscribed bool `json:"isSubscribed"` // IsDailyQuestion bool `json:"isDailyQuestion"` // DailyRecordStatus interface{} `json:"dailyRecordStatus"` // EditorType string `json:"editorType"` // UgcQuestionId interface{} `json:"ugcQuestionId"` // Style string `json:"style"` // ExampleTestcases string `json:"exampleTestcases"` // JsonExampleTestcases string `json:"jsonExampleTestcases"` // Typename string `json:"__typename"` // }
func (QuestionDataQuestion) ReUnmarshal ¶
func (q QuestionDataQuestion) ReUnmarshal() (*QuestionData, error)
type QuestionDataReq ¶
type QuestionDataReq struct {
TitleSlug string
}
type QuestionDataRes ¶
type QuestionDataRes struct {
Question QuestionDataQuestion `json:"question"`
}
QuestionDataRes 模板数据
type QuestionDataSolution ¶
type QuestionDataTopicTag ¶
type QuestionOfTodayReq ¶
type QuestionOfTodayReq struct { }
type QuestionOfTodayRes ¶
type QuestionOfTodayRes struct { TodayRecord []struct { Date string `json:"date"` UserStatus string `json:"userStatus"` Question struct { QuestionId string `json:"questionId"` FrontendQuestionId string `json:"frontendQuestionId"` Difficulty string `json:"difficulty"` Title string `json:"title"` TitleCn string `json:"titleCn"` TitleSlug string `json:"titleSlug"` PaidOnly bool `json:"paidOnly"` FreqBar interface{} `json:"freqBar"` IsFavor bool `json:"isFavor"` AcRate float64 `json:"acRate"` Status interface{} `json:"status"` SolutionNum int `json:"solutionNum"` HasVideoSolution bool `json:"hasVideoSolution"` TopicTags []struct { Name string `json:"name"` NameTranslated string `json:"nameTranslated"` Id string `json:"id"` } `json:"topicTags"` Extra struct { TopCompanyTags []interface{} `json:"topCompanyTags"` } `json:"extra"` } `json:"question"` LastSubmission interface{} `json:"lastSubmission"` } `json:"todayRecord"` }
QuestionOfTodayRes 每日一题
type SimilarQuestion ¶
type SolutionArticleReq ¶
type SolutionArticleReq struct {
Slug string
}
type SolutionArticleRes ¶
type SolutionArticleRes struct { SolutionArticle struct { IpRegion string `json:"ipRegion"` RewardEnabled bool `json:"rewardEnabled"` CanEditReward bool `json:"canEditReward"` Uuid string `json:"uuid"` Title string `json:"title"` Slug string `json:"slug"` Sunk bool `json:"sunk"` ChargeType string `json:"chargeType"` Status string `json:"status"` Identifier string `json:"identifier"` CanEdit bool `json:"canEdit"` CanSee bool `json:"canSee"` ReactionType interface{} `json:"reactionType"` ReactionsV2 []struct { Count int `json:"count"` ReactionType string `json:"reactionType"` } `json:"reactionsV2"` Tags []struct { Name string `json:"name"` NameTranslated string `json:"nameTranslated"` Slug string `json:"slug"` TagType string `json:"tagType"` } `json:"tags"` CreatedAt time.Time `json:"createdAt"` Thumbnail string `json:"thumbnail"` Author struct { Username string `json:"username"` IsDiscussAdmin bool `json:"isDiscussAdmin"` IsDiscussStaff bool `json:"isDiscussStaff"` Profile struct { UserAvatar string `json:"userAvatar"` UserSlug string `json:"userSlug"` RealName string `json:"realName"` Reputation int `json:"reputation"` } `json:"profile"` } `json:"author"` Summary string `json:"summary"` Topic struct { Id int `json:"id"` Subscribed bool `json:"subscribed"` CommentCount int `json:"commentCount"` ViewCount int `json:"viewCount"` Post struct { Id int `json:"id"` Status string `json:"status"` VoteStatus int `json:"voteStatus"` IsOwnPost bool `json:"isOwnPost"` } `json:"post"` } `json:"topic"` ByLeetcode bool `json:"byLeetcode"` IsMyFavorite bool `json:"isMyFavorite"` IsMostPopular bool `json:"isMostPopular"` FavoriteCount int `json:"favoriteCount"` IsEditorsPick bool `json:"isEditorsPick"` HitCount int `json:"hitCount"` VideosInfo []struct { VideoId string `json:"videoId"` CoverUrl string `json:"coverUrl"` Duration float64 `json:"duration"` } `json:"videosInfo"` Content string `json:"content"` Next struct { Slug string `json:"slug"` Title string `json:"title"` } `json:"next"` Prev struct { Slug string `json:"slug"` Title string `json:"title"` } `json:"prev"` } `json:"solutionArticle"` }
Click to show internal directories.
Click to hide internal directories.