@@ -7,7 +7,34 @@ impl LeetCode<Authorized> {
77 let url = "https://leetcode.com/graphql" ;
88 let client = & self . client ;
99 let query = GraphqlRequest {
10- 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 ( ) ,
10+ query : r#"
11+ query questionOfToday {
12+ activeDailyCodingChallengeQuestion {
13+ date
14+ userStatus
15+ link
16+ question {
17+ acRate
18+ difficulty
19+ freqBar
20+ frontendQuestionId: questionFrontendId
21+ isFavor
22+ paidOnly: isPaidOnly
23+ status
24+ title
25+ titleSlug
26+ hasVideoSolution
27+ hasSolution
28+ topicTags {
29+ name
30+ id
31+ slug
32+ }
33+ }
34+ }
35+ }
36+ "#
37+ . to_string ( ) ,
1138 variables : "{}" . to_string ( ) ,
1239 } ;
1340
@@ -52,8 +79,17 @@ impl LeetCode<Authorized> {
5279 let client = & self . client ;
5380 let url = "https://leetcode.com/graphql" ;
5481 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 ( ) ,
82+ query : r#"
83+ query questionContent($titleSlug: String!) {
84+ question(titleSlug: $titleSlug) {
85+ content mysqlSchemas
86+ }
87+ }
88+ "#
89+ . to_string ( ) ,
90+ variables : serde_json:: to_string ( & Variables {
91+ titleSlug : title_slug. to_string ( ) ,
92+ } ) ?,
5793 } ;
5894
5995 let data = client. post ( url) . json ( & query) . send ( ) ?;
@@ -67,7 +103,21 @@ impl LeetCode<Authorized> {
67103 data : QuestionWrapper ,
68104 }
69105
70- let query = "\n query questionEditorData($titleSlug: String!) {\n question(titleSlug: $titleSlug) {\n questionId\n questionFrontendId\n codeSnippets {\n lang\n langSlug\n code\n }\n envInfo\n enableRunCode\n }\n }\n " ;
106+ let query = r#"
107+ query questionEditorData($titleSlug: String!) {
108+ question(titleSlug: $titleSlug) {
109+ questionId
110+ questionFrontendId
111+ codeSnippets {
112+ lang
113+ langSlug
114+ code
115+ }
116+ envInfo
117+ enableRunCode
118+ }
119+ }
120+ "# ;
71121 let varibales = serde_json:: to_string ( & Variables {
72122 titleSlug : title_slug. to_string ( ) ,
73123 } ) ?;
@@ -121,15 +171,15 @@ impl LeetCode<Authorized> {
121171 } ;
122172
123173 let mut input = String :: new ( ) ;
124- println ! ( "Filename (main.{}) : " , & ( boiler_code. extension( ) ) ) ;
174+ println ! ( "Filename (main.{}) : " , & ( boiler_code. extension( ) ? ) ) ;
125175 std:: io:: stdin ( ) . read_line ( & mut input) ?;
126176 let input = input. trim ( ) ;
127177 let filename = if input. is_empty ( ) {
128- format ! ( "main.{}" , boiler_code. extension( ) )
178+ format ! ( "main.{}" , boiler_code. extension( ) ? )
129179 } else {
130180 input. to_string ( )
131181 } ;
132- boiler_code. save_code ( & filename, & title_slug) ;
182+ boiler_code. save_code ( & filename, & title_slug) ? ;
133183
134184 Ok ( data. json :: < Data > ( ) . map ( |op| op. data . question ) ?)
135185 }
@@ -139,8 +189,25 @@ impl LeetCode<Authorized> {
139189 let url = "https://leetcode.com/graphql" ;
140190
141191 let query = GraphqlRequest {
142- 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 ( ) ,
143- variables : serde_json:: to_string ( & Variables { titleSlug : title_slug. to_string ( ) } ) . unwrap ( ) ,
192+ query : r#"
193+ query consolePanelConfig($titleSlug: String!) {
194+ question(titleSlug: $titleSlug) {
195+ questionId
196+ questionFrontendId
197+ questionTitle
198+ enableDebugger
199+ enableRunCode
200+ enableSubmit
201+ enableTestMode
202+ exampleTestcaseList
203+ metaData
204+ }
205+ }
206+ "#
207+ . to_string ( ) ,
208+ variables : serde_json:: to_string ( & Variables {
209+ titleSlug : title_slug. to_string ( ) ,
210+ } ) ?,
144211 } ;
145212 let data = client
146213 . post ( url)
0 commit comments