Get specific problem detail
(self, slug: &str)
| 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> { |
no test coverage detected