csgo_gsi_payload/
lib.rs

1//! Data structures for CSGO Game State Integration payload.
2//!
3//! CSGO Game State Integration documentation coming partially from
4//! [u/Bkid](https://www.reddit.com/r/GlobalOffensive/comments/cjhcpy/game_state_integration_a_very_large_and_indepth/)
5//! — __[Archive](https://web.archive.org/web/20220906050651/https://www.reddit.com/r/GlobalOffensive/comments/cjhcpy/game_state_integration_a_very_large_and_indepth/)__
6//!
7
8use serde::Deserialize;
9use std::collections::HashMap;
10
11mod bomb;
12mod custom;
13mod provider;
14mod team;
15
16// no re-export for these because they contain multiple struct/enums
17pub mod grenade;
18pub mod map;
19pub mod phase_countdowns;
20pub mod player;
21pub mod round;
22pub mod weapon;
23
24// re-export to avoid repetition
25pub use bomb::Bomb;
26pub use custom::coordinates::Coordinates;
27pub use provider::Provider;
28pub use team::Team;
29
30use self::{
31    grenade::Grenade, map::Map, phase_countdowns::PhaseCountdowns, player::Player, round::Round,
32};
33
34#[derive(Deserialize, Debug, Clone)]
35#[serde(deny_unknown_fields)]
36pub struct Payload {
37    pub provider: Option<Provider>,
38    pub player: Option<Player>,
39    pub bomb: Option<Bomb>,
40    pub round: Option<Round>,
41    pub phase_countdowns: Option<PhaseCountdowns>,
42    pub map: Option<Map>,
43
44    #[serde(rename = "allplayers")]
45    pub all_players: Option<HashMap<String, Player>>,
46    pub grenades: Option<HashMap<String, Grenade>>,
47
48    pub added: Option<serde_json::Value>,
49    pub previously: Option<serde_json::Value>,
50}