lichess_api/model/puzzles/
mod.rs

1pub mod activity;
2pub mod daily;
3pub mod dashboard;
4pub mod id;
5pub mod next;
6pub mod race;
7pub mod replay;
8pub mod storm_dashboard;
9
10use super::Title;
11use serde::{Deserialize, Serialize};
12
13#[derive(Clone, Debug, Serialize, Deserialize)]
14pub struct PuzzleAndGame {
15    pub game: Game,
16    pub puzzle: Puzzle,
17}
18
19#[derive(Clone, Debug, Serialize, Deserialize)]
20pub struct Game {
21    pub clock: String,
22    pub id: String,
23    pub perf: Perf,
24    pub pgn: String,
25    pub players: Vec<Player>,
26    pub rated: bool,
27}
28
29#[derive(Clone, Debug, Serialize, Deserialize)]
30pub struct Puzzle {
31    pub id: String,
32    #[serde(rename = "initialPly")]
33    pub initial_ply: i32,
34    pub plays: i32,
35    pub rating: i32,
36    pub solution: Vec<String>,
37    pub themes: Vec<String>,
38}
39
40#[derive(Clone, Debug, Serialize, Deserialize)]
41pub struct Perf {
42    pub key: String,
43    pub name: String,
44}
45
46#[serde_with::skip_serializing_none]
47#[derive(Clone, Debug, Serialize, Deserialize)]
48pub struct Player {
49    pub color: String,
50    pub id: String,
51    pub name: String,
52    pub rating: i32,
53    pub flair: Option<String>,
54    pub patron: Option<bool>,
55    pub title: Option<Title>,
56}