@@ -7,7 +7,34 @@ impl LeetCode<Authorized> {
7
7
let url = "https://leetcode.com/graphql" ;
8
8
let client = & self . client ;
9
9
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 ( ) ,
11
38
variables : "{}" . to_string ( ) ,
12
39
} ;
13
40
@@ -52,8 +79,17 @@ impl LeetCode<Authorized> {
52
79
let client = & self . client ;
53
80
let url = "https://leetcode.com/graphql" ;
54
81
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
+ } ) ?,
57
93
} ;
58
94
59
95
let data = client. post ( url) . json ( & query) . send ( ) ?;
@@ -67,7 +103,21 @@ impl LeetCode<Authorized> {
67
103
data : QuestionWrapper ,
68
104
}
69
105
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
+ "# ;
71
121
let varibales = serde_json:: to_string ( & Variables {
72
122
titleSlug : title_slug. to_string ( ) ,
73
123
} ) ?;
@@ -121,15 +171,15 @@ impl LeetCode<Authorized> {
121
171
} ;
122
172
123
173
let mut input = String :: new ( ) ;
124
- println ! ( "Filename (main.{}) : " , & ( boiler_code. extension( ) ) ) ;
174
+ println ! ( "Filename (main.{}) : " , & ( boiler_code. extension( ) ? ) ) ;
125
175
std:: io:: stdin ( ) . read_line ( & mut input) ?;
126
176
let input = input. trim ( ) ;
127
177
let filename = if input. is_empty ( ) {
128
- format ! ( "main.{}" , boiler_code. extension( ) )
178
+ format ! ( "main.{}" , boiler_code. extension( ) ? )
129
179
} else {
130
180
input. to_string ( )
131
181
} ;
132
- boiler_code. save_code ( & filename, & title_slug) ;
182
+ boiler_code. save_code ( & filename, & title_slug) ? ;
133
183
134
184
Ok ( data. json :: < Data > ( ) . map ( |op| op. data . question ) ?)
135
185
}
@@ -139,8 +189,25 @@ impl LeetCode<Authorized> {
139
189
let url = "https://leetcode.com/graphql" ;
140
190
141
191
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
+ } ) ?,
144
211
} ;
145
212
let data = client
146
213
. post ( url)
0 commit comments