BattleResource (client.battle)
Endpoints:
• battle.getById
• battle.getLiveBattleData
• battle.getBattles (cursor-paginated)
.collect_all()
Fetch all items across all pages concurrently using parallel time-slicing.
Signature
await client.battle.collect_all(**kwargs: 'typing.Any') -> 'list[Battle]'
Parameters
| Name |
Type |
Default |
kwargs |
Any |
Required |
Return Models
Battle
| Field |
Type |
Required |
_id |
string |
Optional |
__v |
integer |
Optional |
war |
string |
Optional |
region |
string |
Optional |
attacker_country_id |
string |
Optional |
defender_country_id |
string |
Optional |
attacker |
BattleSide |
Optional |
defender |
BattleSide |
Optional |
attackerScore |
number |
Optional |
defenderScore |
number |
Optional |
isActive |
boolean |
Optional |
isSystemResistance |
boolean |
Optional |
isBigBattle |
boolean |
Optional |
winner_country |
string |
Optional |
startTime |
string |
Optional |
endTime |
string |
Optional |
currentRound |
string | integer | object |
Optional |
rounds |
array[string] |
Optional |
roundsHistory |
array[any] |
Optional |
roundsToWin |
integer |
Optional |
totalRounds |
integer |
Optional |
type |
string |
Optional |
stats |
BattleStats |
Optional |
createdAt |
string |
Optional |
updatedAt |
string |
Optional |
BattleSide
Per-side summary (attacker/defender) of a battle.
| Field |
Type |
Required |
_id |
string |
Optional |
__v |
integer |
Optional |
country |
string |
Optional |
region |
string |
Optional |
damages |
number |
Optional |
hitCount |
integer |
Optional |
wonRoundsCount |
integer |
Optional |
countryOrders |
array[string] |
Optional |
muOrders |
array[string] |
Optional |
moneyPool |
number |
Optional |
moneyPer1kDamages |
number |
Optional |
bountyEffectiveAt |
string |
Optional |
BattleStats
| Field |
Type |
Required |
_id |
string |
Optional |
__v |
integer |
Optional |
hitCount |
integer |
Optional |
.get()
Get full battle info by ID.
Signature
await client.battle.get(battle_id: 'str') -> 'Battle'
Parameters
| Name |
Type |
Default |
battle_id |
str |
Required |
Return Models
Battle
| Field |
Type |
Required |
_id |
string |
Optional |
__v |
integer |
Optional |
war |
string |
Optional |
region |
string |
Optional |
attacker_country_id |
string |
Optional |
defender_country_id |
string |
Optional |
attacker |
BattleSide |
Optional |
defender |
BattleSide |
Optional |
attackerScore |
number |
Optional |
defenderScore |
number |
Optional |
isActive |
boolean |
Optional |
isSystemResistance |
boolean |
Optional |
isBigBattle |
boolean |
Optional |
winner_country |
string |
Optional |
startTime |
string |
Optional |
endTime |
string |
Optional |
currentRound |
string | integer | object |
Optional |
rounds |
array[string] |
Optional |
roundsHistory |
array[any] |
Optional |
roundsToWin |
integer |
Optional |
totalRounds |
integer |
Optional |
type |
string |
Optional |
stats |
BattleStats |
Optional |
createdAt |
string |
Optional |
updatedAt |
string |
Optional |
BattleSide
Per-side summary (attacker/defender) of a battle.
| Field |
Type |
Required |
_id |
string |
Optional |
__v |
integer |
Optional |
country |
string |
Optional |
region |
string |
Optional |
damages |
number |
Optional |
hitCount |
integer |
Optional |
wonRoundsCount |
integer |
Optional |
countryOrders |
array[string] |
Optional |
muOrders |
array[string] |
Optional |
moneyPool |
number |
Optional |
moneyPer1kDamages |
number |
Optional |
bountyEffectiveAt |
string |
Optional |
BattleStats
| Field |
Type |
Required |
_id |
string |
Optional |
__v |
integer |
Optional |
hitCount |
integer |
Optional |
.get_active()
Convenience: fetch all active battles across the globe.
Signature
await client.battle.get_active(**kwargs: 'Any') -> 'list[Battle]'
Parameters
| Name |
Type |
Default |
kwargs |
Any |
Required |
Return Models
Battle
| Field |
Type |
Required |
_id |
string |
Optional |
__v |
integer |
Optional |
war |
string |
Optional |
region |
string |
Optional |
attacker_country_id |
string |
Optional |
defender_country_id |
string |
Optional |
attacker |
BattleSide |
Optional |
defender |
BattleSide |
Optional |
attackerScore |
number |
Optional |
defenderScore |
number |
Optional |
isActive |
boolean |
Optional |
isSystemResistance |
boolean |
Optional |
isBigBattle |
boolean |
Optional |
winner_country |
string |
Optional |
startTime |
string |
Optional |
endTime |
string |
Optional |
currentRound |
string | integer | object |
Optional |
rounds |
array[string] |
Optional |
roundsHistory |
array[any] |
Optional |
roundsToWin |
integer |
Optional |
totalRounds |
integer |
Optional |
type |
string |
Optional |
stats |
BattleStats |
Optional |
createdAt |
string |
Optional |
updatedAt |
string |
Optional |
BattleSide
Per-side summary (attacker/defender) of a battle.
| Field |
Type |
Required |
_id |
string |
Optional |
__v |
integer |
Optional |
country |
string |
Optional |
region |
string |
Optional |
damages |
number |
Optional |
hitCount |
integer |
Optional |
wonRoundsCount |
integer |
Optional |
countryOrders |
array[string] |
Optional |
muOrders |
array[string] |
Optional |
moneyPool |
number |
Optional |
moneyPer1kDamages |
number |
Optional |
bountyEffectiveAt |
string |
Optional |
BattleStats
| Field |
Type |
Required |
_id |
string |
Optional |
__v |
integer |
Optional |
hitCount |
integer |
Optional |
.get_live()
Get live battle data (scores, damage, time remaining).
Signature
await client.battle.get_live(battle_id: 'str', *, round_number: 'int | None' = None) -> 'BattleLive'
Parameters
| Name |
Type |
Default |
battle_id |
str |
Required |
round_number |
int |
None |
Return Models
BattleLive
Response from battle.getLiveBattleData.
| Field |
Type |
Required |
_id |
string |
Optional |
__v |
integer |
Optional |
battleId |
string |
Optional |
roundNumber |
integer |
Optional |
attackerScore |
number |
Optional |
defenderScore |
number |
Optional |
attackerDamage |
number |
Optional |
defenderDamage |
number |
Optional |
timeRemaining |
integer |
Optional |
isActive |
boolean |
Optional |
.get_many()
Get battles with optional filters (cursor-paginated).
Signature
await client.battle.get_many(*, is_active: 'bool | None' = None, limit: 'int' = 10, cursor: 'str | None' = None, direction: 'BattleDirection | str | None' = None, filter: 'BattleFilter | str | None' = None, defender_region_id: 'str | None' = None, war_id: 'str | None' = None, country_id: 'str | None' = None, auto_items: 'bool' = False, max_pages: 'int | float' = inf, cursor_end: 'str | None' = None) -> 'CursorPage[Battle] | AsyncIterator[Battle]'
Parameters
| Name |
Type |
Default |
is_active |
bool |
None |
limit |
int |
10 |
cursor |
str |
None |
direction |
BattleDirection | str |
None |
filter |
BattleFilter | str |
None |
defender_region_id |
str |
None |
war_id |
str |
None |
country_id |
str |
None |
auto_items |
bool |
False |
max_pages |
int | float |
inf |
cursor_end |
str |
None |
Return Models
Battle
| Field |
Type |
Required |
_id |
string |
Optional |
__v |
integer |
Optional |
war |
string |
Optional |
region |
string |
Optional |
attacker_country_id |
string |
Optional |
defender_country_id |
string |
Optional |
attacker |
BattleSide |
Optional |
defender |
BattleSide |
Optional |
attackerScore |
number |
Optional |
defenderScore |
number |
Optional |
isActive |
boolean |
Optional |
isSystemResistance |
boolean |
Optional |
isBigBattle |
boolean |
Optional |
winner_country |
string |
Optional |
startTime |
string |
Optional |
endTime |
string |
Optional |
currentRound |
string | integer | object |
Optional |
rounds |
array[string] |
Optional |
roundsHistory |
array[any] |
Optional |
roundsToWin |
integer |
Optional |
totalRounds |
integer |
Optional |
type |
string |
Optional |
stats |
BattleStats |
Optional |
createdAt |
string |
Optional |
updatedAt |
string |
Optional |
BattleSide
Per-side summary (attacker/defender) of a battle.
| Field |
Type |
Required |
_id |
string |
Optional |
__v |
integer |
Optional |
country |
string |
Optional |
region |
string |
Optional |
damages |
number |
Optional |
hitCount |
integer |
Optional |
wonRoundsCount |
integer |
Optional |
countryOrders |
array[string] |
Optional |
muOrders |
array[string] |
Optional |
moneyPool |
number |
Optional |
moneyPer1kDamages |
number |
Optional |
bountyEffectiveAt |
string |
Optional |
BattleStats
| Field |
Type |
Required |
_id |
string |
Optional |
__v |
integer |
Optional |
hitCount |
integer |
Optional |
CursorPage[Battle]
| Field |
Type |
Required |
_id |
string |
Optional |
__v |
integer |
Optional |
items |
array[Battle] |
Required |
nextCursor |
string |
Optional |
hasMore |
boolean |
Optional |
.get_ranking()
Get battle ranking.
Signature
await client.battle.get_ranking(battle_id: 'str') -> 'dict[str, typing.Any]'
Parameters
| Name |
Type |
Default |
battle_id |
str |
Required |
.invalidate_cache()
Clear the SWR cache for all resources.
Signature
await client.battle.invalidate_cache() -> 'None'