Skip to main content

px_core/models/
sport.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3
4/// Real-time sports score/state from the Polymarket Sports WebSocket.
5/// Serializes as snake_case for end-users; aliases accept the upstream camelCase.
6#[derive(Debug, Clone, Serialize, Deserialize)]
7#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
8pub struct SportResult {
9    #[serde(alias = "gameId")]
10    pub game_id: u64,
11    #[serde(alias = "leagueAbbreviation")]
12    pub league_abbreviation: String,
13    pub slug: String,
14    #[serde(alias = "homeTeam")]
15    pub home_team: String,
16    #[serde(alias = "awayTeam")]
17    pub away_team: String,
18    pub status: String,
19    pub score: Option<String>,
20    pub period: Option<String>,
21    pub elapsed: Option<String>,
22    pub live: bool,
23    pub ended: bool,
24    pub turn: Option<String>,
25    pub finished_timestamp: Option<DateTime<Utc>>,
26}