Skip to content

Resource BattleResource

CrucifiedPain edited this page Jun 26, 2026 · 10 revisions

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 Description
_id `string null` No
__v `integer null` No
war `string null` No
region `string null` No
attacker_country_id `string null` No
defender_country_id `string null` No
attacker `BattleSide null` No
defender `BattleSide null` No
attackerScore `number null` No
defenderScore `number null` No
isActive `boolean null` No
isSystemResistance `boolean null` No
isBigBattle `boolean null` No
winner_country `string null` No
startTime `string null` No
endTime `string null` No
currentRound `string integer object
rounds `array[string] null` No
roundsHistory `array[any] null` No
roundsToWin `integer null` No
totalRounds `integer null` No
type `string null` No
stats `BattleStats null` No
createdAt `string null` No
updatedAt `string null` No

BattleSide

Per-side summary (attacker/defender) of a battle.

Field Type Required Description
_id `string null` No
__v `integer null` No
country `string null` No
region `string null` No
damages `number null` No
hitCount `integer null` No
wonRoundsCount `integer null` No
countryOrders `array[string] null` No
muOrders `array[string] null` No
moneyPool `number null` No
moneyPer1kDamages `number null` No
bountyEffectiveAt `string null` No

BattleStats

Field Type Required Description
_id `string null` No
__v `integer null` No
hitCount `integer null` No

.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 Description
_id `string null` No
__v `integer null` No
war `string null` No
region `string null` No
attacker_country_id `string null` No
defender_country_id `string null` No
attacker `BattleSide null` No
defender `BattleSide null` No
attackerScore `number null` No
defenderScore `number null` No
isActive `boolean null` No
isSystemResistance `boolean null` No
isBigBattle `boolean null` No
winner_country `string null` No
startTime `string null` No
endTime `string null` No
currentRound `string integer object
rounds `array[string] null` No
roundsHistory `array[any] null` No
roundsToWin `integer null` No
totalRounds `integer null` No
type `string null` No
stats `BattleStats null` No
createdAt `string null` No
updatedAt `string null` No

BattleSide

Per-side summary (attacker/defender) of a battle.

Field Type Required Description
_id `string null` No
__v `integer null` No
country `string null` No
region `string null` No
damages `number null` No
hitCount `integer null` No
wonRoundsCount `integer null` No
countryOrders `array[string] null` No
muOrders `array[string] null` No
moneyPool `number null` No
moneyPer1kDamages `number null` No
bountyEffectiveAt `string null` No

BattleStats

Field Type Required Description
_id `string null` No
__v `integer null` No
hitCount `integer null` No

.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 Description
_id `string null` No
__v `integer null` No
war `string null` No
region `string null` No
attacker_country_id `string null` No
defender_country_id `string null` No
attacker `BattleSide null` No
defender `BattleSide null` No
attackerScore `number null` No
defenderScore `number null` No
isActive `boolean null` No
isSystemResistance `boolean null` No
isBigBattle `boolean null` No
winner_country `string null` No
startTime `string null` No
endTime `string null` No
currentRound `string integer object
rounds `array[string] null` No
roundsHistory `array[any] null` No
roundsToWin `integer null` No
totalRounds `integer null` No
type `string null` No
stats `BattleStats null` No
createdAt `string null` No
updatedAt `string null` No

BattleSide

Per-side summary (attacker/defender) of a battle.

Field Type Required Description
_id `string null` No
__v `integer null` No
country `string null` No
region `string null` No
damages `number null` No
hitCount `integer null` No
wonRoundsCount `integer null` No
countryOrders `array[string] null` No
muOrders `array[string] null` No
moneyPool `number null` No
moneyPer1kDamages `number null` No
bountyEffectiveAt `string null` No

BattleStats

Field Type Required Description
_id `string null` No
__v `integer null` No
hitCount `integer null` No

.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 Description
_id `string null` No
__v `integer null` No
battleId `string null` No
roundNumber `integer null` No
attackerScore `number null` No
defenderScore `number null` No
attackerDamage `number null` No
defenderDamage `number null` No
timeRemaining `integer null` No
isActive `boolean null` No

.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
filter `BattleFilter str
defender_region_id `str None`
war_id `str None`
country_id `str None`
auto_items bool False
max_pages `int float`
cursor_end `str None`

Return Models

Battle

Field Type Required Description
_id `string null` No
__v `integer null` No
war `string null` No
region `string null` No
attacker_country_id `string null` No
defender_country_id `string null` No
attacker `BattleSide null` No
defender `BattleSide null` No
attackerScore `number null` No
defenderScore `number null` No
isActive `boolean null` No
isSystemResistance `boolean null` No
isBigBattle `boolean null` No
winner_country `string null` No
startTime `string null` No
endTime `string null` No
currentRound `string integer object
rounds `array[string] null` No
roundsHistory `array[any] null` No
roundsToWin `integer null` No
totalRounds `integer null` No
type `string null` No
stats `BattleStats null` No
createdAt `string null` No
updatedAt `string null` No

BattleSide

Per-side summary (attacker/defender) of a battle.

Field Type Required Description
_id `string null` No
__v `integer null` No
country `string null` No
region `string null` No
damages `number null` No
hitCount `integer null` No
wonRoundsCount `integer null` No
countryOrders `array[string] null` No
muOrders `array[string] null` No
moneyPool `number null` No
moneyPer1kDamages `number null` No
bountyEffectiveAt `string null` No

BattleStats

Field Type Required Description
_id `string null` No
__v `integer null` No
hitCount `integer null` No

CursorPage[Battle]

Field Type Required Description
_id `string null` No
__v `integer null` No
items array[Battle] Yes
nextCursor `string null` No
hasMore boolean No

.invalidate_cache()

Clear the SWR cache for all resources.

Signature

await client.battle.invalidate_cache() -> 'None'

Clone this wiki locally