2024-09-17 23:07:16 -04:00
|
|
|
#!/usr/bin/env python3.12
|
|
|
|
|
|
|
|
class CAHClient:
|
|
|
|
def __init__(self,
|
|
|
|
resource: str,
|
|
|
|
platform: str,
|
|
|
|
csid: str,
|
2024-09-18 19:49:17 -04:00
|
|
|
connected_at: int,
|
|
|
|
current_game: str | None):
|
2024-09-17 23:07:16 -04:00
|
|
|
self.resource: str = resource
|
|
|
|
self.platform: str = platform
|
|
|
|
self.csid: str = csid
|
2024-09-18 19:49:17 -04:00
|
|
|
self.connected_at: int = connected_at
|
|
|
|
self.current_game: str | None = current_game
|
|
|
|
|
|
|
|
def __iter__(self):
|
|
|
|
return [value for value in self.__dict__.values() if isinstance(value, int) or isinstance(value, float)].__iter__()
|
|
|
|
|
|
|
|
class CAHGame:
|
|
|
|
|
|
|
|
def __init__(self,
|
|
|
|
id: str,
|
|
|
|
rounds: int,
|
|
|
|
players: list[dict],
|
|
|
|
created_at: int,
|
|
|
|
state: int,
|
|
|
|
started_at: int,
|
|
|
|
state_changed_at: int,
|
|
|
|
):
|
|
|
|
self.id: str = id
|
|
|
|
self.rounds: int = rounds
|
|
|
|
self.players: list[dict] = players
|
|
|
|
self.created_at: int = created_at
|
|
|
|
self.state: int = state
|
|
|
|
self.started_at: int = started_at
|
|
|
|
self.state_changed_at: int = state_changed_at
|
|
|
|
|
|
|
|
def __iter__(self):
|
|
|
|
return [value for value in self.__dict__.values() if isinstance(value, int) or isinstance(value, float)].__iter__()
|