leetcodeapi

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2023 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RemoveCredentials

func RemoveCredentials()

func SetCredentials

func SetCredentials(session string, csrfToken string)

Types

type AcSubmission

type AcSubmission struct {
	Id        string `json:"id"`
	Timestamp string `json:"timestamp"`
	Title     string `json:"title"`
	TitleSlug string `json:"titleSlug"`
}

func GetUserRecentAcSubmissions

func GetUserRecentAcSubmissions(username string, pageSize int) ([]AcSubmission, error)

type Author

type Author struct {
	ActiveBadge    Badge         `json:"activeBadge,omitempty"`
	IsActive       bool          `json:"isActive,omitempty"`
	IsDiscussAdmin bool          `json:"isDiscussAdmin,omitempty"`
	IsDiscussStaff bool          `json:"isDiscussStaff,omitempty"`
	NameColor      string        `json:"nameColor,omitempty"`
	Profile        AuthorProfile `json:"profile,omitempty"`
	Username       string        `json:"username"`
}

type AuthorProfile

type AuthorProfile struct {
	Reputation int    `json:"reputation,omitempty"`
	UserAvatar string `json:"userAvatar,omitempty"`
}

type Badge

type Badge struct {
	DisplayName string `json:"displayName,omitempty"`
	Icon        string `json:"icon,omitempty"`
}

type CoinReward

type CoinReward struct {
	Date        string `json:"date"`
	Description string `json:"description"`
	Id          string `json:"id"`
	Score       int    `json:"score"`
}

type Comment

type Comment struct {
	Id          int64 `json:"id,omitempty"`
	NumChildren int   `json:"numChildren,omitempty"`
	Pinned      bool  `json:"pinned,omitempty"`
	Post        Post  `json:"post"`
}

func GetCommentReplies

func GetCommentReplies(commentId int64) ([]Comment, error)

func GetDiscussionComments

func GetDiscussionComments(topicId int64, orderBy string, offset int, pageSize int) ([]Comment, error)

type Company

type Company struct {
	Description string `json:"description"`
	Name        string `json:"name"`
}

type Contest

type Contest struct {
	Company         Company              `json:"company"`
	ContainsPremium bool                 `json:"containsPremium"`
	ContestMeta     ContestMeta          `json:"contest"`
	Questions       []ContestProblemInfo `json:"questions"`
	Registered      bool                 `json:"registered"`
}

func GetContestInfo

func GetContestInfo(contestSlug string) (Contest, error)

type ContestMeta

type ContestMeta struct {
	Description     string `json:"description"`
	DiscussTopicId  int64  `json:"discuss_topic_id"`
	Duration        int64  `json:"duration"`
	Id              int64  `json:"id"`
	IsPrivate       bool   `json:"is_private"`
	IsVirtual       bool   `json:"is_virtual"`
	OriginStartTime int64  `json:"origin_start_time"`
	StartTime       int64  `json:"start_time"`
	Title           string `json:"title"`
	TitleSlug       string `json:"title_slug"`
}

type ContestProblemInfo

type ContestProblemInfo struct {
	Credit     int    `json:"credit"`
	Id         int    `json:"id"`
	QuestionId int    `json:"question_id"`
	Title      string `json:"title"`
	TitleSlug  string `json:"title_slug"`
}

type ContestRanking

type ContestRanking struct {
	IsPast      bool                             `json:"is_past"`
	Questions   []ContestProblemInfo             `json:"questions"`
	Ranks       []ParticipantDetails             `json:"total_rank"`
	Submissions []map[string]SubmissionInContest `json:"submissions"`
	Time        float64                          `json:"time"`
	TotalUser   int                              `json:"user_num"`
	TotalPage   int
}

func GetContestRanking

func GetContestRanking(contestSlug string, page int) (ContestRanking, error)

type DifficultyCount

type DifficultyCount struct {
	Count      int    `json:"count"`
	Difficulty string `json:"difficulty"`
}

type DifficultyPercentage

type DifficultyPercentage struct {
	Percentage float32 `json:"percentage"`
	Difficulty string  `json:"difficulty"`
}

type Discussion

type Discussion struct {
	HideFromTrending     bool     `json:"hideFromTrending"`
	Id                   int64    `json:"id"`
	Pinned               bool     `json:"pinned"`
	Post                 Post     `json:"post"`
	Subscribed           bool     `json:"subscribed"`
	Tags                 []string `json:"tags"`
	Title                string   `json:"title"`
	TopLevelCommentCount int      `json:"topLevelCommentCount"`
	ViewCount            int      `json:"viewCount"`
}

func GetDiscussion

func GetDiscussion(topicId int64) (Discussion, error)

type DiscussionList

type DiscussionList struct {
	Data     []DiscussionListItem `json:"edges"`
	TotalNum int                  `json:"totalNum"`
}

