pub struct Client { /* private fields */ }Implementations§
Source§impl Client
impl Client
pub fn new() -> Result<Self, Error>
Sourcepub async fn problem(
&self,
slug: &str,
progress: impl FnMut(usize, Option<u64>),
) -> Result<Problem, Error>
pub async fn problem( &self, slug: &str, progress: impl FnMut(usize, Option<u64>), ) -> Result<Problem, Error>
Fetch a public problem by its title slug, without authentication
Sourcepub async fn daily(
&self,
progress: impl FnMut(usize, Option<u64>),
) -> Result<Problem, Error>
pub async fn daily( &self, progress: impl FnMut(usize, Option<u64>), ) -> Result<Problem, Error>
Fetch today’s public daily challenge, without authentication
Sourcepub async fn search(
&self,
query: &str,
progress: impl FnMut(usize, Option<u64>),
) -> Result<SearchResults, Error>
pub async fn search( &self, query: &str, progress: impl FnMut(usize, Option<u64>), ) -> Result<SearchResults, Error>
Search public problems by title keywords, without authentication
Sourcepub async fn list(
&self,
difficulty: Option<Difficulty>,
tag: Option<&str>,
progress: impl FnMut(usize, Option<u64>),
) -> Result<SearchResults, Error>
pub async fn list( &self, difficulty: Option<Difficulty>, tag: Option<&str>, progress: impl FnMut(usize, Option<u64>), ) -> Result<SearchResults, Error>
List public problems with optional difficulty and tag filters, without authentication
Sourcepub async fn auth_status(
&self,
credentials: &Credentials,
) -> Result<bool, Error>
pub async fn auth_status( &self, credentials: &Credentials, ) -> Result<bool, Error>
Confirm whether credentials describe a signed-in LeetCode session
Sourcepub async fn account_stats(
&self,
credentials: &Credentials,
) -> Result<AccountStats, Error>
pub async fn account_stats( &self, credentials: &Credentials, ) -> Result<AccountStats, Error>
Fetch bounded account progress and recent submissions for a signed-in session
Sourcepub async fn contests(
&self,
progress: impl FnMut(usize, Option<u64>),
) -> Result<Vec<ContestSummary>, Error>
pub async fn contests( &self, progress: impl FnMut(usize, Option<u64>), ) -> Result<Vec<ContestSummary>, Error>
List the upcoming public contests
Sourcepub async fn contest(
&self,
slug: &str,
progress: impl FnMut(usize, Option<u64>),
) -> Result<ContestSummary, Error>
pub async fn contest( &self, slug: &str, progress: impl FnMut(usize, Option<u64>), ) -> Result<ContestSummary, Error>
Fetch one public contest by its title slug
Sourcepub async fn contest_registration(
&self,
slug: &str,
credentials: &Credentials,
progress: impl FnMut(usize, Option<u64>),
) -> Result<ContestRegistration, Error>
pub async fn contest_registration( &self, slug: &str, credentials: &Credentials, progress: impl FnMut(usize, Option<u64>), ) -> Result<ContestRegistration, Error>
Fetch the signed-in participant’s registration state for one contest
Sourcepub async fn trending_discussions(
&self,
progress: impl FnMut(usize, Option<u64>),
) -> Result<DiscussionList, Error>
pub async fn trending_discussions( &self, progress: impl FnMut(usize, Option<u64>), ) -> Result<DiscussionList, Error>
List ten public discussions currently trending on LeetCode
Sourcepub async fn problem_discussions(
&self,
slug: &str,
progress: impl FnMut(usize, Option<u64>),
) -> Result<DiscussionList, Error>
pub async fn problem_discussions( &self, slug: &str, progress: impl FnMut(usize, Option<u64>), ) -> Result<DiscussionList, Error>
List the twenty newest public discussions for a problem
Sourcepub async fn discussion(
&self,
topic_id: u32,
progress: impl FnMut(usize, Option<u64>),
) -> Result<Discussion, Error>
pub async fn discussion( &self, topic_id: u32, progress: impl FnMut(usize, Option<u64>), ) -> Result<Discussion, Error>
Fetch one public discussion and its Markdown post
Sourcepub async fn starter(
&self,
slug: &str,
progress: impl FnMut(usize, Option<u64>),
) -> Result<StarterCode, Error>
pub async fn starter( &self, slug: &str, progress: impl FnMut(usize, Option<u64>), ) -> Result<StarterCode, Error>
Fetch every public starter source for a problem
Sourcepub async fn test_cases(
&self,
slug: &str,
progress: impl FnMut(usize, Option<u64>),
) -> Result<TestCases, Error>
pub async fn test_cases( &self, slug: &str, progress: impl FnMut(usize, Option<u64>), ) -> Result<TestCases, Error>
Fetch public example input for LeetCode’s remote run-code endpoint
Sourcepub async fn run(
&self,
credentials: &Credentials,
slug: &str,
question_id: &str,
language: &str,
source: &str,
input: &str,
) -> Result<Box<str>, Error>
pub async fn run( &self, credentials: &Credentials, slug: &str, question_id: &str, language: &str, source: &str, input: &str, ) -> Result<Box<str>, Error>
Run source once against public example input; this never creates a submission
Sourcepub async fn run_result(
&self,
credentials: &Credentials,
id: &str,
) -> Result<RunState, Error>
pub async fn run_result( &self, credentials: &Credentials, id: &str, ) -> Result<RunState, Error>
Read one remote run status without polling
Sourcepub async fn submit(
&self,
credentials: &Credentials,
slug: &str,
question_id: &str,
language: &str,
source: &str,
) -> Result<u64, Error>
pub async fn submit( &self, credentials: &Credentials, slug: &str, question_id: &str, language: &str, source: &str, ) -> Result<u64, Error>
Submit source once; callers own subsequent status polling
Sourcepub async fn submission(
&self,
credentials: &Credentials,
id: u64,
) -> Result<SubmissionState, Error>
pub async fn submission( &self, credentials: &Credentials, id: u64, ) -> Result<SubmissionState, Error>
Read one submission status without polling