Skip to main content

lichess_api/model/puzzles/
mod.rs

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