func GetDiscussions

func GetDiscussions(categories []string, tags []string, orderBy string, searchQuery string, offset int) (DiscussionList, error)

type DiscussionListItem

type DiscussionListItem struct {
	Cursor string         `json:"cursor"`
	Node   DiscussionNode `json:"node"`
}

type DiscussionNode

type DiscussionNode struct {
	CommentCount int     `json:"commentCount"`
	Id           string  `json:"id"`
	LastComment  Comment `json:"lastComment"`
	Pinned       bool    `json:"pinned"`
	Post         Post    `json:"post"`
	Tags         []struct {
		Name string `json:"name"`
		Slug string `json:"slug"`
	} `json:"tags"`
	Title     string `json:"title"`
	ViewCount int    `json:"viewCount"`
}

type IQuery

type IQuery interface {
	// contains filtered or unexported methods
}

type IUtil

type IUtil interface {
	MakeGraphQLRequest(payload string, resultRef interface{}) error
	// contains filtered or unexported methods
}

type ParticipantDetails

type ParticipantDetails struct {
	ContestId     int    `json:"contest_id"`
	CountryCode   string `json:"country_code"`
	CountryName   string `json:"country_name"`
	DataRegion    string `json:"data_region"`
	FinishTime    int64  `json:"finish_time"`
	GlobalRanking int    `json:"global_ranking"`
	Rank          int    `json:"rank"`
	Score         int    `json:"score"`
	UserBadge     struct {
		DisplayName string `json:"display_name"`
		Icon        string `json:"icon"`
	} `json:"user_badge"`
	UserSlug      string `json:"user_slug"`
	Username      string `json:"username"`
	UsernameColor string `json:"username_color"`
}

type Post

type Post struct {
	Id                int          `json:"id"`
	Author            Author       `json:"author,omitempty"`
	AuthorIsModerator bool         `json:"authorIsModerator,omitempty"`
	CoinRewards       []CoinReward `json:"coinRewards,omitempty"`
	Content           string       `json:"content,omitempty"`
	CreationDate      int64        `json:"creationDate,omitempty"`
	IsHidden          bool         `json:"isHidden,omitempty"`
	IsOwnPost         bool         `json:"isOwnPost,omitempty"`
	Status            string       `json:"status,omitempty"`
	UpdationDate      int64        `json:"updationDate,omitempty"`
	VoteCount         int          `json:"voteCount,omitempty"`
	VoteStatus        int          `json:"voteStatus,omitempty"`
}

type Problem

type Problem struct {
	AcRate             float32    `json:"acRate"`
	Difficulty         string     `json:"difficulty"`
	FreqBar            float32    `json:"freqBar"`
	FrontendQuestionId string     `json:"frontendQuestionId"`
	IsFavor            bool       `json:"isFavor"`
	PaidOnly           bool       `json:"paidOnly"`
	Status             string     `json:"status"`
	QuestionId         string     `json:"questionId"`
	Title              string     `json:"title"`
	TitleSlug          string     `json:"titleSlug"`
	Stats              string     `json:"stats"`
	TopicTags          []TopicTag `json:"topicTags"`
}

type ProblemContent

type ProblemContent struct {
	Content string `json:"content"`
}

func GetProblemContentByTitleSlug

func GetProblemContentByTitleSlug(titleSlug string) (ProblemContent, error)

type ProblemList

type ProblemList struct {
	Total    int       `json:"total"`
	Problems []Problem `json:"questions"`
}

func GetAllProblems

func GetAllProblems(offset int, pageSize int) (ProblemList, error)

func GetTopInterviewProblems

func GetTopInterviewProblems(offset int, pageSize int) (ProblemList, error)

type ProblemsByTopic

type ProblemsByTopic struct {
	TopicName string    `json:"name"`
	TopicSlug string    `json:"slug"`
	Questions []Problem `json:"questions"`
}

func GetProblemsByTopic

func GetProblemsByTopic(topicSlug string) (ProblemsByTopic, error)

type SubmissionInContest

type SubmissionInContest struct {
	ContestId    int    `json:"contest_id"`
	DataRegion   string `json:"data_region"`
	Date         int64  `json:"date"`
	FailCount    int    `json:"fail_count"`
	Id           int    `json:"id"`
	QuestionId   int    `json:"question_id"`
	Status       int    `json:"status"`
	SubmissionId int64  `json:"submission_id"`
}

type TagCount

type TagCount struct {
	ProblemsSolved int    `json:"problemsSolved"`
	TagName        string `json:"tagName"`
	TagSlug        string `json:"tagSlug"`
}

type TagProblemCounts

type TagProblemCounts struct {
	Advanced     []TagCount `json:"advanced"`
	Fundamental  []TagCount `json:"fundamental"`
	Intermediate []TagCount `json:"intermediate"`
}

func GetUserSolveCountByProblemTag

