leetcodeclient

package
v3.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LeetCodeGraphQlClient

type LeetCodeGraphQlClient struct {
	// contains filtered or unexported fields
}

LeetCodeGraphQlClient realization of GraphQL client. Potentially supports different requester types

func NewLeetCodeGraphQlClient

func NewLeetCodeGraphQlClient() *LeetCodeGraphQlClient

NewLeetCodeGraphQlClient construct LeetCode client with default values

func (*LeetCodeGraphQlClient) GetDailyQuestionSlug

func (c *LeetCodeGraphQlClient) GetDailyQuestionSlug(ctx context.Context, date time.Time) (string, error)

GetDailyQuestionSlug provides slug for daily for the particular date

func (*LeetCodeGraphQlClient) GetDailyTask

func (c *LeetCodeGraphQlClient) GetDailyTask(ctx context.Context, date time.Time) (LeetCodeTask, error)

GetDailyTask shortcut of GetDailyTaskItemID and GetQuestionDetailsByTitleSlug

func (*LeetCodeGraphQlClient) GetQuestionDetailsByTitleSlug

func (c *LeetCodeGraphQlClient) GetQuestionDetailsByTitleSlug(ctx context.Context, titleSlug string) (LeetCodeTask, error)

GetQuestionDetailsByTitleSlug provides all details of the question: title, text, hints, difficulty by provided titleSlug

type LeetCodeTask

type LeetCodeTask struct {
	QuestionID uint64   `json:"questionId,string"`
	TitleSlug  string   `json:"titleSlug"`
	Title      string   `json:"questionTitle"`
	Content    string   `json:"content"`
	Hints      []string `json:"hints"`
	Difficulty string   `json:"difficulty"`
}

LeetCodeTask is a necessary information about task at LeetCode

type LeetcodeClient

type LeetcodeClient interface {
	GetDailyQuestionSlug(context.Context, time.Time) (string, error)
	GetQuestionDetailsByTitleSlug(context.Context, string) (LeetCodeTask, error)
	GetDailyTask(context.Context, time.Time) (LeetCodeTask, error)
}

LeetcodeClient represents abstract set of methods required from any possible kind of Leetcode client

type LeetcodeDate

type LeetcodeDate time.Time

LeetcodeDate time.Time with specific json unmarshaller to parse json dates

func (*LeetcodeDate) UnmarshalJSON

func (j *LeetcodeDate) UnmarshalJSON(b []byte) error

UnmarshalJSON parsing date in format "2006-01-02" in json

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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