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

BattleSide

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

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

BattleStats

Field Type Required Description
_id string \| null
__v integer \| null
hitCount integer \| null

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

BattleSide

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

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

BattleStats

Field Type Required Description
_id string \| null
__v integer \| null
hitCount integer \| null

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

BattleSide

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

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

BattleStats

Field Type Required Description
_id string \| null
__v integer \| null
hitCount integer \| null

.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 None

Return Models

BattleLive

Response from battle.getLiveBattleData.

Field Type Required Description
_id string \| null
__v integer \| null
battleId string \| null
roundNumber integer \| null
attackerScore number \| null
defenderScore number \| null
attackerDamage number \| null
defenderDamage number \| null
timeRemaining integer \| null
isActive boolean \| null

.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 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

Return Models

Battle

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

BattleSide

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

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

BattleStats

Field Type Required Description
_id string \| null
__v integer \| null
hitCount integer \| null

CursorPage[Battle]

Field Type Required Description
_id string \| null
__v integer \| null
items array[Battle]
nextCursor string \| null
hasMore boolean

.invalidate_cache()

Clear the SWR cache for all resources.

Signature

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

Clone this wiki locally