leetcode_core/graphql/query/
daily_coding_challenge.rs

1use crate::types::daily_coding_challenge::IDailyCodingChallenge;
2
3use super::GQLLeetcodeRequest;
4use serde::Serialize;
5
6const QUERY: &str = r#"
7query questionOfToday {
8  activeDailyCodingChallengeQuestion {
9    date
10    userStatus
11    link
12    question {
13      acRate
14      difficulty
15      freqBar
16      frontendQuestionId: questionFrontendId
17      isFavor
18      paidOnly: isPaidOnly
19      status
20      title
21      titleSlug
22      hasVideoSolution
23      hasSolution
24      topicTags {
25        name
26        id
27        slug
28      }
29    }
30  }
31}"#;
32
33#[derive(Serialize)]
34#[serde(rename_all = "camelCase")]
35pub struct Query {
36    query: &'static str,
37}
38
39impl Query {
40    pub fn new() -> Self {
41        Self {
42            ..Default::default()
43        }
44    }
45}
46
47impl Default for Query {
48    fn default() -> Self {
49        Self { query: QUERY }
50    }
51}
52
53impl GQLLeetcodeRequest for Query {
54    type T = IDailyCodingChallenge;
55
56    fn use_cache(&self) -> bool {
57        true
58    }
59}