Wars

Classic war and Clan War League response models.

Clan War

struct clashy.ClanWar

ClanWar is the current, historical, or league war response.

For league wars found through GetCurrentWar or GetLeagueWar, the client orients the result so Clan is the requested clan and Opponent is the opposing side, even if the API returned the requested clan under opponent.

State

WarState json: state

State is the current state of the war.

TeamSize

int json: teamSize

TeamSize is the roster size for each side.

PreparationStartTime

*Timestamp json: preparationStartTime

PreparationStartTime is when preparation day began.

StartTime

*Timestamp json: startTime

StartTime is when battle day starts.

EndTime

*Timestamp json: endTime

EndTime is when the war ends.

Clan

*WarClan json: clan

Clan is the requested clan side for oriented responses.

Opponent

*WarClan json: opponent

Opponent is the opposing clan side for oriented responses.

BattleModifier

string json: battleModifier

BattleModifier describes event-specific modifiers when the API includes one.

WarTag

string json: tag

WarTag is the CWL war tag. It is empty for normal classic wars.

ClanTag

string

ClanTag is the requested clan tag associated with this response.

LeagueGroup

*ClanWarLeagueGroup

LeagueGroup is the CWL group used to find this war when available.

War Clan

struct clashy.WarClan

WarClan is one clan side of a classic war or CWL war.

Tag

string json: tag

Tag is the clan tag.

Name

string json: name

Name is the clan name.

Badge

Badge json: badgeUrls

Badge contains clan badge image URLs.

Level

int json: clanLevel

Level is the clan level.

Attacks

int json: attacks

Attacks is the number of attacks used by this clan.

Stars

int json: stars

Stars is the total stars earned by this clan.

Destruction

float64 json: destructionPercentage

Destruction is the total destruction percentage earned by this clan.

ExpEarned

int json: expEarned

ExpEarned is clan XP earned by this war when the endpoint includes it.

Members

[]ClanWarMember json: members

Members is the war roster for this side.

Clan War Member

struct clashy.ClanWarMember

ClanWarMember is a player entry on one side of a war.

Tag

string json: tag

Tag is the player's tag.

Name

string json: name

Name is the player's display name at the time of the war.

MapPosition

int json: mapPosition

MapPosition is the player's position on the war map.

Townhall

int json: townhallLevel

Townhall is the player's Town Hall level in the war response.

OpponentAttacks

int json: opponentAttacks

OpponentAttacks is the number of attacks used against this base.

Attacks

[]WarAttack json: attacks

Attacks contains attacks made by this member.

BestOpponentAttack

*WarAttack json: bestOpponentAttack

BestOpponentAttack is the best attack received by this member.

War Attack

struct clashy.WarAttack

WarAttack is one attack inside a classic war or Clan War League war.

Order

int json: order

Order is the attack order assigned by the API.

AttackerTag

string json: attackerTag

AttackerTag is the player tag of the attacker.

DefenderTag

string json: defenderTag

DefenderTag is the player tag of the defender.

Stars

int json: stars

Stars is the number of stars earned by the attack.

Destruction

float64 json: destructionPercentage

Destruction is the destruction percentage earned by the attack.

Duration

int json: duration

Duration is the attack duration in seconds.

Attacker

*ClanWarMember

Attacker is optionally linked to the attacker member when a caller enriches the attack from the war member list.

Defender

*ClanWarMember

Defender is optionally linked to the defender member when a caller enriches the attack from the war member list.

Clan War Log Entry

struct clashy.ClanWarLogEntry

ClanWarLogEntry is one item from a clan's public war log.

Result

WarResult json: result

Result is the requested clan's result for this war.

EndTime

*Timestamp json: endTime

EndTime is when the war ended.

TeamSize

int json: teamSize

TeamSize is the roster size for each side.

Clan

*WarClan json: clan

Clan is the requested clan side.

Opponent

*WarClan json: opponent

Opponent is the opposing clan side.

Clan War League Group

struct clashy.ClanWarLeagueGroup

ClanWarLeagueGroup is the current CWL group for a clan.

State

string json: state

State is the group state returned by the API.

Season

string json: season

Season is the CWL season identifier.

Clans

[]ClanWarLeagueClan json: clans

Clans contains the clans participating in the group.

Rounds

[]struct { WarTags []string `json:"warTags,omitempty"` } json: rounds

Rounds contains CWL war tags grouped by round. Future rounds may contain placeholder "#0" tags.

Clan War League Clan

struct clashy.ClanWarLeagueClan

ClanWarLeagueClan is a clan entry inside a CWL group.

Tag

string json: tag

Tag is the clan tag.

Name

string json: name

Name is the clan name.

Badge

Badge json: badgeUrls

Badge contains clan badge image URLs.

Level

int json: clanLevel

Level is the clan level.

Extended CWLGroup

struct clashy.ExtendedCWLGroup

ExtendedCWLGroup contains static medal information for a CWL league.

Name

string json: name

Name is the league display name.

FirstPlaceMedals

int json: first_place_medals

FirstPlaceMedals is the medal reward for first place.

SecondPlaceMedals

int json: second_place_medals

SecondPlaceMedals is the medal reward for second place.

War Round

type clashy.WarRound

WarRound identifies the logical CWL round requested from GetCurrentWar or GetLeagueWar.

int

Values

PreviousWar

iota

PreviousWar selects the previous completed or in-war CWL round.

CurrentWar

CurrentWar selects the active CWL war, or the latest completed/in-war round when the latest real round is only preparation.

CurrentPreparation

CurrentPreparation selects the upcoming CWL preparation round when one is available.

War State

type clashy.WarState

WarState is the lifecycle state of a classic war or CWL war.

string

Values

WarStateNotInWar

"notInWar"

WarStateNotInWar means the clan is not in a regular war.

WarStatePreparation

"preparation"

WarStatePreparation means the war is in preparation day.

WarStateInWar

"inWar"

WarStateInWar means battle day is active.

WarStateEnded

"warEnded"

WarStateEnded means the war has ended.

War Result

type clashy.WarResult

WarResult is the requested clan's result in a war log entry.

string

Values

WarResultWin

"win"

WarResultWin means the requested clan won.

WarResultLose

"lose"

WarResultLose means the requested clan lost.

WarResultTie

"tie"

WarResultTie means the war ended in a tie.

Clan War Methods

clashy.ClanWar.Attacks() -> []WarAttack

Attacks returns all attacks made by both sides of the war.

Return type:
[]WarAttack

clashy.ClanWar.Type() -> string

Type returns "cwl" when the war has a CWL war tag and "random" otherwise.

Return type:
string