func GetUserSolveCountByProblemTag(username string) (TagProblemCounts, error)

type TopicTag

type TopicTag struct {
	Id   string `json:"id"`
	Name string `json:"name"`
	Slug string `json:"slug"`
}

type UserCalendar

type UserCalendar struct {
	ActiveYears []int `json:"activeYears"`
	DccBadges   []struct {
		Badge struct {
			Icon string `json:"icon"`
			Name string `json:"name"`
		} `json:"badge"`
		Timestamp int64 `json:"timestamp"`
	} `json:"dccBadges"`
	Streak             int    `json:"streak"`
	SubmissionCalendar string `json:"submissionCalendar"`
	TotalActiveDays    int    `json:"totalActiveDays"`
}

func GetUserProfileCalendar

func GetUserProfileCalendar(username string) (UserCalendar, error)

type UserContestRanking

type UserContestRanking struct {
	AttendedContestsCount int `json:"attendedContestsCount"`
	Badge                 struct {
		Name string `json:"name"`
	} `json:"badge"`
	GlobalRanking     int     `json:"globalRanking"`
	Rating            float32 `json:"rating"`
	TopPercentage     float32 `json:"topPercentage"`
	TotalParticipants int     `json:"totalParticipants"`
}

type UserContestRankingDetails

type UserContestRankingDetails struct {
	UserContestRanking        UserContestRanking          `json:"userContestRanking"`
	UserContestRankingHistory []UserContestRankingHistory `json:"userContestRankingHistory"`
}

func GetUserContestRankingHistory

func GetUserContestRankingHistory(username string) (UserContestRankingDetails, error)

type UserContestRankingHistory

type UserContestRankingHistory struct {
	Attended bool `json:"attended"`
	Contest  struct {
		Title     string `json:"title"`
		StartTime int64  `json:"startTime"`
	} `json:"contest"`
	FinishTimeInSeconds int     `json:"finishTimeInSeconds"`
	ProblemsSolved      int     `json:"problemsSolved"`
	Ranking             int     `json:"ranking"`
	Rating              float32 `json:"rating"`
	TotalProblems       int     `json:"totalProblems"`
	TrendDirection      string  `json:"trendDirection"`
}

type UserProfile

type UserProfile struct {
	AboutMe                  string   `json:"aboutMe"`
	CategoryDiscussCount     int      `json:"categoryDiscussCount"`
	CategoryDiscussCountDiff int      `json:"categoryDiscussCountDiff"`
	Company                  string   `json:"company"`
	CountryName              string   `json:"countryName"`
	JobTitle                 string   `json:"jobTitle"`
	PostViewCount            int      `json:"postViewCount"`
	PostViewCountDiff        int      `json:"postViewCountDiff"`
	Ranking                  int      `json:"ranking"`
	RealName                 string   `json:"realName"`
	Reputation               int      `json:"reputation"`
	ReputationDiff           int      `json:"reputationDiff"`
	School                   string   `json:"school"`
	SkillTags                []string `json:"skillTags"`
	SolutionCount            int      `json:"solutionCount"`
	SolutionCountDiff        int      `json:"solutionCountDiff"`
	UserAvatar               string   `json:"userAvatar"`
	Websites                 []string `json:"websites"`
}

type UserPublicProfile

type UserPublicProfile struct {
	ContestBadge struct {
		Expired   bool   `json:"expired"`
		HoverText string `json:"hoverText"`
		Icon      string `json:"icon"`
		Name      string `json:"name"`
	} `json:"contestBadge"`
	GithubUrl   string      `json:"githubUrl"`
	LinkedinUrl string      `json:"linkedinUrl"`
	Profile     UserProfile `json:"profile"`
	TwitterUrl  string      `json:"twitterUrl"`
	Username    string      `json:"username"`
}

func GetUserPublicProfile

func GetUserPublicProfile(username string) (UserPublicProfile, error)

type UserSolveCountByDifficulty

type UserSolveCountByDifficulty struct {
	BeatsStats        []DifficultyPercentage `json:"problemsSolvedBeatsStats"`
	SubmitStatsGlobal struct {
		AcSubmissionNum []DifficultyCount `json:"acSubmissionNum"`
	} `json:"submitStatsGlobal"`
}

type UserSolveCountByDifficultyDetails

type UserSolveCountByDifficultyDetails struct {
	AllQuestionsCount []DifficultyCount          `json:"allQuestionsCount"`
	SolveCount        UserSolveCountByDifficulty `json:"matchedUser"`
}

func GetUserSolveCountByDifficulty

func GetUserSolveCountByDifficulty(username string) (UserSolveCountByDifficultyDetails, error)

type Util

type Util struct{}

func (*Util) MakeGraphQLRequest

func (u *Util) MakeGraphQLRequest(payload string, resultRef interface{}) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL