record-daemon: refactor/remove pregame metadata in daemon
record-daemon / Build, check and test (push) Successful in 2m0s

This commit is contained in:
2026-03-27 16:09:04 +01:00
parent 52f8be7caa
commit 785e5073ec
4 changed files with 5 additions and 405 deletions
+2 -55
View File
@@ -11,8 +11,8 @@ use tokio_tungstenite::{connect_async_tls_with_config, tungstenite::protocol::Me
use tracing::{debug, error, info, trace, warn};
use super::api_types::{
ActivePlayerResponse, ChampionSelectResponse, EndOfGameStatsResponse, GameflowSessionResponse,
PlayerListResponse, PreGameData, RunePageResponse, SummonerResponse,
ActivePlayerResponse, ChampionSelectResponse, GameflowSessionResponse, PlayerListResponse,
SummonerResponse,
};
use super::auth::LockfileCredentials;
use super::endpoints;
@@ -394,11 +394,6 @@ impl LqpClient {
self.request("GET", endpoints::CHAMPION_SELECT).await
}
/// Get end-of-game stats (typed).
pub async fn get_game_stats_typed(&self) -> Result<EndOfGameStatsResponse> {
self.request_typed("GET", endpoints::GAME_STATS).await
}
/// Get end-of-game stats (raw JSON for backward compatibility).
pub async fn get_game_stats(&self) -> Result<serde_json::Value> {
self.request("GET", endpoints::GAME_STATS).await
@@ -409,11 +404,6 @@ impl LqpClient {
self.request("GET", endpoints::CHAMPION_SUMMARY).await
}
/// Get current rune page (typed).
pub async fn get_rune_page_typed(&self) -> Result<RunePageResponse> {
self.request_typed("GET", endpoints::RUNE_PAGES).await
}
/// Get current rune page (raw JSON for backward compatibility).
pub async fn get_rune_page(&self) -> Result<serde_json::Value> {
self.request("GET", endpoints::RUNE_PAGES).await
@@ -497,49 +487,6 @@ impl LqpClient {
pub async fn fetch_raw_end_game_stats(&self) -> Result<serde_json::Value> {
self.request("GET", endpoints::GAME_STATS).await
}
/// Fetch pre-game data (stores raw API responses directly).
pub async fn fetch_pregame_data(&self) -> Result<PreGameData> {
let mut data = PreGameData::default();
// Fetch all API responses in parallel where possible
let (session, summoner, champ_select, rune_page) = tokio::join!(
self.get_session_typed(),
self.get_summoner_typed(),
self.get_champion_select_typed(),
self.get_rune_page_typed()
);
// Store session data
if let Ok(session) = session {
data.session = Some(session);
}
// Store summoner data and update state
if let Ok(summoner) = summoner {
if let Some(ref puuid) = summoner.puuid {
self.state.write().await.local_puuid = Some(puuid.clone());
}
data.summoner = Some(summoner);
}
// Store champion select data
if let Ok(champ_select) = champ_select {
data.champion_select = Some(champ_select);
}
// Store rune page data
if let Ok(rune_page) = rune_page {
data.rune_page = Some(rune_page);
}
Ok(data)
}
/// Fetch end-of-game stats (returns raw API response).
pub async fn fetch_game_end_stats(&self) -> Result<EndOfGameStatsResponse> {
self.get_game_stats_typed().await
}
}
impl Default for LqpClient {