record-daemon: refactor client.rs
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
//! LQP REST API endpoints.
|
||||
//!
|
||||
//! Defines the endpoint paths for the League Client API.
|
||||
|
||||
/// Gameflow phase endpoint.
|
||||
pub const GAMEFLOW_PHASE: &str = "/lol-gameflow/v1/gameflow-phase";
|
||||
/// Game session endpoint.
|
||||
pub const SESSION: &str = "/lol-gameflow/v1/session";
|
||||
/// Champion select session endpoint.
|
||||
pub const CHAMPION_SELECT: &str = "/lol-champ-select/v1/session";
|
||||
/// Current summoner endpoint.
|
||||
pub const SUMMONER: &str = "/lol-summoner/v1/current-summoner";
|
||||
/// End-of-game stats endpoint.
|
||||
pub const GAME_STATS: &str = "/lol-end-of-game/v1/eog-stats-block";
|
||||
/// Current champion in champ select.
|
||||
pub const CHAMPION_SUMMARY: &str = "/lol-champ-select/v1/current-champion";
|
||||
/// Current rune page endpoint.
|
||||
pub const RUNE_PAGES: &str = "/lol-perks/v1/currentpage";
|
||||
/// All rune pages endpoint.
|
||||
pub const ALL_RUNE_PAGES: &str = "/lol-perks/v1/pages";
|
||||
/// Match history endpoint.
|
||||
pub const MATCH_HISTORY: &str = "/lol-match-history/v1/products/lol/current-summoner/matches";
|
||||
/// Live client data endpoint (all game data).
|
||||
pub const LIVE_CLIENT_DATA: &str = "/liveclientdata/allgamedata";
|
||||
/// Live client active player endpoint.
|
||||
pub const LIVE_CLIENT_DATA_ACTIVE_PLAYER: &str = "/liveclientdata/activeplayer";
|
||||
/// Live client player list endpoint.
|
||||
pub const LIVE_CLIENT_DATA_PLAYER_LIST: &str = "/liveclientdata/playerlist";
|
||||
/// Local player selection in champion select.
|
||||
pub const CHAMPION_SELECT_LOCAL_PLAYER: &str = "/lol-champ-select/v1/session/my-selection";
|
||||
|
||||
/// LQP WebSocket endpoints to subscribe to.
|
||||
pub const SUBSCRIBE_ENDPOINTS: &[&str] = &[
|
||||
GAMEFLOW_PHASE,
|
||||
SESSION,
|
||||
"/lol-matchmaking/v1/ready-check",
|
||||
"/lol-game-events/v1/game-events",
|
||||
CHAMPION_SELECT,
|
||||
"/lol-lobby/v2/lobby",
|
||||
GAME_STATS,
|
||||
];
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_endpoints_are_valid() {
|
||||
// All endpoints should start with /
|
||||
assert!(GAMEFLOW_PHASE.starts_with('/'));
|
||||
assert!(SESSION.starts_with('/'));
|
||||
assert!(CHAMPION_SELECT.starts_with('/'));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_subscribe_endpoints_not_empty() {
|
||||
assert!(!SUBSCRIBE_ENDPOINTS.is_empty());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user