Documentation
¶
Overview ¶
Package clashy provides a Go SDK for the Clash of Clans API.
It ports the major functionality of cocpy while using Go conventions for contexts, interfaces, generics, and package structure.
Index ¶
- Variables
- func CorrectTag(tag string) string
- func FromTimestamp(raw string) (time.Time, error)
- func GetClanGamesEnd(timestamp time.Time) time.Time
- func GetClanGamesStart(timestamp time.Time) time.Time
- func GetRaidWeekendEnd(timestamp time.Time) time.Time
- func GetRaidWeekendStart(timestamp time.Time) time.Time
- func GetSeasonID() string
- func WithoutRateLimit(ctx context.Context) context.Context
- type AccountData
- type Achievement
- type ArmyRecipe
- type Badge
- type BattleLogEntry
- type CapitalDistrict
- type ChatLanguage
- type Clan
- type ClanCapital
- type ClanMember
- type ClanType
- type ClanWar
- type ClanWarLeagueClan
- type ClanWarLeagueGroup
- type ClanWarLogEntry
- type ClanWarMember
- type ClashOfClansException
- type Client
- func (c *Client) Close() error
- func (c *Client) GetBattleLog(ctx context.Context, playerTag string) ([]BattleLogEntry, error)
- func (c *Client) GetBuilderBaseLeague(ctx context.Context, id int) (*League, error)
- func (c *Client) GetCapitalLeague(ctx context.Context, id int) (*League, error)
- func (c *Client) GetClan(ctx context.Context, tag string) (*Clan, error)
- func (c *Client) GetClanLabels(ctx context.Context, limit int, before, after string) ([]Label, error)
- func (c *Client) GetClanWar(ctx context.Context, clanTag string) (*ClanWar, error)
- func (c *Client) GetClanWars(ctx context.Context, tags []string) ([]ClanWar, error)
- func (c *Client) GetCurrentGoldPassSeason(ctx context.Context) (*GoldPassSeason, error)
- func (c *Client) GetCurrentWar(ctx context.Context, clanTag string, round ...WarRound) (*ClanWar, error)
- func (c *Client) GetCurrentWars(ctx context.Context, tags []string) ([]ClanWar, error)
- func (c *Client) GetEquipment(name string, level int) *Equipment
- func (c *Client) GetExtendedCWLGroupData(name string) *ExtendedCWLGroup
- func (c *Client) GetHero(name string, level int) *Hero
- func (c *Client) GetLeague(ctx context.Context, id int) (*League, error)
- func (c *Client) GetLeagueGroup(ctx context.Context, clanTag string) (*ClanWarLeagueGroup, error)
- func (c *Client) GetLeagueWar(ctx context.Context, clanTag string, round WarRound) (*ClanWar, error)
- func (c *Client) GetLeagueWars(ctx context.Context, warTags []string) ([]ClanWar, error)
- func (c *Client) GetLocation(ctx context.Context, locationID int) (*Location, error)
- func (c *Client) GetLocationClans(ctx context.Context, locationID, limit int, before, after string) ([]RankedClan, error)
- func (c *Client) GetLocationClansBuilderBase(ctx context.Context, locationID, limit int, before, after string) ([]RankedClan, error)
- func (c *Client) GetLocationClansCapital(ctx context.Context, locationID, limit int, before, after string) ([]RankedClan, error)
- func (c *Client) GetLocationNamed(ctx context.Context, locationName string) (*Location, error)
- func (c *Client) GetLocationPlayers(ctx context.Context, locationID, limit int, before, after string) ([]RankedPlayer, error)
- func (c *Client) GetLocationPlayersBuilderBase(ctx context.Context, locationID, limit int, before, after string) ([]RankedPlayer, error)
- func (c *Client) GetMembers(ctx context.Context, clanTag string, limit int, after, before string) ([]ClanMember, error)
- func (c *Client) GetPet(name string, level int) *Pet
- func (c *Client) GetPlayer(ctx context.Context, tag string) (*Player, error)
- func (c *Client) GetPlayerLabels(ctx context.Context, limit int, before, after string) ([]Label, error)
- func (c *Client) GetPlayerLeagueGroup(ctx context.Context, playerTag, leagueGroupTag string, leagueSeasonID int) (*LeagueTierGroup, error)
- func (c *Client) GetPlayerLeagueHistory(ctx context.Context, playerTag string) ([]LeagueHistoryEntry, error)
- func (c *Client) GetRaidLog(ctx context.Context, clanTag string, limit int, after, before string) ([]RaidLogEntry, error)
- func (c *Client) GetSeasonRankings(ctx context.Context, leagueID int, seasonID string) ([]RankedPlayer, error)
- func (c *Client) GetSeasons(ctx context.Context, leagueID int) ([]string, error)
- func (c *Client) GetSpell(name string, level int) *Spell
- func (c *Client) GetTranslation(id string) *Translation
- func (c *Client) GetTroop(name string, isHomeVillage bool, level int) *Troop
- func (c *Client) GetWarLeague(ctx context.Context, id int) (*League, error)
- func (c *Client) GetWarLog(ctx context.Context, clanTag string, limit int, after, before string) ([]ClanWarLogEntry, error)
- func (c *Client) Login(ctx context.Context, email, password string) error
- func (c *Client) LoginWithTokens(_ context.Context, tokens ...string) error
- func (c *Client) ParseAccountData(data map[string]any) AccountData
- func (c *Client) ParseArmyLink(link string) ArmyRecipe
- func (c *Client) SearchBuilderBaseLeagues(ctx context.Context, limit int, before, after string) ([]League, error)
- func (c *Client) SearchCapitalLeagues(ctx context.Context, limit int, before, after string) ([]League, error)
- func (c *Client) SearchClans(ctx context.Context, req SearchClansRequest) ([]Clan, error)
- func (c *Client) SearchLeagues(ctx context.Context, limit int, before, after string) ([]League, error)
- func (c *Client) SearchLocations(ctx context.Context, limit int, before, after string) ([]Location, error)
- func (c *Client) SearchWarLeagues(ctx context.Context, limit int, before, after string) ([]League, error)
- func (c *Client) StaticData() *StaticData
- func (c *Client) UpdateStatic(ctx context.Context) error
- func (c *Client) VerifyPlayerToken(ctx context.Context, playerTag, token string) (bool, error)
- type ClientConfig
- type Equipment
- type ExtendedCWLGroup
- type Forbidden
- type GatewayError
- type GoldPassSeason
- type HTTPClient
- type HTTPException
- type Hero
- type HeroLoadout
- type Icon
- type InvalidArgument
- type InvalidCredentials
- type Label
- type League
- type LeagueHistoryEntry
- type LeagueTierGroup
- type LeagueTierGroupBattleLogEntry
- type LeagueTierGroupMember
- type LegendStatistics
- type LoadGameData
- type Location
- type Maintenance
- type NotFound
- type Pet
- type Player
- func (p *Player) BuilderTroops() []Troop
- func (p *Player) GetAchievement(name string) *Achievement
- func (p *Player) GetHero(name string) *Hero
- func (p *Player) GetSpell(name string) *Spell
- func (p *Player) GetTroop(name string) *Troop
- func (p *Player) HomeTroops() []Troop
- func (m Player) RetryAfter() int
- type PlayerClan
- type PlayerHouseElement
- type PrivateWarLog
- type RaidAttack
- type RaidClan
- type RaidDistrict
- type RaidLogEntry
- type RaidMember
- type RankedClan
- type RankedPlayer
- type RequestOptions
- type Resource
- type Role
- type SearchClansRequest
- type Season
- type SeasonWindow
- type Spell
- type SpellCount
- type StaticData
- type StaticUnit
- type TimeDelta
- type Timestamp
- type TournamentWindow
- type Translation
- type Troop
- type TroopCount
- type VillageType
- type WarAttack
- type WarClan
- type WarResult
- type WarRound
- type WarState
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TroopBaseID = 4000000 SpellBaseID = 26000000 HeroBaseID = 2000000 PetBaseID = 60000000 EquipmentBaseID = 30000000 ElixirTroopOrder = []string{ "Barbarian", "Archer", "Goblin", "Giant", "Wall Breaker", "Balloon", "Wizard", "Healer", "Dragon", "P.E.K.K.A", "Baby Dragon", "Miner", "Yeti", "Electro Dragon", "Dragon Rider", "Electro Titan", "Root Rider", "Thrower", "Meteor Golem", } DarkElixirTroopOrder = []string{ "Minion", "Hog Rider", "Valkyrie", "Golem", "Witch", "Lava Hound", "Bowler", "Ice Golem", "Headhunter", "Apprentice Warden", "Druid", "Furnace", } HomeTroopOrder = append(append([]string{}, ElixirTroopOrder...), DarkElixirTroopOrder...) SiegeMachineOrder = []string{ "Wall Wrecker", "Battle Blimp", "Stone Slammer", "Siege Barracks", "Log Launcher", "Flame Flinger", "Battle Drill", "Troop Launcher", "Sky Wagon", } SuperTroopOrder = []string{ "Super Barbarian", "Super Archer", "Super Wall Breaker", "Super Giant", "Sneaky Goblin", "Super Miner", "Rocket Balloon", "Inferno Dragon", "Super Valkyrie", "Super Witch", "Ice Hound", "Super Bowler", "Super Dragon", "Super Wizard", "Super Minion", "Super Hog Rider", "Super Yeti", } HomeTroopOrderWithSieges = append(append([]string{}, HomeTroopOrder...), SiegeMachineOrder...) SeasonalTroopOrder = []string{ "Ice Wizard", "Battle Ram", "Royal Ghost", "Pumpkin Barbarian", "Giant Skeleton", "Skeleton Barrel", "M.E.C.H.A", "Party Wizard", "Ram Rider", "Barcher", "Witch Golem", "Hog Wizard", "Lavaloon", "C.O.O.K.I.E", "Firecracker", "Azure Dragon", "Barbarian Kicker", "Giant Thrower", "Broom Witch", "Ice Minion", "Debt Collector", "Snake Barrel", "Giant Giant", "K.A.N.E", "The Disarmer", "YEETer", "YEETer", "The Disarmer", "Meteor Golem", } BuilderTroopOrder = []string{ "Raged Barbarian", "Sneaky Archer", "Beta Minion", "Boxer Giant", "Bomber", "Power P.E.K.K.A", "Cannon Cart", "Drop Ship", "Baby Dragon", "Night Witch", "Hog Glider", "Electrofire Wizard", } ElixirSpellOrder = []string{ "Lightning Spell", "Healing Spell", "Rage Spell", "Jump Spell", "Freeze Spell", "Clone Spell", "Invisibility Spell", "Recall Spell", "Revive Spell", "Totem Spell", } DarkElixirSpellOrder = []string{ "Poison Spell", "Earthquake Spell", "Haste Spell", "Skeleton Spell", "Bat Spell", "Overgrowth Spell", "Ice Block Spell", } SeasonalSpellOrder = []string{ "Santa's Surprise", "Bag of Frostmites", } SpellOrder = append(append([]string{}, ElixirSpellOrder...), DarkElixirSpellOrder...) HomeBaseHeroOrder = []string{ "Barbarian King", "Archer Queen", "Minion Prince", "Grand Warden", "Royal Champion", "Dragon Duke", } BuilderBaseHeroOrder = []string{ "Battle Machine", "Battle Copter", } HeroOrder = append(append([]string{}, HomeBaseHeroOrder...), BuilderBaseHeroOrder...) PetOrder = []string{ "L.A.S.S.I", "Mighty Yak", "Electro Owl", "Unicorn", "Phoenix", "Poison Lizard", "Diggy", "Frosty", "Spirit Fox", "Angry Jelly", "Sneezy", "Greedy Raven", } EquipmentOrder = []string{ "Barbarian Puppet", "Rage Vial", "Archer Puppet", "Invisibility Vial", "Eternal Tome", "Life Gem", "Seeking Shield", "Royal Gem", "Earthquake Boots", "Hog Rider Puppet", "Giant Gauntlet", "Vampstache", "Haste Vial", "Rocket Spear", "Spiky Ball", "Frozen Arrow", "Giant Arrow", "Heroic Torch", "Healer Puppet", "Fireball", "Rage Gem", "Snake Bracelet", "Healing Tome", "Dark Crown", "Magic Mirror", "Electro Boots", "Lavaloon Puppet", "Henchmen Puppet", "Dark Orb", "Metal Pants", "Noble Iron", "Action Figure", "Meteor Staff", "Frost Flake", "Stick Horse", "Fire Heart", "Rocket Backpack", "Stun Blaster", "Flame Blower", "Electro Fangs", } HVBuildingOrder = []string{ "Army Camp", "Town Hall", "Elixir Collector", "Elixir Storage", "Gold Mine", "Gold Storage", "Barracks", "Laboratory", "Cannon", "Archer Tower", "Wall", "Wizard Tower", "Air Defense", "Mortar", "Clan Castle", "Builder's Hut", "Hidden Tesla", "Spell Factory", "X-Bow", "Dark Elixir Drill", "Dark Elixir Storage", "Dark Barracks", "Inferno Tower", "Air Sweeper", "Dark Spell Factory", "Eagle Artillery", "Bomb Tower", "Workshop", "B.O.B's Hut", "Scattershot", "Pet House", "Blacksmith", "Hero Hall", "Spell Tower", "Monolith", "Multi-Gear Tower", "Sour Elixir Cauldron", "Multi-Archer Tower", "Ricochet Cannon", "Revenge Tower", "Firespitter", "Helper Hut", "Crafting Station", "Super Wizard Tower", } AchievementOrder = []string{ "Keep Your Account Safe!", "Bigger & Better", "Discover New Troops", "Bigger Coffers", "Gold Grab", "Elixir Escapade", "Heroic Heist", "Well Seasoned", "Nice and Tidy", "Empire Builder", "Clan War Wealth", "Friend in Need", "Sharing is caring", "Siege Sharer", "War Hero", "War League Legend", "Games Champion", "Unbreakable", "Sweet Victory!", "Conqueror", "League All-Star", "League Follower", "League Enthusiast", "League Superfan", "League Fanatic", "League Master", "Humiliator", "Not So Easy This Time", "Union Buster", "Bust This!", "Wall Buster", "Mortar Mauler", "X-Bow Exterminator", "Firefighter", "Anti-Artillery", "Shattered and Scattered", "Counterspell", "Monolith Masher", "Multi-Archer Tower Terminator", "Ricochet Cannon Crusher", "Firespitter Finisher", "Multi-Gear Tower Trampler", "Crafter’s Nightmare", "Get those Goblins!", "Supercharger", "Crafting Connoisseur", "Get those other Goblins!", "Get even more Goblins!", "Dragon Slayer", "Ungrateful Child", "Superb Work", "Master Engineering", "Hidden Treasures", "High Gear", "Next Generation Model", "Un-Build It", "Champion Builder", "Aggressive Capitalism", "Most Valuable Clanmate", } )
Functions ¶
func CorrectTag ¶
func GetSeasonID ¶
func GetSeasonID() string
Types ¶
type AccountData ¶
func ParseAccountData ¶
func ParseAccountData(data map[string]any) AccountData
type Achievement ¶
type ArmyRecipe ¶
type ArmyRecipe struct {
Link string
HeroesLoadout []HeroLoadout
Troops []TroopCount
Spells []SpellCount
ClanCastleTroops []TroopCount
ClanCastleSpells []SpellCount
}
func ParseArmyRecipe ¶
func ParseArmyRecipe(static *StaticData, link string) ArmyRecipe
type Badge ¶
type BattleLogEntry ¶
type BattleLogEntry struct {
BattleType string `json:"battleType,omitempty"`
Attack bool `json:"attack,omitempty"`
OpponentPlayerTag string `json:"opponentPlayerTag,omitempty"`
Stars int `json:"stars,omitempty"`
DestructionPercentage int `json:"destructionPercentage,omitempty"`
LootedResources []Resource `json:"lootedResources,omitempty"`
ExtraLootedResources []Resource `json:"extraLootedResources,omitempty"`
AvailableLoot []Resource `json:"availableLoot,omitempty"`
// contains filtered or unexported fields
}
func (BattleLogEntry) RetryAfter ¶
func (m BattleLogEntry) RetryAfter() int
type CapitalDistrict ¶
type ChatLanguage ¶
type Clan ¶
type Clan struct {
Tag string `json:"tag,omitempty"`
Name string `json:"name,omitempty"`
Type ClanType `json:"type,omitempty"`
Description string `json:"description,omitempty"`
FamilyFriendly bool `json:"isFamilyFriendly,omitempty"`
Level int `json:"clanLevel,omitempty"`
Points int `json:"clanPoints,omitempty"`
BuilderBasePoints int `json:"clanBuilderBasePoints,omitempty"`
CapitalPoints int `json:"clanCapitalPoints,omitempty"`
RequiredTrophies int `json:"requiredTrophies,omitempty"`
WarFrequency string `json:"warFrequency,omitempty"`
WarWinStreak int `json:"warWinStreak,omitempty"`
WarWins int `json:"warWins,omitempty"`
WarTies int `json:"warTies,omitempty"`
WarLosses int `json:"warLosses,omitempty"`
PublicWarLog bool `json:"isWarLogPublic,omitempty"`
MemberCount int `json:"members,omitempty"`
RequiredBuilderBaseTrophies int `json:"requiredBuilderBaseTrophies,omitempty"`
RequiredTownhall int `json:"requiredTownhallLevel,omitempty"`
Location *Location `json:"location,omitempty"`
Badge Badge `json:"badgeUrls,omitempty"`
Labels []Label `json:"labels,omitempty"`
Members []ClanMember `json:"memberList,omitempty"`
WarLeague *League `json:"warLeague,omitempty"`
CapitalLeague *League `json:"capitalLeague,omitempty"`
ChatLanguage *ChatLanguage `json:"chatLanguage,omitempty"`
ClanCapital *ClanCapital `json:"clanCapital,omitempty"`
// contains filtered or unexported fields
}
func (*Clan) GetMember ¶
func (c *Clan) GetMember(tag string) *ClanMember
func (*Clan) GetMemberBy ¶
func (c *Clan) GetMemberBy(name string, trophies int) *ClanMember
func (Clan) RetryAfter ¶
func (m Clan) RetryAfter() int
type ClanCapital ¶
type ClanCapital struct {
Districts []CapitalDistrict `json:"districts,omitempty"`
}
type ClanMember ¶
type ClanMember struct {
Tag string `json:"tag,omitempty"`
Name string `json:"name,omitempty"`
Role Role `json:"role,omitempty"`
ExpLevel int `json:"expLevel,omitempty"`
Trophies int `json:"trophies,omitempty"`
ClanRank int `json:"clanRank,omitempty"`
ClanPreviousRank int `json:"previousClanRank,omitempty"`
Donations int `json:"donations,omitempty"`
Received int `json:"donationsReceived,omitempty"`
VersusTrophies int `json:"versusTrophies,omitempty"`
BuilderBaseTrophies int `json:"builderBaseTrophies,omitempty"`
VersusRank int `json:"versusRank,omitempty"`
BuilderBaseRank int `json:"builderBaseRank,omitempty"`
League *League `json:"league,omitempty"`
// contains filtered or unexported fields
}
func (ClanMember) RetryAfter ¶
func (m ClanMember) RetryAfter() int
type ClanWar ¶
type ClanWar struct {
State WarState `json:"state,omitempty"`
TeamSize int `json:"teamSize,omitempty"`
PreparationStartTime *Timestamp `json:"preparationStartTime,omitempty"`
StartTime *Timestamp `json:"startTime,omitempty"`
EndTime *Timestamp `json:"endTime,omitempty"`
Clan *WarClan `json:"clan,omitempty"`
Opponent *WarClan `json:"opponent,omitempty"`
BattleModifier string `json:"battleModifier,omitempty"`
WarTag string `json:"tag,omitempty"`
ClanTag string `json:"-"`
// contains filtered or unexported fields
}
func (ClanWar) RetryAfter ¶
func (m ClanWar) RetryAfter() int
type ClanWarLeagueClan ¶
type ClanWarLeagueGroup ¶
type ClanWarLeagueGroup struct {
State string `json:"state,omitempty"`
Season string `json:"season,omitempty"`
Clans []ClanWarLeagueClan `json:"clans,omitempty"`
Rounds []struct {
WarTags []string `json:"warTags,omitempty"`
} `json:"rounds,omitempty"`
// contains filtered or unexported fields
}
func (ClanWarLeagueGroup) RetryAfter ¶
func (m ClanWarLeagueGroup) RetryAfter() int
type ClanWarLogEntry ¶
type ClanWarLogEntry struct {
Result WarResult `json:"result,omitempty"`
EndTime *Timestamp `json:"endTime,omitempty"`
TeamSize int `json:"teamSize,omitempty"`
Clan *WarClan `json:"clan,omitempty"`
Opponent *WarClan `json:"opponent,omitempty"`
// contains filtered or unexported fields
}
func (ClanWarLogEntry) RetryAfter ¶
func (m ClanWarLogEntry) RetryAfter() int
type ClanWarMember ¶
type ClanWarMember struct {
Tag string `json:"tag,omitempty"`
Name string `json:"name,omitempty"`
MapPosition int `json:"mapPosition,omitempty"`
Townhall int `json:"townhallLevel,omitempty"`
OpponentAttacks int `json:"opponentAttacks,omitempty"`
Attacks []WarAttack `json:"attacks,omitempty"`
BestOpponentAttack *WarAttack `json:"bestOpponentAttack,omitempty"`
Clan *WarClan
}
type ClashOfClansException ¶
type ClashOfClansException struct {
Message string
}
func (*ClashOfClansException) Error ¶
func (e *ClashOfClansException) Error() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(cfg ClientConfig) (*Client, error)
func (*Client) GetBattleLog ¶
func (*Client) GetBuilderBaseLeague ¶
func (*Client) GetCapitalLeague ¶
func (*Client) GetClanLabels ¶
func (*Client) GetClanWar ¶
func (*Client) GetClanWars ¶
func (*Client) GetCurrentGoldPassSeason ¶
func (c *Client) GetCurrentGoldPassSeason(ctx context.Context) (*GoldPassSeason, error)
func (*Client) GetCurrentWar ¶
func (*Client) GetCurrentWars ¶
func (*Client) GetExtendedCWLGroupData ¶
func (c *Client) GetExtendedCWLGroupData(name string) *ExtendedCWLGroup
func (*Client) GetLeagueGroup ¶
func (*Client) GetLeagueWar ¶
func (*Client) GetLeagueWars ¶
func (*Client) GetLocation ¶
func (*Client) GetLocationClans ¶
func (*Client) GetLocationClansBuilderBase ¶
func (*Client) GetLocationClansCapital ¶
func (*Client) GetLocationNamed ¶
func (*Client) GetLocationPlayers ¶
func (*Client) GetLocationPlayersBuilderBase ¶
func (*Client) GetMembers ¶
func (*Client) GetPlayerLabels ¶
func (*Client) GetPlayerLeagueGroup ¶
func (*Client) GetPlayerLeagueHistory ¶
func (*Client) GetRaidLog ¶
func (*Client) GetSeasonRankings ¶
func (*Client) GetSeasons ¶
func (*Client) GetTranslation ¶
func (c *Client) GetTranslation(id string) *Translation
func (*Client) GetWarLeague ¶
func (*Client) LoginWithTokens ¶
func (*Client) ParseAccountData ¶
func (c *Client) ParseAccountData(data map[string]any) AccountData
func (*Client) ParseArmyLink ¶
func (c *Client) ParseArmyLink(link string) ArmyRecipe
func (*Client) SearchBuilderBaseLeagues ¶
func (*Client) SearchCapitalLeagues ¶
func (*Client) SearchClans ¶
func (*Client) SearchLeagues ¶
func (*Client) SearchLocations ¶
func (*Client) SearchWarLeagues ¶
func (*Client) StaticData ¶
func (c *Client) StaticData() *StaticData
type ClientConfig ¶
type ClientConfig struct {
KeyCount int
KeyNames string
ThrottleLimit int
Timeout time.Duration
BaseURL string
DeveloperBaseURL string
IP string
Realtime bool
CorrectTags bool
CacheMaxSize int
LookupCache bool
UpdateCache bool
IgnoreCachedErrors []int
RawJSON bool
LoadGameData LoadGameData
UserAgent string
DeveloperUserAgent string
}
func DefaultClientConfig ¶
func DefaultClientConfig() ClientConfig
type Equipment ¶
type ExtendedCWLGroup ¶
type Forbidden ¶
type Forbidden struct{ *HTTPException }
type GatewayError ¶
type GatewayError struct{ *HTTPException }
type GoldPassSeason ¶
type GoldPassSeason struct {
StartTime *Timestamp `json:"startTime"`
EndTime *Timestamp `json:"endTime"`
// contains filtered or unexported fields
}
func (GoldPassSeason) RetryAfter ¶
func (m GoldPassSeason) RetryAfter() int
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
func NewHTTPClient ¶
func NewHTTPClient(cfg ClientConfig) *HTTPClient
func (*HTTPClient) Do ¶
func (h *HTTPClient) Do(ctx context.Context, method, fullURL string, body any, options RequestOptions) ([]byte, int, int, error)
func (*HTTPClient) LoginDeveloper ¶
func (h *HTTPClient) LoginDeveloper(ctx context.Context, email, password string) error
func (*HTTPClient) SetTokens ¶
func (h *HTTPClient) SetTokens(tokens ...string)
type HTTPException ¶
func (*HTTPException) Error ¶
func (e *HTTPException) Error() string
type Hero ¶
type HeroLoadout ¶
type InvalidArgument ¶
type InvalidArgument struct{ *HTTPException }
type InvalidCredentials ¶
type InvalidCredentials struct{ *HTTPException }
type Label ¶
type Label struct {
ID int `json:"id"`
Name string `json:"name"`
Icon *Icon `json:"iconUrls"`
// contains filtered or unexported fields
}
func (Label) RetryAfter ¶
func (m Label) RetryAfter() int
type League ¶
type League struct {
ID int `json:"id"`
Name string `json:"name"`
Icon *Icon `json:"iconUrls"`
// contains filtered or unexported fields
}
func (League) RetryAfter ¶
func (m League) RetryAfter() int
type LeagueHistoryEntry ¶
type LeagueHistoryEntry struct {
LeagueSeasonID int `json:"leagueSeasonId,omitempty"`
LeagueTrophies int `json:"leagueTrophies,omitempty"`
LeagueTierID int `json:"leagueTierId,omitempty"`
Placement int `json:"placement,omitempty"`
AttackWins int `json:"attackWins,omitempty"`
AttackLosses int `json:"attackLosses,omitempty"`
AttackStars int `json:"attackStars,omitempty"`
DefenseWins int `json:"defenseWins,omitempty"`
DefenseLosses int `json:"defenseLosses,omitempty"`
DefenseStars int `json:"defenseStars,omitempty"`
MaxBattles int `json:"maxBattles,omitempty"`
// contains filtered or unexported fields
}
func (LeagueHistoryEntry) RetryAfter ¶
func (m LeagueHistoryEntry) RetryAfter() int
type LeagueTierGroup ¶
type LeagueTierGroup struct {
Members []LeagueTierGroupMember `json:"members,omitempty"`
AttackLogs []LeagueTierGroupBattleLogEntry `json:"attackLogs,omitempty"`
DefenseLogs []LeagueTierGroupBattleLogEntry `json:"defenseLogs,omitempty"`
// contains filtered or unexported fields
}
func (LeagueTierGroup) RetryAfter ¶
func (m LeagueTierGroup) RetryAfter() int
type LeagueTierGroupBattleLogEntry ¶
type LeagueTierGroupBattleLogEntry struct {
OpponentPlayerTag string `json:"opponentPlayerTag,omitempty"`
OpponentName string `json:"opponentName,omitempty"`
Stars int `json:"stars,omitempty"`
DestructionPercentage int `json:"destructionPercentage,omitempty"`
Trophies int `json:"trophies,omitempty"`
CreationTime string `json:"creationTime,omitempty"`
}
type LeagueTierGroupMember ¶
type LeagueTierGroupMember struct {
PlayerTag string `json:"playerTag,omitempty"`
PlayerName string `json:"playerName,omitempty"`
ClanTag string `json:"clanTag,omitempty"`
ClanName string `json:"clanName,omitempty"`
LeagueTrophies int `json:"leagueTrophies,omitempty"`
AttackWinCount int `json:"attackWinCount,omitempty"`
AttackLoseCount int `json:"attackLoseCount,omitempty"`
DefenseWinCount int `json:"defenseWinCount,omitempty"`
DefenseLoseCount int `json:"defenseLoseCount,omitempty"`
}
type LegendStatistics ¶
type LoadGameData ¶
func DefaultLoadGameData ¶
func DefaultLoadGameData() LoadGameData
type Location ¶
type Location struct {
ID int `json:"id"`
Name string `json:"name"`
IsCountry bool `json:"isCountry"`
CountryCode string `json:"countryCode"`
Localised string `json:"localizedName"`
// contains filtered or unexported fields
}
func (Location) RetryAfter ¶
func (m Location) RetryAfter() int
type Maintenance ¶
type Maintenance struct{ *HTTPException }
type NotFound ¶
type NotFound struct{ *HTTPException }
type Pet ¶
type Pet struct {
Name string `json:"name"`
Level int `json:"level"`
MaxLevel int `json:"maxLevel"`
Village string `json:"village"`
StaticUnit
}
type Player ¶
type Player struct {
Tag string `json:"tag,omitempty"`
Name string `json:"name,omitempty"`
ExpLevel int `json:"expLevel,omitempty"`
Trophies int `json:"trophies,omitempty"`
BestTrophies int `json:"bestTrophies,omitempty"`
WarStars int `json:"warStars,omitempty"`
TownHall int `json:"townHallLevel,omitempty"`
TownHallWeapon int `json:"townHallWeaponLevel,omitempty"`
BuilderHall int `json:"builderHallLevel,omitempty"`
BestBuilderBaseTrophies int `json:"bestBuilderBaseTrophies,omitempty"`
VersusAttackWins int `json:"versusBattleWins,omitempty"`
Donations int `json:"donations,omitempty"`
Received int `json:"donationsReceived,omitempty"`
ClanRank int `json:"clanRank,omitempty"`
ClanPreviousRank int `json:"previousClanRank,omitempty"`
VersusTrophies int `json:"versusTrophies,omitempty"`
BuilderBaseTrophies int `json:"builderBaseTrophies,omitempty"`
LeagueTier *League `json:"leagueTier,omitempty"`
BuilderBaseLeague *League `json:"builderBaseLeague,omitempty"`
Role Role `json:"role,omitempty"`
Clan *PlayerClan `json:"clan,omitempty"`
CurrentLeagueGroupTag string `json:"currentLeagueGroupTag,omitempty"`
CurrentLeagueSeasonID int `json:"currentLeagueSeasonId,omitempty"`
PreviousLeagueGroupTag string `json:"previousLeagueGroupTag,omitempty"`
PreviousLeagueSeasonID int `json:"previousLeagueSeasonId,omitempty"`
LegendStatistics *LegendStatistics `json:"legendStatistics,omitempty"`
Labels []Label `json:"labels,omitempty"`
Achievements []Achievement `json:"achievements,omitempty"`
Troops []Troop `json:"troops,omitempty"`
Heroes []Hero `json:"heroes,omitempty"`
Spells []Spell `json:"spells,omitempty"`
HeroEquipment []Equipment `json:"heroEquipment,omitempty"`
// contains filtered or unexported fields
}
func (*Player) BuilderTroops ¶
func (*Player) GetAchievement ¶
func (p *Player) GetAchievement(name string) *Achievement
func (*Player) HomeTroops ¶
func (Player) RetryAfter ¶
func (m Player) RetryAfter() int
type PlayerClan ¶
type PlayerHouseElement ¶
type PrivateWarLog ¶
type PrivateWarLog struct{ *HTTPException }
type RaidAttack ¶
type RaidClan ¶
type RaidClan struct {
AttackCount int `json:"attackCount,omitempty"`
DistrictCount int `json:"districtCount,omitempty"`
DestroyedDistrictCount int `json:"districtsDestroyed,omitempty"`
Districts []RaidDistrict `json:"districts,omitempty"`
Attacker *struct {
Tag string `json:"tag,omitempty"`
Name string `json:"name,omitempty"`
Level int `json:"level,omitempty"`
} `json:"attacker,omitempty"`
Defender *struct {
Tag string `json:"tag,omitempty"`
Name string `json:"name,omitempty"`
Level int `json:"level,omitempty"`
} `json:"defender,omitempty"`
}
type RaidDistrict ¶
type RaidDistrict struct {
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
HallLevel int `json:"districtHallLevel,omitempty"`
Destruction float64 `json:"destructionPercent,omitempty"`
AttackCount int `json:"attackCount,omitempty"`
Looted int `json:"totalLooted,omitempty"`
Attacks []RaidAttack `json:"attacks,omitempty"`
}
type RaidLogEntry ¶
type RaidLogEntry struct {
State string `json:"state,omitempty"`
TotalLoot int `json:"capitalTotalLoot,omitempty"`
CompletedRaidCount int `json:"raidsCompleted,omitempty"`
AttackCount int `json:"totalAttacks,omitempty"`
DestroyedDistrictCount int `json:"enemyDistrictsDestroyed,omitempty"`
OffensiveReward int `json:"offensiveReward,omitempty"`
DefensiveReward int `json:"defensiveReward,omitempty"`
StartTime *Timestamp `json:"startTime,omitempty"`
EndTime *Timestamp `json:"endTime,omitempty"`
AttackLog []RaidClan `json:"attackLog,omitempty"`
DefenseLog []RaidClan `json:"defenseLog,omitempty"`
Members []RaidMember `json:"members,omitempty"`
// contains filtered or unexported fields
}
func (*RaidLogEntry) GetMember ¶
func (r *RaidLogEntry) GetMember(tag string) *RaidMember
func (RaidLogEntry) RetryAfter ¶
func (m RaidLogEntry) RetryAfter() int
type RaidMember ¶
type RaidMember struct {
Tag string `json:"tag,omitempty"`
Name string `json:"name,omitempty"`
AttackCount int `json:"attacks,omitempty"`
AttackLimit int `json:"attackLimit,omitempty"`
BonusAttackLimit int `json:"bonusAttackLimit,omitempty"`
CapitalResourcesLooted int `json:"capitalResourcesLooted,omitempty"`
}
type RankedClan ¶
type RankedClan struct {
Clan
Rank int `json:"rank,omitempty"`
PreviousRank int `json:"previousRank,omitempty"`
}
func (RankedClan) RetryAfter ¶
func (m RankedClan) RetryAfter() int
type RankedPlayer ¶
type RankedPlayer struct {
Player
Rank int `json:"rank,omitempty"`
PreviousRank int `json:"previousRank,omitempty"`
}
func (RankedPlayer) RetryAfter ¶
func (m RankedPlayer) RetryAfter() int
type RequestOptions ¶
type SearchClansRequest ¶
type SeasonWindow ¶
func GetSeasonByID ¶
func GetSeasonByID(seasonID string) (SeasonWindow, error)
type Spell ¶
type Spell struct {
Name string `json:"name"`
Level int `json:"level"`
MaxLevel int `json:"maxLevel"`
Village string `json:"village"`
StaticUnit
}
type SpellCount ¶
type StaticData ¶
type StaticData struct {
Raw map[string][]map[string]any
ByID map[int]map[string]any
ByName map[string]map[string]any
Translations map[string]map[string]string
}
func LoadStaticData ¶
func LoadStaticData() (*StaticData, error)
func (*StaticData) LookupByID ¶
func (s *StaticData) LookupByID(id int) map[string]any
func (*StaticData) LookupByName ¶
func (s *StaticData) LookupByName(name, section, village string) map[string]any
type StaticUnit ¶
type TournamentWindow ¶
func GetTournamentWindow ¶
func GetTournamentWindow(timestamp time.Time) TournamentWindow
func GetTournamentWindowByID ¶
func GetTournamentWindowByID(id string) (TournamentWindow, error)
type Translation ¶
type Translation struct {
ID string `json:"id"`
English string `json:"EN"`
Languages map[string]string `json:"-"`
}
func (*Translation) UnmarshalJSON ¶
func (t *Translation) UnmarshalJSON(data []byte) error
type Troop ¶
type Troop struct {
Name string `json:"name"`
Level int `json:"level"`
MaxLevel int `json:"maxLevel"`
Village string `json:"village"`
SuperTroopIsActive bool `json:"superTroopIsActive"`
StaticUnit
}
func (Troop) IsBuilderBase ¶
func (Troop) IsHomeBase ¶
func (Troop) IsSuperTroop ¶
type TroopCount ¶
type VillageType ¶
type VillageType string
const ( VillageHome VillageType = "home" VillageBuilderBase VillageType = "builderBase" VillageClanCapital VillageType = "clanCapital" )
type WarAttack ¶
type WarAttack struct {
Order int `json:"order,omitempty"`
AttackerTag string `json:"attackerTag,omitempty"`
DefenderTag string `json:"defenderTag,omitempty"`
Stars int `json:"stars,omitempty"`
Destruction float64 `json:"destructionPercentage,omitempty"`
Duration int `json:"duration,omitempty"`
Attacker *ClanWarMember
Defender *ClanWarMember
}
type WarClan ¶
type WarClan struct {
Tag string `json:"tag,omitempty"`
Name string `json:"name,omitempty"`
Badge Badge `json:"badgeUrls,omitempty"`
Level int `json:"clanLevel,omitempty"`
Attacks int `json:"attacks,omitempty"`
Stars int `json:"stars,omitempty"`
Destruction float64 `json:"destructionPercentage,omitempty"`
ExpEarned int `json:"expEarned,omitempty"`
Members []ClanWarMember `json:"members,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.