@@ -7,10 +7,10 @@ impl LeetCode<Authorized> {
77 let query = GraphqlRequest {
88 query : "\n query questionOfToday {\n activeDailyCodingChallengeQuestion {\n date\n userStatus\n link\n question {\n acRate\n difficulty\n freqBar\n frontendQuestionId: questionFrontendId\n isFavor\n paidOnly: isPaidOnly\n status\n title\n titleSlug\n hasVideoSolution\n hasSolution\n topicTags {\n name\n id\n slug\n }\n }\n }\n }\n " . to_string ( ) ,
99 variables : "{}" . to_string ( ) ,
10- } ;
10+ } ;
1111 let Ok ( data) = client. post ( url) . json ( & query) . send ( ) else {
12- return Err ( "Failed to fetch daily challenge from leetcode!" ) ;
13- } ;
12+ return Err ( "Failed to fetch daily challenge from leetcode!" ) ;
13+ } ;
1414 // println!("{:?}", data.text());
1515 // todo!();
1616 #[ derive( Deserialize ) ]
@@ -32,10 +32,10 @@ impl LeetCode<Authorized> {
3232 pub fn get_metadata ( & self ) -> Result < UserMetadata , & str > {
3333 let client = & self . client ;
3434 let Ok ( data) = client
35- . get ( "https://leetcode.com/api/problems/all/" )
36- . send ( ) else {
37- return Err ( "Failed to fetch metadata from leetcode!" ) ;
38- } ;
35+ . get ( "https://leetcode.com/api/problems/all/" )
36+ . send ( ) else {
37+ return Err ( "Failed to fetch metadata from leetcode!" ) ;
38+ } ;
3939
4040 let metadata = data
4141 . json :: < UserMetadata > ( )
@@ -52,13 +52,13 @@ impl LeetCode<Authorized> {
5252 let client = & self . client ;
5353 let url = "https://leetcode.com/graphql" ;
5454 let query = GraphqlRequest {
55- query : "query questionContent($titleSlug: String!) { question(titleSlug: $titleSlug) { content mysqlSchemas }}" . to_string ( ) ,
56- variables : serde_json:: to_string ( & Variables { titleSlug : title_slug. to_string ( ) } ) . unwrap ( ) ,
57- } ;
55+ query : "query questionContent($titleSlug: String!) { question(titleSlug: $titleSlug) { content mysqlSchemas }}" . to_string ( ) ,
56+ variables : serde_json:: to_string ( & Variables { titleSlug : title_slug. to_string ( ) } ) . unwrap ( ) ,
57+ } ;
5858
5959 let Ok ( data) = client. post ( url) . json ( & query) . send ( ) else {
60- return Err ( "Failed to fetch question id from leetcode!" ) ;
61- } ;
60+ return Err ( "Failed to fetch question id from leetcode!" ) ;
61+ } ;
6262 #[ derive( Deserialize ) ]
6363 struct QuestionWrapper {
6464 question : LeetcodeQuestion ,
@@ -80,9 +80,9 @@ impl LeetCode<Authorized> {
8080 query : query. to_string ( ) ,
8181 variables : varibales,
8282 } )
83- . send ( ) else {
83+ . send ( ) else {
8484 return Err ( "Failed to fetch boiler plate code!" ) ;
85- } ;
85+ } ;
8686
8787 #[ derive( Debug , Deserialize ) ]
8888 #[ allow( non_snake_case) ]
@@ -161,12 +161,12 @@ impl LeetCode<Authorized> {
161161 let url = "https://leetcode.com/graphql" ;
162162
163163 let query = GraphqlRequest {
164- query : "\n query consolePanelConfig($titleSlug: String!) {\n question(titleSlug: $titleSlug) {\n questionId\n questionFrontendId\n questionTitle\n enableDebugger\n enableRunCode\n enableSubmit\n enableTestMode\n exampleTestcaseList\n metaData\n }\n }\n " . to_string ( ) ,
165- variables : serde_json:: to_string ( & Variables { titleSlug : title_slug. to_string ( ) } ) . unwrap ( ) ,
166- } ;
164+ query : "\n query consolePanelConfig($titleSlug: String!) {\n question(titleSlug: $titleSlug) {\n questionId\n questionFrontendId\n questionTitle\n enableDebugger\n enableRunCode\n enableSubmit\n enableTestMode\n exampleTestcaseList\n metaData\n }\n }\n " . to_string ( ) ,
165+ variables : serde_json:: to_string ( & Variables { titleSlug : title_slug. to_string ( ) } ) . unwrap ( ) ,
166+ } ;
167167 let Ok ( data) = client. post ( url) . json ( & query) . send ( ) else {
168- return Err ( "Failed to fetch question id from leetcode!" ) ;
169- } ;
168+ return Err ( "Failed to fetch question id from leetcode!" ) ;
169+ } ;
170170
171171 #[ derive( Debug , Deserialize ) ]
172172 struct QuestionWrapper {
0 commit comments