Struct leetcode_api::leetcode::LeetCode
source · pub struct LeetCode {
pub client: Client,
pub headers: HeaderMap,
}
Expand description
interact with leetcode.com/cn
Fields§
§client: Client
§headers: HeaderMap
Implementations§
source§impl LeetCode
impl LeetCode
sourcepub async fn submit_code(
&self,
idslug: IdSlug
) -> Result<(SubmitInfo, RunResult)>
pub async fn submit_code( &self, idslug: IdSlug ) -> Result<(SubmitInfo, RunResult)>
submit code by id or slug, once submit one question
idslug
: id or slug
sourcepub async fn get_one_submit_res(&self, sub_id: &SubmitInfo) -> Result<RunResult>
pub async fn get_one_submit_res(&self, sub_id: &SubmitInfo) -> Result<RunResult>
Get one submit info
sub_id
: be fetchsubmission_id
sourcepub async fn all_submit_res(&self, idslug: IdSlug) -> Result<SubmissionList>
pub async fn all_submit_res(&self, idslug: IdSlug) -> Result<SubmissionList>
Get all submission results for a question
pub async fn test_code(&self, idslug: IdSlug) -> Result<(TestInfo, RunResult)>
source§impl LeetCode
impl LeetCode
sourcepub async fn sync_problem_index(&self) -> Result<()>
pub async fn sync_problem_index(&self) -> Result<()>
get leetcode index
§Errors
- network error
- leetcode url change
DbErr
force
: when true will force update
sourcepub async fn sync_index_topic(&self) -> Result<()>
pub async fn sync_index_topic(&self) -> Result<()>
get question titleSlug and topicTags info
source§impl LeetCode
impl LeetCode
sourcepub async fn dow_user_avator(&self, status: &UserStatus) -> PathBuf
pub async fn dow_user_avator(&self, status: &UserStatus) -> PathBuf
download user avator image
pub async fn pass_qs_status(&self, user_slug: &str) -> Result<Data>
pub async fn get_points(&self) -> Result<TotalPoints>
pub async fn get_user_info(&self) -> Result<UserStatus>
sourcepub async fn daily_checkin(&self) -> (CheckInData, CheckInData)
pub async fn daily_checkin(&self) -> (CheckInData, CheckInData)
§Ensure that the cookies are obtained
§Example
ⓘ
let status = glob_leetcode()
.await
.get_user_info()?
.unwrap();
// if user_slug is None, the cookies were not obtained
if !status.checked_in_today && status.user_slug.is_some() {
let res = glob_leetcode()
.await
.daily_checkin()
.await;
}
return order (cn, com)
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for LeetCode
impl Send for LeetCode
impl Sync for LeetCode
impl Unpin for LeetCode
impl !UnwindSafe for LeetCode
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
The none-equivalent value.