leetcode_core/graphql/query/
console_panel_config.rs

1use super::GQLLeetcodeRequest;
2use serde::Serialize;
3
4const QUERY: &str = r#"
5query consolePanelConfig($titleSlug: String!) {
6  question(titleSlug: $titleSlug) {
7    questionFrontendId
8    questionTitle
9    exampleTestcaseList
10    # metaData
11  }
12}
13"#;
14
15#[derive(Serialize)]
16#[serde(rename_all = "camelCase")]
17struct Variables {
18    title_slug: String,
19}
20
21#[derive(Serialize)]
22#[serde(rename_all = "camelCase")]
23pub struct Query {
24    query: &'static str,
25    variables: Variables,
26}
27
28impl Query {
29    pub fn new(title_slug: String) -> Self {
30        Self {
31            query: QUERY,
32            variables: Variables { title_slug },
33        }
34    }
35}
36
37impl GQLLeetcodeRequest for Query {
38    type T = crate::types::console_panel_config::Root;
39
40    fn use_cache(&self) -> bool {
41        true
42    }
43}