Documentation
¶
Index ¶
- Variables
- type APIError
- type Achievement
- type Arena
- type BattleLogEntries
- type BattleLogEntry
- type BattleLogPlayer
- type Card
- type CardIconUrls
- type Clan
- type ClanInterface
- type ClanMember
- type ClanPaging
- type ClanQuery
- type ClanWar
- type ClanWarParticipant
- type ClanWarStanding
- type ClansInterface
- type Client
- func (c *Client) Clan(tag string) *ClanInterface
- func (c *Client) Clans() *ClansInterface
- func (c *Client) Location(id int) *LocationInterface
- func (c *Client) Locations() *LocationsInterface
- func (c *Client) Player(tag string) *PlayerInterface
- func (c *Client) Tournament(tag string) *TournamentInterface
- func (c *Client) Tournaments() *TournamentsInterface
- type ErrorBody
- type FavouriteCard
- type GameMode
- type LeagueStatistics
- type Location
- type LocationClanRanking
- type LocationClanRankingPager
- type LocationInterface
- func (i *LocationInterface) ClanRankings(query *PagedQuery) (LocationClanRankingPager, error)
- func (i *LocationInterface) ClanWarRankings(query *PagedQuery) (LocationClanRankingPager, error)
- func (i *LocationInterface) Get() (Location, error)
- func (i *LocationInterface) PlayerRankings(query *PagedQuery) (LocationPlayerRankingPager, error)
- type LocationPager
- type LocationPlayerRanking
- type LocationPlayerRankingPager
- type LocationsInterface
- type MemberPaging
- type PagedQuery
- type Paging
- type Player
- type PlayerClan
- type PlayerInterface
- type Season
- type Tournament
- type TournamentInterface
- type TournamentMember
- type TournamentPaging
- type TournamentQuery
- type TournamentsInterface
- type UpcomingChest
- type UpcomingChests
- type VerificationResult
- type WarLogEntry
- type WarLogPaging
- type WarLogStanding
Constants ¶
This section is empty.
Variables ¶
var TimeLayout = "20060102T150405.000Z"
This is the time format used by time fields -- we'll be using it to provide cleaner APIs.
Functions ¶
This section is empty.
Types ¶
type Achievement ¶
type BattleLogEntries ¶
type BattleLogEntries []BattleLogEntry
type BattleLogEntry ¶
type BattleLogEntry struct {
Type string `json:"type"`
RawBattleTime string `json:"battleTime"`
Arena Arena `json:"arena"`
GameMode GameMode `json:"gameMode"`
DeckSelection string `json:"deckSelection"`
Team []BattleLogPlayer `json:"team"`
Opponent []BattleLogPlayer `json:"opponent"`
}
func (*BattleLogEntry) BattleTime ¶
func (b *BattleLogEntry) BattleTime() time.Time
type BattleLogPlayer ¶
type BattleLogPlayer struct {
Tag string `json:"tag"`
Name string `json:"name"`
StartingTrophies int `json:"startingTrophies"`
TrophyChange int `json:"trophyChange"`
Crowns int `json:"crowns"`
Clan struct {
Tag string `json:"tag"`
Name string `json:"name"`
BadgeId int `json:"badgeId"`
} `json:"clan"`
Cards []Card `json:"cards"`
}
type Card ¶
type Card struct {
Name string `json:"name"`
Level int `json:"level"`
MaxLevel int `json:"maxLevel"`
Count int `json:"count"`
IconUrls CardIconUrls `json:"iconUrls"`
}
type CardIconUrls ¶
type CardIconUrls struct {
Medium string `json:"medium"`
}
type Clan ¶
type Clan struct {
Tag string `json:"tag"`
Name string `json:"name"`
Type string `json:"type"`
Description string `json:"description"`
BadgeId int `json:"badgeId"`
ClanScore int `json:"clanScore"`
Location Location `json:"location"`
RequiredTrophies int `json:"requiredTrophies"`
DonationsPerWeek int `json:"donationsPerWeek"`
ClanChestStatus string `json:"clanChestStatus"`
ClanChestPoints int `json:"clanChestPoints"`
ClanChestLevel int `json:"clanChestLevel"`
ClanChestMaxLevel int `json:"clanChestMaxLevel"`
Members int `json:"members"`
MemberList []ClanMember `json:"memberList"`
}
type ClanInterface ¶
type ClanInterface struct {
// contains filtered or unexported fields
}
func (*ClanInterface) CurrentWar ¶
func (i *ClanInterface) CurrentWar() (ClanWar, error)
Retrieve information about clan's current clan war
func (*ClanInterface) Get ¶
func (i *ClanInterface) Get() (Clan, error)
Get information about a single clan by clan tag. Clan tags can be found using clan search operation.
func (*ClanInterface) Members ¶
func (i *ClanInterface) Members() (MemberPaging, error)
List clan members
func (*ClanInterface) WarLog ¶
func (i *ClanInterface) WarLog() (WarLogPaging, error)
Retrieve clan's clan war log
type ClanMember ¶
type ClanMember struct {
Tag string `json:"tag"`
Name string `json:"name"`
Role string `json:"role"`
ExpLevel int `json:"expLevel"`
Trophies int `json:"trophies"`
Arena Arena `json:"arena"`
ClanRank int `json:"clanRank"`
PreviousClanRank int `json:"previousClanRank"`
Donations int `json:"donations"`
DonationsReceived int `json:"donationsReceived"`
ClanChestPoints int `json:"clanChestPoints"`
}
type ClanPaging ¶
type ClanWar ¶
type ClanWar struct {
State string `json:"state"`
RawCollectionEndTime string `json:"collectionEndTime"`
Clan ClanWarStanding `json:"clan"`
Participants []ClanWarParticipant `json:"participants"`
}
func (*ClanWar) CollectionEndTime ¶
type ClanWarParticipant ¶
type ClanWarStanding ¶
type ClansInterface ¶
type ClansInterface struct {
// contains filtered or unexported fields
}
func (*ClansInterface) Search ¶
func (i *ClansInterface) Search(query *ClanQuery) (ClanPaging, error)
Search all clans by name and/or filtering the results using various criteria. At least one filtering criteria must be defined and if name is used as part of search, it is required to be at least three characters long.
type Client ¶
type Client struct {
BaseURL *url.URL
UserAgent string
Bearer string
// contains filtered or unexported fields
}
func (*Client) Clan ¶
func (c *Client) Clan(tag string) *ClanInterface
func (*Client) Clans ¶
func (c *Client) Clans() *ClansInterface
func (*Client) Location ¶
func (c *Client) Location(id int) *LocationInterface
func (*Client) Locations ¶
func (c *Client) Locations() *LocationsInterface
func (*Client) Player ¶
func (c *Client) Player(tag string) *PlayerInterface
func (*Client) Tournament ¶
func (c *Client) Tournament(tag string) *TournamentInterface
func (*Client) Tournaments ¶
func (c *Client) Tournaments() *TournamentsInterface
type FavouriteCard ¶
type FavouriteCard struct {
Name string `json:"name"`
ID int `json:"id"`
MaxLevel int `json:"maxLevel"`
IconUrls CardIconUrls `json:"iconUrls"`
}
type LeagueStatistics ¶
type LocationClanRanking ¶
type LocationClanRankingPager ¶
type LocationClanRankingPager struct {
Items []LocationClanRanking `json:"items"`
Paging Paging `json:"paging"`
}
type LocationInterface ¶
type LocationInterface struct {
// contains filtered or unexported fields
}
func (*LocationInterface) ClanRankings ¶
func (i *LocationInterface) ClanRankings(query *PagedQuery) (LocationClanRankingPager, error)
Get clan rankings for a specific location
func (*LocationInterface) ClanWarRankings ¶ added in v1.1.0
func (i *LocationInterface) ClanWarRankings(query *PagedQuery) (LocationClanRankingPager, error)
Get clan war rankings for a specific location
func (*LocationInterface) Get ¶
func (i *LocationInterface) Get() (Location, error)
Get information about specific location
func (*LocationInterface) PlayerRankings ¶
func (i *LocationInterface) PlayerRankings(query *PagedQuery) (LocationPlayerRankingPager, error)
Get player rankings for a specific location
type LocationPager ¶
type LocationPlayerRanking ¶
type LocationPlayerRankingPager ¶
type LocationPlayerRankingPager struct {
Items []LocationPlayerRanking `json:"items"`
Paging Paging `json:"paging"`
}
type LocationsInterface ¶
type LocationsInterface struct {
// contains filtered or unexported fields
}
func (*LocationsInterface) All ¶
func (i *LocationsInterface) All() (LocationPager, error)
List all available locations
type MemberPaging ¶
type MemberPaging struct {
Items []ClanMember `json:"items"`
Paging Paging `json:"paging"`
}
type PagedQuery ¶ added in v1.1.0
Base struct for paged queries.
type Paging ¶ added in v1.1.0
type Paging struct {
Cursors struct {
Before string `json:"before"`
After string `json:"after"`
} `json:"cursors"`
}
Paging for pager responses. 'before' and 'after' may be empty if there are no more results to return.
type Player ¶
type Player struct {
Tag string `json:"tag"`
Name string `json:"name"`
ExpLevel int `json:"expLevel"`
Trophies int `json:"trophies"`
BestTrophies int `json:"bestTrophies"`
Wins int `json:"wins"`
Losses int `json:"losses"`
BattleCount int `json:"battleCount"`
ThreeCrownWins int `json:"threeCrownWins"`
ChallengeCardsWon int `json:"challengeCardsWon"`
ChallengeMaxWins int `json:"challengeMaxWins"`
TournamentCardsWon int `json:"tournamentCardsWon"`
TournamentBattleCount int `json:"tournamentBattleCount"`
Role string `json:"role"`
Donations int `json:"donations"`
DonationsReceived int `json:"donationsReceived"`
TotalDonations int `json:"totalDonations"`
WarDayWins int `json:"warDayWins"`
ClanCardsCollected int `json:"clanCardsCollected"`
Clan PlayerClan `json:"clan"`
Arena Arena `json:"arena"`
Achievements []Achievement `json:"achievements"`
Cards []Card `json:"cards"`
CurrentDeck []Card `json:"currentDeck"`
CurrentFavouriteCard FavouriteCard `json:"currentFavouriteCard"`
LeagueStatistics LeagueStatistics `json:"leagueStatistics"`
}
type PlayerClan ¶
type PlayerInterface ¶
type PlayerInterface struct {
// contains filtered or unexported fields
}
func (*PlayerInterface) BattleLog ¶
func (i *PlayerInterface) BattleLog() (BattleLogEntries, error)
Get list of recent battle results for a player.
func (*PlayerInterface) Get ¶
func (i *PlayerInterface) Get() (Player, error)
Get information about a single player by player tag. Player tags can be found either in game or by from clan member lists.
func (*PlayerInterface) UpcomingChests ¶
func (i *PlayerInterface) UpcomingChests() (UpcomingChests, error)
Get list of reward chests that the player will receive next in the game.
func (*PlayerInterface) VerifyToken ¶
func (i *PlayerInterface) VerifyToken(token string) (VerificationResult, error)
Verifies a player token and returns whether or not the token was associated with the given player.
This API call can be used by a player to prove that they own a particular game account as the token can only be retrieved inside the game from settings view.
type Tournament ¶
type Tournament struct {
Tag string `json:"tag"`
Type string `json:"type"`
Status string `json:"status"`
CreatorTag string `json:"creatorTag"`
Name string `json:"name"`
Description string `json:"description"`
Capacity int `json:"capacity"`
MaxCapacity int `json:"maxCapacity"`
PreparationDuration int `json:"preparationDuration"`
Duration int `json:"duration"`
RawCreatedTime string `json:"createdTime"`
RawStartedTime string `json:"startedTime"`
MembersList []TournamentMember `json:"membersList"`
}
func (*Tournament) CreatedTime ¶
func (t *Tournament) CreatedTime() time.Time
func (*Tournament) StartedTime ¶
func (t *Tournament) StartedTime() time.Time
type TournamentInterface ¶
type TournamentInterface struct {
// contains filtered or unexported fields
}
func (*TournamentInterface) Get ¶
func (i *TournamentInterface) Get() (Tournament, error)
Get information about a single tournament by a tournament tag.
type TournamentMember ¶
type TournamentMember struct {
Tag string `json:"tag"`
Name string `json:"name"`
Score int `json:"score"`
Rank int `json:"rank"`
Clan PlayerClan `json:"clan"`
}
type TournamentPaging ¶
type TournamentPaging struct {
Items []Tournament `json:"items"`
Paging Paging `json:"paging"`
}
type TournamentQuery ¶
type TournamentQuery struct {
PagedQuery
Name string
}
type TournamentsInterface ¶
type TournamentsInterface struct {
// contains filtered or unexported fields
}
func (*TournamentsInterface) Search ¶
func (i *TournamentsInterface) Search(query *TournamentQuery) (TournamentPaging, error)
Search all tournaments by name.
It is not possible to specify ordering for results so clients should not rely on any specific ordering as that may change in the future releases of the API.
type UpcomingChest ¶
type UpcomingChests ¶
type UpcomingChests struct {
Items []UpcomingChest `json:"items"`
}
type VerificationResult ¶
type WarLogEntry ¶
type WarLogEntry struct {
SeasonId int `json:"seasonId"`
RawCreatedDate string `json:"createdDate"`
Participants []ClanWarParticipant `json:"participants"`
Standings []WarLogStanding `json:"standings"`
}
func (*WarLogEntry) CreatedDate ¶
func (w *WarLogEntry) CreatedDate() time.Time
type WarLogPaging ¶
type WarLogPaging struct {
Items []WarLogEntry `json:"items"`
Paging Paging `json:"paging"`
}
type WarLogStanding ¶
type WarLogStanding struct {
Clan ClanWarStanding `json:"clan"`
TrophyChange int `json:"trophyChange"`
}