record-daemon: refactor, remove api_types entirely
record-daemon / Build, check and test (push) Successful in 2m5s

This commit is contained in:
2026-03-27 16:36:43 +01:00
parent 785e5073ec
commit 8842cd9e04
3 changed files with 0 additions and 414 deletions
-39
View File
@@ -5,15 +5,10 @@
use std::sync::Arc;
use futures::{SinkExt, StreamExt};
use serde::de::DeserializeOwned;
use tokio::sync::{broadcast, RwLock};
use tokio_tungstenite::{connect_async_tls_with_config, tungstenite::protocol::Message};
use tracing::{debug, error, info, trace, warn};
use super::api_types::{
ActivePlayerResponse, ChampionSelectResponse, GameflowSessionResponse, PlayerListResponse,
SummonerResponse,
};
use super::auth::LockfileCredentials;
use super::endpoints;
use super::events::GameEvent;
@@ -348,13 +343,6 @@ impl LqpClient {
Ok(json)
}
/// Make a typed REST API request to the League Client.
async fn request_typed<T: DeserializeOwned>(&self, method: &str, endpoint: &str) -> Result<T> {
let json = self.request(method, endpoint).await?;
serde_json::from_value(json)
.map_err(|e| LqpError::EventParseError(format!("Deserialization failed: {}", e)).into())
}
/// Get the current gameflow phase.
pub async fn get_gameflow_phase(&self) -> Result<GameflowPhase> {
let json = self.request("GET", endpoints::GAMEFLOW_PHASE).await?;
@@ -364,31 +352,16 @@ impl LqpClient {
Ok(GameflowPhase::from(phase_str))
}
/// Get the current game session info (typed).
pub async fn get_session_typed(&self) -> Result<GameflowSessionResponse> {
self.request_typed("GET", endpoints::SESSION).await
}
/// Get the current game session info (raw JSON for backward compatibility).
pub async fn get_session(&self) -> Result<serde_json::Value> {
self.request("GET", endpoints::SESSION).await
}
/// Get current summoner info (typed).
pub async fn get_summoner_typed(&self) -> Result<SummonerResponse> {
self.request_typed("GET", endpoints::SUMMONER).await
}
/// Get current summoner info (raw JSON for backward compatibility).
pub async fn get_summoner(&self) -> Result<serde_json::Value> {
self.request("GET", endpoints::SUMMONER).await
}
/// Get champion select session info (typed).
pub async fn get_champion_select_typed(&self) -> Result<ChampionSelectResponse> {
self.request_typed("GET", endpoints::CHAMPION_SELECT).await
}
/// Get champion select session info (raw JSON for backward compatibility).
pub async fn get_champion_select(&self) -> Result<serde_json::Value> {
self.request("GET", endpoints::CHAMPION_SELECT).await
@@ -424,24 +397,12 @@ impl LqpClient {
self.request("GET", endpoints::LIVE_CLIENT_DATA).await
}
/// Get active player data from live client (typed).
pub async fn get_live_client_active_player_typed(&self) -> Result<ActivePlayerResponse> {
self.request_typed("GET", endpoints::LIVE_CLIENT_DATA_ACTIVE_PLAYER)
.await
}
/// Get active player data from live client (raw JSON for backward compatibility).
pub async fn get_live_client_active_player(&self) -> Result<serde_json::Value> {
self.request("GET", endpoints::LIVE_CLIENT_DATA_ACTIVE_PLAYER)
.await
}
/// Get player list from live client (typed).
pub async fn get_live_client_player_list_typed(&self) -> Result<PlayerListResponse> {
self.request_typed("GET", endpoints::LIVE_CLIENT_DATA_PLAYER_LIST)
.await
}
/// Get player list from live client (raw JSON for backward compatibility).
pub async fn get_live_client_player_list(&self) -> Result<serde_json::Value> {
self.request("GET", endpoints::LIVE_CLIENT_DATA_PLAYER_LIST)