chesscom_openapi/models/
chess_stats_record.rs

1/*
2 * Chess
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// Summary of all games played
12
13
14
15#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ChessStatsRecord {
17    /// Number of games won
18    #[serde(rename = "win")]
19    pub win: i32,
20    /// Number of games lost
21    #[serde(rename = "loss")]
22    pub loss: i32,
23    /// Number of games drawn
24    #[serde(rename = "draw")]
25    pub draw: i32,
26    /// Number of seconds per average move
27    #[serde(rename = "time_per_move", skip_serializing_if = "Option::is_none")]
28    pub time_per_move: Option<i32>,
29    /// Timeout percentage in the last 90 days
30    #[serde(rename = "timeout_percent", skip_serializing_if = "Option::is_none")]
31    pub timeout_percent: Option<f32>,
32}
33
34impl ChessStatsRecord {
35    /// Summary of all games played
36    pub fn new(win: i32, loss: i32, draw: i32) -> ChessStatsRecord {
37        ChessStatsRecord {
38            win,
39            loss,
40            draw,
41            time_per_move: None,
42            timeout_percent: None,
43        }
44    }
45}
46
47