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

Method get_question_detail

src/plugins/leetcode.rs:198–239  ·  view source on GitHub ↗

Get specific problem detail

(self, slug: &str)

Source from the content-addressed store, hash-verified

196
197 /// Get specific problem detail
198 pub async fn get_question_detail(self, slug: &str) -> Result<Response> {
199 trace!("Requesting {} detail...", &slug);
200 let refer = self.conf.sys.urls.problem(slug);
201 let mut json: Json = HashMap::new();
202 json.insert(
203 "query",
204 [
205 "query getQuestionDetail($titleSlug: String!) {",
206 " question(titleSlug: $titleSlug) {",
207 " content",
208 " stats",
209 " codeDefinition",
210 " sampleTestCase",
211 " exampleTestcases",
212 " enableRunCode",
213 " metaData",
214 " translatedContent",
215 " }",
216 "}",
217 ]
218 .join("\n"),
219 );
220
221 json.insert(
222 "variables",
223 r#"{"titleSlug": "$titleSlug"}"#.replace("$titleSlug", slug),
224 );
225
226 json.insert("operationName", "getQuestionDetail".to_string());
227
228 Req {
229 default_headers: self.default_headers,
230 refer: Some(refer),
231 info: false,
232 json: Some(json),
233 mode: Mode::Post,
234 name: "get_problem_detail",
235 url: self.conf.sys.urls.graphql,
236 }
237 .send(&self.client)
238 .await
239 }
240
241 /// Send code to judge
242 pub async fn run_code(self, j: Json, url: String, refer: String) -> Result<Response> {

Callers 1

get_questionMethod · 0.80

Calls 2

problemMethod · 0.80
sendMethod · 0.80

Tested by

no test coverage detected