_types
_types
¶
Event data model for the cocapi event polling system.
EventType
¶
Bases: Enum
All event types produced by the polling system.
WarState
¶
Bases: Enum
War state machine states matching the CoC API.
Change
dataclass
¶
Change(field: str, old_value: Any, new_value: Any)
A single field-level change between two snapshots.
Event
dataclass
¶
Event(
event_type: EventType,
tag: str,
timestamp: float = time(),
old_data: dict[str, Any] | None = None,
new_data: dict[str, Any] | None = None,
changes: tuple[Change, ...] = (),
metadata: dict[str, Any] = dict(),
)
An event produced by the polling system.
| ATTRIBUTE | DESCRIPTION |
|---|---|
event_type |
The type of event.
TYPE:
|
tag |
The clan or player tag this event relates to.
TYPE:
|
timestamp |
Unix timestamp when the event was created.
TYPE:
|
old_data |
Full previous snapshot (None on first poll).
TYPE:
|
new_data |
Full current snapshot (None for MEMBER_LEFT).
TYPE:
|
changes |
Tuple of field-level changes detected.
TYPE:
|
metadata |
Extra context (member_tag, war_state_from, etc.).
TYPE:
|