lichess_api/model/openings/
mod.rs1pub mod lichess;
2pub mod masters;
3pub mod otb;
4pub mod player;
5
6use serde::{Deserialize, Serialize};
7
8use crate::model::Color;
9use crate::model::Speed;
10
11#[derive(Clone, Debug, Serialize, Deserialize)]
12#[serde(rename_all = "camelCase")]
13#[serde_with::skip_serializing_none]
14pub struct OpeningExplorerJson {
15 pub opening: Option<Opening>,
16 pub white: u32,
17 pub draws: u32,
18 pub black: u32,
19 pub moves: Vec<Move>,
20 pub top_games: Option<Vec<Game>>,
21 pub recent_games: Option<Vec<Game>>,
22 pub history: Option<Vec<History>>,
23 pub queue_position: Option<u32>,
24}
25
26#[derive(Clone, Debug, Serialize, Deserialize)]
27pub struct Opening {
28 pub eco: String,
29 pub name: String,
30}
31
32#[derive(Clone, Debug, Serialize, Deserialize)]
33#[serde(rename_all = "camelCase")]
34#[serde_with::skip_serializing_none]
35pub struct Move {
36 pub uci: String,
37 pub san: String,
38 pub average_rating: Option<u32>,
39 pub average_opponent_rating: Option<u32>,
40 pub performance: Option<u32>,
41 pub white: u32,
42 pub draws: u32,
43 pub black: u32,
44 pub game: Option<Game>,
45}
46
47#[derive(Clone, Debug, Serialize, Deserialize)]
48#[serde_with::skip_serializing_none]
49pub struct Game {
50 pub id: String,
51 pub winner: Option<Color>,
52 pub speed: Option<Speed>,
53 pub mode: Option<String>,
54 pub white: Player,
55 pub black: Player,
56 pub year: u32,
57 pub month: String,
58 pub uci: Option<String>,
59}
60
61#[derive(Clone, Debug, Serialize, Deserialize)]
62pub struct Player {
63 pub name: String,
64 pub rating: u32,
65}
66
67#[derive(Clone, Debug, Serialize, Deserialize)]
68pub struct History {
69 pub month: String,
70 pub black: u32,
71 pub draws: u32,
72 pub white: u32,
73}