MCPcopy Index your code
hub / github.com/clearloop/leetcode-cli / get_question_daily

Method get_question_daily

src/plugins/leetcode.rs:144–195  ·  view source on GitHub ↗

Get daily problem

(self)

Source from the content-addressed store, hash-verified

142
143 /// Get daily problem
144 pub async fn get_question_daily(self) -> Result<Response> {
145 trace!("Requesting daily problem...");
146 let url = &self.conf.sys.urls.graphql;
147 let mut json: Json = HashMap::new();
148
149 match self.conf.cookies.site {
150 config::LeetcodeSite::LeetcodeCom => {
151 json.insert("operationName", "daily".to_string());
152 json.insert(
153 "query",
154 [
155 "query daily {",
156 " activeDailyCodingChallengeQuestion {",
157 " question {",
158 " questionFrontendId",
159 " }",
160 " }",
161 "}",
162 ]
163 .join("\n"),
164 );
165 }
166 config::LeetcodeSite::LeetcodeCn => {
167 json.insert("operationName", "questionOfToday".to_string());
168 json.insert(
169 "query",
170 [
171 "query questionOfToday {",
172 " todayRecord {",
173 " question {",
174 " questionFrontendId",
175 " }",
176 " }",
177 "}",
178 ]
179 .join("\n"),
180 );
181 }
182 }
183
184 Req {
185 default_headers: self.default_headers,
186 refer: None,
187 info: false,
188 json: Some(json),
189 mode: Mode::Post,
190 name: "get_question_daily",
191 url: (*url).to_string(),
192 }
193 .send(&self.client)
194 .await
195 }
196
197 /// Get specific problem detail
198 pub async fn get_question_detail(self, slug: &str) -> Result<Response> {

Callers 1

get_daily_problem_idMethod · 0.80

Calls 1

sendMethod · 0.80

Tested by

no test coverage detected