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 Optional
__v integer Optional
war string Optional
region string Optional
attacker_country_id string Optional
defender_country_id string Optional
attacker BattleSide Optional The UUID of the country initiating the battle.
defender BattleSide Optional The UUID of the country defending the region.
attackerScore number Optional The attacker score.
defenderScore number Optional The defender score.
isActive boolean Optional Whether the user has logged in recently and is considered an active player.
isSystemResistance boolean Optional The is system resistance.
isBigBattle boolean Optional The is big battle.
winner_country string Optional
startTime string Optional The start time.
endTime string Optional The end time.
currentRound string | integer | object Optional The current round. API returns a round ID string, an int, or a full round object.
rounds array[string] Optional The rounds.
roundsHistory array[any] Optional The rounds history.
roundsToWin integer Optional The rounds to win.
totalRounds integer Optional The total rounds.
type string Optional The type.
stats BattleStats Optional The stats.
createdAt string Optional The timestamp when this record was created.
updatedAt string Optional The timestamp when this record was last modified.

BattleSide

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

Field Type Required Description
_id string Optional
__v integer Optional
country string Optional The UUID of the country this user holds citizenship in.
region string Optional The UUID of the contested region.
damages number Optional The damages.
hitCount integer Optional The total number of hit.
wonRoundsCount integer Optional The total number of won rounds.
countryOrders array[string] Optional The country orders.
muOrders array[string] Optional The mu orders.
moneyPool number Optional The money pool.
moneyPer1kDamages number Optional
bountyEffectiveAt string Optional The bounty effective at.

BattleStats

Field Type Required Description
_id string Optional
__v integer Optional
hitCount integer Optional The total number of hit.

.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 Optional
__v integer Optional
war string Optional
region string Optional
attacker_country_id string Optional
defender_country_id string Optional
attacker BattleSide Optional The UUID of the country initiating the battle.
defender BattleSide Optional The UUID of the country defending the region.
attackerScore number Optional The attacker score.
defenderScore number Optional The defender score.
isActive boolean Optional Whether the user has logged in recently and is considered an active player.
isSystemResistance boolean Optional The is system resistance.
isBigBattle boolean Optional The is big battle.
winner_country string Optional
startTime string Optional The start time.
endTime string Optional The end time.
currentRound string | integer | object Optional The current round. API returns a round ID string, an int, or a full round object.
rounds array[string] Optional The rounds.
roundsHistory array[any] Optional The rounds history.
roundsToWin integer Optional The rounds to win.
totalRounds integer Optional The total rounds.
type string Optional The type.
stats BattleStats Optional The stats.
createdAt string Optional The timestamp when this record was created.
updatedAt string Optional The timestamp when this record was last modified.

BattleSide

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

Field Type Required Description
_id string Optional
__v integer Optional
country string Optional The UUID of the country this user holds citizenship in.
region string Optional The UUID of the contested region.
damages number Optional The damages.
hitCount integer Optional The total number of hit.
wonRoundsCount integer Optional The total number of won rounds.
countryOrders array[string] Optional The country orders.
muOrders array[string] Optional The mu orders.
moneyPool number Optional The money pool.
moneyPer1kDamages number Optional
bountyEffectiveAt string Optional The bounty effective at.

BattleStats

Field Type Required Description
_id string Optional
__v integer Optional
hitCount integer Optional The total number of hit.

.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 Optional
__v integer Optional
war string Optional
region string Optional
attacker_country_id string Optional
defender_country_id string Optional
attacker BattleSide Optional The UUID of the country initiating the battle.
defender BattleSide Optional The UUID of the country defending the region.
attackerScore number Optional The attacker score.
defenderScore number Optional The defender score.
isActive boolean Optional Whether the user has logged in recently and is considered an active player.
isSystemResistance boolean Optional The is system resistance.
isBigBattle boolean Optional The is big battle.
winner_country string Optional
startTime string Optional The start time.
endTime string Optional The end time.
currentRound string | integer | object Optional The current round. API returns a round ID string, an int, or a full round object.
rounds array[string] Optional The rounds.
roundsHistory array[any] Optional The rounds history.
roundsToWin integer Optional The rounds to win.
totalRounds integer Optional The total rounds.
type string Optional The type.
stats BattleStats Optional The stats.
createdAt string Optional The timestamp when this record was created.
updatedAt string Optional The timestamp when this record was last modified.

BattleSide

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

Field Type Required Description
_id string Optional
__v integer Optional
country string Optional The UUID of the country this user holds citizenship in.
region string Optional The UUID of the contested region.
damages number Optional The damages.
hitCount integer Optional The total number of hit.
wonRoundsCount integer Optional The total number of won rounds.
countryOrders array[string] Optional The country orders.
muOrders array[string] Optional The mu orders.
moneyPool number Optional The money pool.
moneyPer1kDamages number Optional
bountyEffectiveAt string Optional The bounty effective at.

BattleStats

Field Type Required Description
_id string Optional
__v integer Optional
hitCount integer Optional The total number of hit.

.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 Optional
__v integer Optional
battleId string Optional The battle id.
roundNumber integer Optional The round number.
attackerScore number Optional The attacker score.
defenderScore number Optional The defender score.
attackerDamage number Optional The attacker damage.
defenderDamage number Optional The defender damage.
timeRemaining integer Optional The time remaining.
isActive boolean Optional Whether the user has logged in recently and is considered an active player.

.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 Description
_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 The UUID of the country initiating the battle.
defender BattleSide Optional The UUID of the country defending the region.
attackerScore number Optional The attacker score.
defenderScore number Optional The defender score.
isActive boolean Optional Whether the user has logged in recently and is considered an active player.
isSystemResistance boolean Optional The is system resistance.
isBigBattle boolean Optional The is big battle.
winner_country string Optional
startTime string Optional The start time.
endTime string Optional The end time.
currentRound string | integer | object Optional The current round. API returns a round ID string, an int, or a full round object.
rounds array[string] Optional The rounds.
roundsHistory array[any] Optional The rounds history.
roundsToWin integer Optional The rounds to win.
totalRounds integer Optional The total rounds.
type string Optional The type.
stats BattleStats Optional The stats.
createdAt string Optional The timestamp when this record was created.
updatedAt string Optional The timestamp when this record was last modified.

BattleSide

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

Field Type Required Description
_id string Optional
__v integer Optional
country string Optional The UUID of the country this user holds citizenship in.
region string Optional The UUID of the contested region.
damages number Optional The damages.
hitCount integer Optional The total number of hit.
wonRoundsCount integer Optional The total number of won rounds.
countryOrders array[string] Optional The country orders.
muOrders array[string] Optional The mu orders.
moneyPool number Optional The money pool.
moneyPer1kDamages number Optional
bountyEffectiveAt string Optional The bounty effective at.

BattleStats

Field Type Required Description
_id string Optional
__v integer Optional
hitCount integer Optional The total number of hit.

CursorPage[Battle]

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

.invalidate_cache()

Clear the SWR cache for all resources.

Signature

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

Clone this wiki locally