csgo_gsi2/update/
mod.rs

1//! all information that can be contained in a GSI update
2
3use std::collections::HashMap;
4
5use serde::{Serialize, Deserialize, de::IgnoredAny};
6
7pub mod player;
8use player::Player;
9
10pub mod map;
11use map::Map;
12
13pub mod round;
14use round::Round;
15
16// TODO abuse generics to align subscriptions with these types
17
18/// a team
19#[derive(Clone, Debug, Deserialize, Serialize)]
20pub enum Team {
21    /// counter-terrorists
22    CT,
23    /// terrorists
24    T,
25}
26
27/// an update received from CS:GO
28#[derive(Clone, Debug, Deserialize, Serialize)]
29#[serde(deny_unknown_fields)]
30pub struct Update {
31    /// map info
32    pub map: Option<Map>,
33    /// player info
34    pub player: Option<Player>,
35    /// provider (CS:GO) info
36    pub provider: Option<Provider>,
37    /// authentication info, matching initial config
38    pub auth: HashMap<String, String>,
39    /// round info
40    pub round: Option<Round>,
41    #[serde(skip_serializing, default)]
42    added: IgnoredAny,
43    #[serde(skip_serializing, default)]
44    previously: IgnoredAny,
45}
46
47/// information about the GSI info provider (CS:GO itself)
48#[derive(Clone, Debug, Deserialize, Serialize)]
49#[serde(deny_unknown_fields)]
50pub struct Provider {
51    /// game name
52    pub name: String,
53    /// steam app ID
54    #[serde(rename = "appid")]
55    pub app_id: u64,
56    /// version number
57    pub version: u64,
58    /// player's steam ID
59    #[serde(rename = "steamid")]
60    pub steam_id: String,
61    /// update timestamp
62    pub timestamp: u64,
63}