Rework data models: reorganized and extended models for UserProfile, Game, and others, added new models (RoundGuess, UserStats, Achievement, SeasonStats, DailyChallenge), and updated __init__.py.
This commit is contained in:
parent
cfe4a641a6
commit
6548f11884
11 changed files with 298 additions and 73 deletions
29
src/geoguessr_mcp/models/DailyChallenge.py
Normal file
29
src/geoguessr_mcp/models/DailyChallenge.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"""DailyChallenge-related data models."""
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
class DailyChallenge:
|
||||
"""Daily challenge information."""
|
||||
token: str
|
||||
map_name: str = ""
|
||||
date: str = ""
|
||||
time_limit: int = 0
|
||||
completed: bool = False
|
||||
score: Optional[int] = None
|
||||
raw_data: dict = field(default_factory=dict)
|
||||
|
||||
@classmethod
|
||||
def from_api_response(cls, data: dict) -> "DailyChallenge":
|
||||
"""Create DailyChallenge from API response."""
|
||||
return cls(
|
||||
token=data.get("token", data.get("challengeToken", "")),
|
||||
map_name=data.get("map", {}).get("name", "") if isinstance(data.get("map"), dict) else "",
|
||||
date=data.get("date", data.get("day", "")),
|
||||
time_limit=data.get("timeLimit", 0),
|
||||
completed=data.get("completed", data.get("played", False)),
|
||||
score=data.get("score"),
|
||||
raw_data=data,
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue