1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use super::GQLLeetcodeQuery;
use serde::Serialize;

const QUERY: &str = r#"
query consolePanelConfig($titleSlug: String!) {
  question(titleSlug: $titleSlug) {
    questionFrontendId
    questionTitle
    exampleTestcaseList
    # metaData
  }
}
"#;

#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
struct Variables {
    title_slug: String,
}

#[derive(Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Query {
    query: &'static str,
    variables: Variables,
}

impl Query {
    pub fn new(title_slug: String) -> Self {
        Self {
            query: QUERY,
            variables: Variables { title_slug },
        }
    }
}

impl GQLLeetcodeQuery for Query {
    type T = crate::deserializers::console_panel_config::Root;
}