Documentation ¶
Index ¶
Constants ¶
const RandomQuestionQuery = `` /* 176-byte string literal not displayed */
The GraphQL query to fetch a random LeetCode question.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
The LeetCode API client.
func NewClient ¶
func NewClient() Client
NewClient builds and returns a LeetCode API client ready for use.
func (Client) RandomQuestion ¶
func (l Client) RandomQuestion(difficulty Difficulty) (RandomQuestionResponse, error)
RandomQuestion retrieves a random LeetCode problem.
type Difficulty ¶
type Difficulty string
Difficulty represents the difficulty of LeetCode questions.
const ( DifficultyEasy Difficulty = "EASY" DifficultyMedium Difficulty = "MEDIUM" DifficultyHard Difficulty = "HARD" )
The enumeration of difficulties.
func RandomDifficulty ¶
func RandomDifficulty() Difficulty
RandomDifficulty computes a random LeetCode problem difficulty.
type RandomQuestionFilters ¶
type RandomQuestionFilters struct { Difficulty Difficulty `json:"difficulty"` Tags []string `json:"tags,omitempty"` }
RandomQuestionFilters are filters that can be set on the request to the randomQuestion GraphQL API.
type RandomQuestionRequest ¶
type RandomQuestionRequest struct { Query string `json:"query"` Variables RandomQuestionVariables `json:"variables"` }
RandomQuestionRequest is the request that's sent to the randomQuestion GraphQL API.
type RandomQuestionResponse ¶
type RandomQuestionResponse struct { Data struct { RandomQuestion struct { TitleSlug string `json:"titleSlug"` } `json:"randomQuestion"` } `json:"data"` }
RandomQuestionResponse is the response sent back from the randomQuestion GraphQL API.
type RandomQuestionVariables ¶
type RandomQuestionVariables struct { CategorySlug string `json:"categorySlug"` Filters RandomQuestionFilters `json:"filters"` }
RandomQuestionVariables are variables that can be set on the request to the randomQuestion GraphQL API.