client

package
v0.0.0-...-4c0342d Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Algorithm

type Algorithm struct {
	Stat       Stat   `json:"stat"`
	Status     string `json:"status"`
	PaidOnly   bool   `json:"paid_only"`
	IsFavor    bool   `json:"is_favor"`
	Difficulty Level  `json:"difficulty"`
	Frequency  int    `json:frequency`
	Progress   int    `json:"progress"`
}

type AlgorithmList

type AlgorithmList struct {
	UserName          string      `json:"user_name"`
	NumSolved         int         `json:"num_solved"`
	NumTotal          int         `json:"num_total"`
	AcEasy            int         `json:"ac_easy"`
	AcMedium          int         `json:"ac_medium"`
	AcHard            int         `json:"ac_hard"`
	Stat_status_pairs []Algorithm `json:"stat_status_pairs"`
}

type CodeSnippet

type CodeSnippet struct {
	Lang     string `json:"lang"`
	LangSlug string `json:"langSlug"`
	Code     string `json:"code"`
}

type ConnectionInfo

type ConnectionInfo struct {
	Cookies []*http.Cookie
}

func NewConnectionInfo

func NewConnectionInfo(cookies []*http.Cookie) ConnectionInfo

type ConnectionInfoGetter

type ConnectionInfoGetter interface {
	GetConnectionInfo(username string) (ConnectionInfo, error)
}

type HistoryReturn

type HistoryReturn struct {
	List SubmissionList `json:"submissionList"`
}

type HistoryReturnShell

type HistoryReturnShell struct {
	Data HistoryReturn `json:"data"`
}

type Leetcode

type Leetcode struct {
	Username string
	Password string
}

func NewLeetcodeClient

func NewLeetcodeClient(username string, password string) *Leetcode

func (*Leetcode) History

func (l *Leetcode) History(titleSlug string, limit int, cookies []*http.Cookie) ([]byte, error)

func (*Leetcode) Login

func (l *Leetcode) Login() ([]*http.Cookie, error)

func (*Leetcode) Problem

func (l *Leetcode) Problem(category string, num int)

func (*Leetcode) ProblemDetail

func (l *Leetcode) ProblemDetail(titleSlug string, cookies []*http.Cookie) ([]byte, error)

func (*Leetcode) ProblemList

func (l *Leetcode) ProblemList(cookies []*http.Cookie) ([]byte, error)

func (*Leetcode) Submit

func (l *Leetcode) Submit(titleSlug string, body string, cookies []*http.Cookie) ([]byte, error)

type LeetcodeClientConfig

type LeetcodeClientConfig struct {
	BasicURL       string
	LoginPath      string
	AlgorithmsPath string
	GraphqlPath    string
	ProblemsPath   string
}

type Level

type Level struct {
	Level int `json:"level"`
}

type Question

type Question struct {
	TypeName           string        `json:"__typename"`
	LibraryUrl         string        `json:"libraryUrl"`
	Content            string        `json:"content"`
	Difficulty         string        `json:"difficulty"`
	Dislikes           int           `json:"dislikes"`
	Hints              []string      `json:"hints"`
	Metadata           string        `json:"metadata"`
	QuestionId         string        `json:"questionId"`
	QuestionFrontendId string        `json:"questionFrontendId"`
	SampleTestCase     string        `json:"sampleTestCase"`
	Title              string        `json:"title"`
	TitleSlug          string        `json:"titleSlug"`
	CodeSnippets       []CodeSnippet `json:"codeSnippets"`
}

type QuestionMiddle

type QuestionMiddle struct {
	Data Question `json:"question"`
}

type QuestionReturn

type QuestionReturn struct {
	Real QuestionMiddle `json:"data"`
}

type Spider

type Spider interface {
	Login() ([]*http.Cookie, error)
	ProblemList(cookies []*http.Cookie) ([]byte, error)
	ProblemDetail(titleSlug string, cookies []*http.Cookie) ([]byte, error)
	// AlgorithmsList()
	// AlgorithmsDetail()
	// AllProblems()
	Submit(titleSlug string, body string, cookies []*http.Cookie) ([]byte, error)
	History(titleSlug string, limit int, cookies []*http.Cookie) ([]byte, error)
}

type Stat

type Stat struct {
	QuestionID           int    `json:"question_id"`
	QuestionArticleLive  bool   `json:"question__article__live"`
	QuestionArticleSlug  string `json:"question__article__slug"`
	QuestionTitle        string `json:"question__title"`
	QuestionTitleSlug    string `json:"question__title_slug"`
	QuestionHide         bool   `json:"question_hide"`
	TotalAcs             int    `json:"total_acs"`
	TotalSubmmitted      int    `json:"total_submitted"`
	Frontend_question_id int    `json:"frontend_question_id"`
	IsNewQuestion        bool   `json:"is_new_question"`
}

type Submission

type Submission struct {
	Id            string `json:"id"`
	StatusDisplay string `json:"statusDisplay"`
	Lang          string `json:"lang"`
	Runtime       string `json:"runtime"`
	TimeStamp     string `json:"timestamp"`
	Url           string `json:"url"`
	IsPending     string `json:"isPending"`
	Memory        string `json:"memory"`
	TypeName      string `json:"__typename"`
}

type SubmissionList

type SubmissionList struct {
	LastKey     string       `json:"lastKey"`
	HasNext     bool         `json:"hasNext"`
	Submissions []Submission `json:"submissions"`
	TypeName    string       `json:"__typename"`
}

Jump to

Keyboard shortcuts

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