add some new files and services add hwtools that shows the current and last GWs - not yet included the user stats (if any available)
1154 lines
45 KiB
Go
1154 lines
45 KiB
Go
// This file was generated from JSON Schema using quicktype, do not modify it directly.
|
|
// To parse and unparse this JSON data, add this code to your project and do:
|
|
//
|
|
// qtmodels, err := UnmarshalQtmodels(bytes)
|
|
// bytes, err = qtmodels.Marshal()
|
|
|
|
package qtmodels
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/json"
|
|
"errors"
|
|
)
|
|
|
|
type Qtmodels []Qtmodel
|
|
|
|
func UnmarshalQtmodels(data []byte) (Qtmodels, error) {
|
|
var r Qtmodels
|
|
err := json.Unmarshal(data, &r)
|
|
return r, err
|
|
}
|
|
|
|
func (r *Qtmodels) Marshal() ([]byte, error) {
|
|
return json.Marshal(r)
|
|
}
|
|
|
|
type Qtmodel struct {
|
|
Date float64 `json:"date"`
|
|
Request Request `json:"request"`
|
|
Response QtmodelResponse `json:"response"`
|
|
}
|
|
|
|
func UnmarshalQtmodel(data []byte) (Qtmodel, error) {
|
|
var r Qtmodel
|
|
err := json.Unmarshal(data, &r)
|
|
return r, err
|
|
}
|
|
|
|
func (r *Qtmodel) Marshal() ([]byte, error) {
|
|
return json.Marshal(r)
|
|
}
|
|
|
|
type Request struct {
|
|
Call Call `json:"call"`
|
|
Headers Headers `json:"headers"`
|
|
Ident string `json:"ident"`
|
|
}
|
|
|
|
type Call struct {
|
|
Args Args `json:"args"`
|
|
Ident string `json:"ident"`
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
type Args struct {
|
|
Day *int64 `json:"day,omitempty"`
|
|
Heroes []ArgsHero `json:"heroes"`
|
|
ID *string `json:"id,omitempty"`
|
|
Pet *int64 `json:"pet,omitempty"`
|
|
Pets []int64 `json:"pets"`
|
|
Progress []ArgsProgress `json:"progress"`
|
|
Result *ArgsResult `json:"result,omitempty"`
|
|
Season *int64 `json:"season,omitempty"`
|
|
SlotID *int64 `json:"slotId,omitempty"`
|
|
UserID *int64 `json:"userId,omitempty"`
|
|
}
|
|
|
|
type ArgsProgress struct {
|
|
Attackers PurpleAttackers `json:"attackers"`
|
|
B int64 `json:"b"`
|
|
Defenders Ers `json:"defenders"`
|
|
Seed int64 `json:"seed"`
|
|
V int64 `json:"v"`
|
|
}
|
|
|
|
type PurpleAttackers struct {
|
|
Heroes map[string]HeroValue `json:"heroes"`
|
|
Input []Input `json:"input"`
|
|
}
|
|
|
|
type HeroValue struct {
|
|
Energy int64 `json:"energy"`
|
|
Extra *Extra `json:"extra,omitempty"`
|
|
HP int64 `json:"hp"`
|
|
IsDead bool `json:"isDead"`
|
|
MaxHP *int64 `json:"maxHp,omitempty"`
|
|
}
|
|
|
|
type Extra struct {
|
|
Sun int64 `json:"sun"`
|
|
}
|
|
|
|
type Ers struct {
|
|
Heroes map[string]HeroValue `json:"heroes"`
|
|
Input []interface{} `json:"input"`
|
|
}
|
|
|
|
type ArgsResult struct {
|
|
Stars int64 `json:"stars"`
|
|
Win bool `json:"win"`
|
|
}
|
|
|
|
type Headers struct {
|
|
ContentType string `json:"Content-Type"`
|
|
XAuthApplicationID string `json:"X-Auth-Application-Id"`
|
|
XAuthNetworkIdent string `json:"X-Auth-Network-Ident"`
|
|
XAuthPlayerID string `json:"X-Auth-Player-Id"`
|
|
XAuthSessionID string `json:"X-Auth-Session-Id"`
|
|
XAuthSessionKey string `json:"X-Auth-Session-Key"`
|
|
XAuthSignature string `json:"X-Auth-Signature"`
|
|
XAuthToken string `json:"X-Auth-Token"`
|
|
XAuthUserID string `json:"X-Auth-User-Id"`
|
|
XEnvLibraryVersion string `json:"X-Env-Library-Version"`
|
|
XRequestID string `json:"X-Request-Id"`
|
|
XRequestedWith string `json:"X-Requested-With"`
|
|
XServerTime string `json:"X-Server-Time"`
|
|
}
|
|
|
|
type QtmodelResponse struct {
|
|
Ident string `json:"ident"`
|
|
Result ResponseResult `json:"result"`
|
|
}
|
|
|
|
type ResponseResult struct {
|
|
Quests []Quest `json:"quests"`
|
|
Response *ResultResponse `json:"response"`
|
|
}
|
|
|
|
type Quest struct {
|
|
ID int64 `json:"id"`
|
|
Progress int64 `json:"progress"`
|
|
Reward QuestReward `json:"reward"`
|
|
State int64 `json:"state"`
|
|
}
|
|
|
|
type QuestReward struct {
|
|
Avatar *Avatar `json:"avatar,omitempty"`
|
|
Coin map[string]*League `json:"coin,omitempty"`
|
|
Consumable *RewardConsumable `json:"consumable,omitempty"`
|
|
Gold *int64 `json:"gold,omitempty"`
|
|
}
|
|
|
|
type Consumable map[string]int64
|
|
|
|
type Avatar struct {
|
|
Consumable
|
|
}
|
|
type RewardConsumable struct {
|
|
Consumable
|
|
}
|
|
|
|
//type Avatar struct {
|
|
// The634 int64 `json:"634"`
|
|
//}
|
|
//
|
|
//type RewardConsumable struct {
|
|
// The56 string `json:"56"`
|
|
//}
|
|
|
|
type ResultResponse struct {
|
|
ArePointsMax *bool `json:"arePointsMax,omitempty"`
|
|
Attack []Attack `json:"attack"`
|
|
AvgLevel *string `json:"avgLevel,omitempty"`
|
|
Battle *PurpleBattle `json:"battle,omitempty"`
|
|
Battles []BattleElement `json:"battles"`
|
|
ClanTries map[string]int64 `json:"clanTries,omitempty"`
|
|
Day *string `json:"day,omitempty"`
|
|
Defence []Attack `json:"defence"`
|
|
EndTime *int64 `json:"endTime,omitempty"`
|
|
Enemies []Enemy `json:"enemies"`
|
|
EnemyClan *EnemyClan `json:"enemyClan,omitempty"`
|
|
EnemyClanMembers map[string]EnemyClanMember `json:"enemyClanMembers,omitempty"`
|
|
EnemyClanPoints *int64 `json:"enemyClanPoints,omitempty"`
|
|
EnemyClanTries map[string]int64 `json:"enemyClanTries,omitempty"`
|
|
EnemyID *string `json:"enemyId,omitempty"`
|
|
EnemyPoints *string `json:"enemyPoints,omitempty"`
|
|
EnemySlots map[string]EnemySlot `json:"enemySlots,omitempty"`
|
|
FortificationVictoryPoints *int64 `json:"fortificationVictoryPoints,omitempty"`
|
|
League *League `json:"league"`
|
|
MyTries *int64 `json:"myTries,omitempty"`
|
|
NextLockTime *int64 `json:"nextLockTime,omitempty"`
|
|
NextWarTime *int64 `json:"nextWarTime,omitempty"`
|
|
OurClanPoints *int64 `json:"ourClanPoints,omitempty"`
|
|
OurSlots map[string]OurSlot `json:"ourSlots,omitempty"`
|
|
Points *string `json:"points,omitempty"`
|
|
Replay *PurpleReplay `json:"replay,omitempty"`
|
|
Replays []ReplayElement `json:"replays"`
|
|
Reward *ResponseReward `json:"reward"`
|
|
Season *string `json:"season,omitempty"`
|
|
Slot *Slot `json:"slot,omitempty"`
|
|
SlotVictoryPoints *int64 `json:"slotVictoryPoints,omitempty"`
|
|
Slots map[string]int64 `json:"slots,omitempty"`
|
|
State *State `json:"state,omitempty"`
|
|
Teams map[string]ResponseTeam `json:"teams,omitempty"`
|
|
Users *Users `json:"users,omitempty"`
|
|
Warriors map[string]int64 `json:"warriors,omitempty"`
|
|
Win *bool `json:"win,omitempty"`
|
|
}
|
|
|
|
type Attack struct {
|
|
AttackerID string `json:"attackerId"`
|
|
DefenderID string `json:"defenderId"`
|
|
FortificationPoints int64 `json:"fortificationPoints"`
|
|
PreviousStatus string `json:"previousStatus"`
|
|
ReplayID string `json:"replayId"`
|
|
SlotID string `json:"slotId"`
|
|
SlotPoints int64 `json:"slotPoints"`
|
|
Time int64 `json:"time"`
|
|
Win bool `json:"win"`
|
|
}
|
|
|
|
type PurpleBattle struct {
|
|
Attackers map[string]PurpleAttacker `json:"attackers"`
|
|
Defenders []map[string]PurpleDefender `json:"defenders"`
|
|
Effects []interface{} `json:"effects"`
|
|
Reward []interface{} `json:"reward"`
|
|
Seed int64 `json:"seed"`
|
|
StartTime int64 `json:"startTime"`
|
|
Type string `json:"type"`
|
|
TypeID string `json:"typeId"`
|
|
UserID string `json:"userId"`
|
|
}
|
|
|
|
type PurpleAttacker struct {
|
|
Agility *int64 `json:"agility,omitempty"`
|
|
Anticrit *int64 `json:"anticrit,omitempty"`
|
|
Antidodge *int64 `json:"antidodge,omitempty"`
|
|
Armor *int64 `json:"armor,omitempty"`
|
|
ArmorPenetration *int64 `json:"armorPenetration,omitempty"`
|
|
Artifacts []Artifact `json:"artifacts"`
|
|
Color *int64 `json:"color,omitempty"`
|
|
CurrentSkin *int64 `json:"currentSkin,omitempty"`
|
|
Element *string `json:"element,omitempty"`
|
|
ElementArmor *float64 `json:"elementArmor,omitempty"`
|
|
ElementAttack *float64 `json:"elementAttack,omitempty"`
|
|
ElementSpiritLevel *int64 `json:"elementSpiritLevel,omitempty"`
|
|
ElementSpiritPower *float64 `json:"elementSpiritPower,omitempty"`
|
|
ElementSpiritStar *int64 `json:"elementSpiritStar,omitempty"`
|
|
FavorPetID *int64 `json:"favorPetId,omitempty"`
|
|
FavorPower *int64 `json:"favorPower,omitempty"`
|
|
HP *float64 `json:"hp,omitempty"`
|
|
ID int64 `json:"id"`
|
|
Intelligence *int64 `json:"intelligence,omitempty"`
|
|
Level int64 `json:"level"`
|
|
Lifesteal *int64 `json:"lifesteal,omitempty"`
|
|
MagicPenetration *float64 `json:"magicPenetration,omitempty"`
|
|
MagicPower *float64 `json:"magicPower,omitempty"`
|
|
MagicResist *int64 `json:"magicResist,omitempty"`
|
|
Name interface{} `json:"name"`
|
|
Perks []int64 `json:"perks"`
|
|
PetID *int64 `json:"petId,omitempty"`
|
|
PhysicalAttack *float64 `json:"physicalAttack,omitempty"`
|
|
PhysicalCritChance *int64 `json:"physicalCritChance,omitempty"`
|
|
Power int64 `json:"power"`
|
|
Runes []int64 `json:"runes"`
|
|
Scale *float64 `json:"scale,omitempty"`
|
|
Skills map[string]int64 `json:"skills"`
|
|
Skin *int64 `json:"skin,omitempty"`
|
|
Skins map[string]int64 `json:"skins,omitempty"`
|
|
Slots *SkinsUnion `json:"slots"`
|
|
Star int64 `json:"star"`
|
|
Strength *int64 `json:"strength,omitempty"`
|
|
TitanCoinsSpent *TitanCoinsSpent `json:"titanCoinsSpent,omitempty"`
|
|
TitanGiftLevel *int64 `json:"titanGiftLevel,omitempty"`
|
|
Type string `json:"type"`
|
|
XP int64 `json:"xp"`
|
|
}
|
|
|
|
type Artifact struct {
|
|
Level int64 `json:"level"`
|
|
Star int64 `json:"star"`
|
|
}
|
|
|
|
type TitanCoinsSpent struct {
|
|
Consumable Consumable `json:"consumable"`
|
|
}
|
|
|
|
type PurpleDefender struct {
|
|
Agility *int64 `json:"agility,omitempty"`
|
|
Anticrit *int64 `json:"anticrit,omitempty"`
|
|
Antidodge *int64 `json:"antidodge,omitempty"`
|
|
Armor *float64 `json:"armor,omitempty"`
|
|
ArmorPenetration *float64 `json:"armorPenetration,omitempty"`
|
|
Artifacts []Artifact `json:"artifacts"`
|
|
Color *int64 `json:"color,omitempty"`
|
|
CurrentSkin *int64 `json:"currentSkin,omitempty"`
|
|
Dodge *float64 `json:"dodge,omitempty"`
|
|
Element *string `json:"element,omitempty"`
|
|
ElementArmor *float64 `json:"elementArmor,omitempty"`
|
|
ElementAttack *float64 `json:"elementAttack,omitempty"`
|
|
ElementSpiritLevel *int64 `json:"elementSpiritLevel,omitempty"`
|
|
ElementSpiritPower *float64 `json:"elementSpiritPower,omitempty"`
|
|
ElementSpiritStar *int64 `json:"elementSpiritStar,omitempty"`
|
|
FavorPetID *int64 `json:"favorPetId,omitempty"`
|
|
FavorPower *int64 `json:"favorPower,omitempty"`
|
|
HP *float64 `json:"hp,omitempty"`
|
|
ID int64 `json:"id"`
|
|
Intelligence *float64 `json:"intelligence,omitempty"`
|
|
Level int64 `json:"level"`
|
|
Lifesteal *int64 `json:"lifesteal,omitempty"`
|
|
MagicPenetration *float64 `json:"magicPenetration,omitempty"`
|
|
MagicPower *float64 `json:"magicPower,omitempty"`
|
|
MagicResist *float64 `json:"magicResist,omitempty"`
|
|
Name interface{} `json:"name"`
|
|
Perks []int64 `json:"perks"`
|
|
PetID *int64 `json:"petId,omitempty"`
|
|
PhysicalAttack *float64 `json:"physicalAttack,omitempty"`
|
|
Power int64 `json:"power"`
|
|
Runes []int64 `json:"runes"`
|
|
Scale *float64 `json:"scale,omitempty"`
|
|
Skills map[string]int64 `json:"skills"`
|
|
Skin *int64 `json:"skin,omitempty"`
|
|
Skins *SkinsUnion `json:"skins"`
|
|
Slots *PurpleSlots `json:"slots"`
|
|
Star int64 `json:"star"`
|
|
State HeroValue `json:"state"`
|
|
Strength *float64 `json:"strength,omitempty"`
|
|
TitanCoinsSpent *TitanCoinsSpent `json:"titanCoinsSpent,omitempty"`
|
|
TitanGiftLevel *int64 `json:"titanGiftLevel,omitempty"`
|
|
Type string `json:"type"`
|
|
XP int64 `json:"xp"`
|
|
}
|
|
|
|
type BattleElement struct {
|
|
Attackers map[string]FluffyAttacker `json:"attackers"`
|
|
Defenders []map[string]FluffyDefender `json:"defenders"`
|
|
Effects []interface{} `json:"effects"`
|
|
EndTime int64 `json:"endTime"`
|
|
ID string `json:"id"`
|
|
Progress []interface{} `json:"progress"`
|
|
Result BattleResult `json:"result"`
|
|
Reward []interface{} `json:"reward"`
|
|
Seed int64 `json:"seed"`
|
|
StartTime int64 `json:"startTime"`
|
|
Type string `json:"type"`
|
|
TypeID string `json:"typeId"`
|
|
UserID string `json:"userId"`
|
|
}
|
|
|
|
type FluffyAttacker struct {
|
|
Agility *float64 `json:"agility,omitempty"`
|
|
Armor *float64 `json:"armor,omitempty"`
|
|
ArmorPenetration *float64 `json:"armorPenetration,omitempty"`
|
|
Artifacts []Artifact `json:"artifacts"`
|
|
Color int64 `json:"color"`
|
|
CurrentSkin *int64 `json:"currentSkin,omitempty"`
|
|
Dodge *float64 `json:"dodge,omitempty"`
|
|
FavorPetID *int64 `json:"favorPetId,omitempty"`
|
|
FavorPower *int64 `json:"favorPower,omitempty"`
|
|
HP *float64 `json:"hp,omitempty"`
|
|
ID int64 `json:"id"`
|
|
Intelligence float64 `json:"intelligence"`
|
|
Level int64 `json:"level"`
|
|
Lifesteal *int64 `json:"lifesteal,omitempty"`
|
|
MagicPenetration *float64 `json:"magicPenetration,omitempty"`
|
|
MagicPower *float64 `json:"magicPower,omitempty"`
|
|
MagicResist *float64 `json:"magicResist,omitempty"`
|
|
Name interface{} `json:"name"`
|
|
Perks []int64 `json:"perks"`
|
|
PetID *int64 `json:"petId,omitempty"`
|
|
PhysicalAttack *float64 `json:"physicalAttack,omitempty"`
|
|
PhysicalCritChance *int64 `json:"physicalCritChance,omitempty"`
|
|
Power int64 `json:"power"`
|
|
Runes []int64 `json:"runes"`
|
|
Scale *int64 `json:"scale,omitempty"`
|
|
Skills map[string]int64 `json:"skills"`
|
|
Skin *int64 `json:"skin,omitempty"`
|
|
Skins map[string]int64 `json:"skins,omitempty"`
|
|
Slots *PurpleSlots `json:"slots"`
|
|
Star int64 `json:"star"`
|
|
Strength int64 `json:"strength"`
|
|
TitanCoinsSpent *TitanCoinsSpent `json:"titanCoinsSpent"`
|
|
TitanGiftLevel *int64 `json:"titanGiftLevel,omitempty"`
|
|
Type string `json:"type"`
|
|
XP int64 `json:"xp"`
|
|
}
|
|
|
|
type FluffyDefender struct {
|
|
Agility *float64 `json:"agility,omitempty"`
|
|
Armor *float64 `json:"armor,omitempty"`
|
|
ArmorPenetration *float64 `json:"armorPenetration,omitempty"`
|
|
Artifacts []Artifact `json:"artifacts"`
|
|
Color int64 `json:"color"`
|
|
CurrentSkin *int64 `json:"currentSkin,omitempty"`
|
|
Dodge *float64 `json:"dodge,omitempty"`
|
|
FavorPetID *int64 `json:"favorPetId,omitempty"`
|
|
FavorPower *int64 `json:"favorPower,omitempty"`
|
|
HP *float64 `json:"hp,omitempty"`
|
|
ID int64 `json:"id"`
|
|
Intelligence float64 `json:"intelligence"`
|
|
Level int64 `json:"level"`
|
|
Lifesteal *int64 `json:"lifesteal,omitempty"`
|
|
MagicPenetration *float64 `json:"magicPenetration,omitempty"`
|
|
MagicPower *float64 `json:"magicPower,omitempty"`
|
|
MagicResist *float64 `json:"magicResist,omitempty"`
|
|
Name interface{} `json:"name"`
|
|
Perks []int64 `json:"perks"`
|
|
PetID *int64 `json:"petId,omitempty"`
|
|
PhysicalAttack *float64 `json:"physicalAttack,omitempty"`
|
|
PhysicalCritChance *float64 `json:"physicalCritChance,omitempty"`
|
|
Power int64 `json:"power"`
|
|
Runes []int64 `json:"runes"`
|
|
Scale *int64 `json:"scale,omitempty"`
|
|
Skills map[string]int64 `json:"skills"`
|
|
Skin *int64 `json:"skin,omitempty"`
|
|
Skins map[string]int64 `json:"skins,omitempty"`
|
|
Slots *PurpleSlots `json:"slots"`
|
|
Star int64 `json:"star"`
|
|
State *HeroValue `json:"state,omitempty"`
|
|
Strength float64 `json:"strength"`
|
|
TitanCoinsSpent *TitanCoinsSpent `json:"titanCoinsSpent"`
|
|
TitanGiftLevel *int64 `json:"titanGiftLevel,omitempty"`
|
|
Type string `json:"type"`
|
|
XP int64 `json:"xp"`
|
|
}
|
|
|
|
type BattleResult struct {
|
|
BattleOrder *int64 `json:"battleOrder,omitempty"`
|
|
EnemyPlace *string `json:"enemyPlace,omitempty"`
|
|
NewPlace *string `json:"newPlace,omitempty"`
|
|
OldPlace *string `json:"oldPlace,omitempty"`
|
|
ServerVersion int64 `json:"serverVersion"`
|
|
Stars int64 `json:"stars"`
|
|
Win bool `json:"win"`
|
|
}
|
|
|
|
type Enemy struct {
|
|
Heroes []EnemyHero `json:"heroes"`
|
|
Place string `json:"place"`
|
|
Power string `json:"power"`
|
|
User EnemyClanMember `json:"user"`
|
|
UserID string `json:"userId"`
|
|
}
|
|
|
|
type ArenaHero struct {
|
|
Color *int64 `json:"color,omitempty"`
|
|
ID int64 `json:"id"`
|
|
Level int64 `json:"level"`
|
|
Power *int64 `json:"power,omitempty"`
|
|
Star int64 `json:"star"`
|
|
Type *string `json:"type,omitempty"`
|
|
}
|
|
|
|
type EnemyClanMember struct {
|
|
AllowPm string `json:"allowPm"`
|
|
AvatarID string `json:"avatarId"`
|
|
Experience *int64 `json:"experience,omitempty"`
|
|
ClanID *string `json:"clanId"`
|
|
ClanIcon *Icon `json:"clanIcon,omitempty"`
|
|
ClanRole *string `json:"clanRole"`
|
|
ClanTitle *string `json:"clanTitle,omitempty"`
|
|
FrameID *int64 `json:"frameId"`
|
|
ID string `json:"id"`
|
|
IsChatModerator bool `json:"isChatModerator"`
|
|
LastLoginTime string `json:"lastLoginTime"`
|
|
LeagueID *int64 `json:"leagueId"`
|
|
Level string `json:"level"`
|
|
Name string `json:"name"`
|
|
ServerID string `json:"serverId"`
|
|
}
|
|
|
|
type Icon struct {
|
|
FlagColor1 int64 `json:"flagColor1"`
|
|
FlagColor2 int64 `json:"flagColor2"`
|
|
FlagShape int64 `json:"flagShape"`
|
|
IconColor int64 `json:"iconColor"`
|
|
IconShape int64 `json:"iconShape"`
|
|
}
|
|
|
|
type EnemyClan struct {
|
|
Country string `json:"country"`
|
|
Description string `json:"description"`
|
|
Disbanding bool `json:"disbanding"`
|
|
FrameID int64 `json:"frameId"`
|
|
ID string `json:"id"`
|
|
Icon Icon `json:"icon"`
|
|
Level string `json:"level"`
|
|
MembersCount string `json:"membersCount"`
|
|
MinLevel string `json:"minLevel"`
|
|
OwnerID string `json:"ownerId"`
|
|
RoleNames []interface{} `json:"roleNames"`
|
|
ServerID string `json:"serverId"`
|
|
Title string `json:"title"`
|
|
TopActivity string `json:"topActivity"`
|
|
TopDungeon string `json:"topDungeon"`
|
|
}
|
|
|
|
type EnemySlot struct {
|
|
AttackerID *League `json:"attackerId"`
|
|
PointsFarmed int64 `json:"pointsFarmed"`
|
|
SlotID int64 `json:"slotId"`
|
|
Status string `json:"status"`
|
|
TargetMarkingUserID *int64 `json:"targetMarkingUserId,omitempty"`
|
|
Team []map[string]EnemySlotTeam `json:"team"`
|
|
TotalPoints int64 `json:"totalPoints"`
|
|
User EnemyClanMember `json:"user"`
|
|
}
|
|
|
|
type EnemySlotTeam struct {
|
|
Color *int64 `json:"color,omitempty"`
|
|
ID int64 `json:"id"`
|
|
Level int64 `json:"level"`
|
|
Power int64 `json:"power"`
|
|
Star int64 `json:"star"`
|
|
State HeroValue `json:"state"`
|
|
Type string `json:"type"`
|
|
}
|
|
|
|
type OurSlot struct {
|
|
AttackerID int64 `json:"attackerId"`
|
|
PointsFarmed int64 `json:"pointsFarmed"`
|
|
SlotID int64 `json:"slotId"`
|
|
Status string `json:"status"`
|
|
TargetMarkingUserID *int64 `json:"targetMarkingUserId,omitempty"`
|
|
Team []map[string]EnemySlotTeam `json:"team"`
|
|
TotalPoints int64 `json:"totalPoints"`
|
|
User EnemyClanMember `json:"user"`
|
|
}
|
|
|
|
type PurpleReplay struct {
|
|
Attackers map[string]TentacledAttacker `json:"attackers"`
|
|
Defenders []map[string]TentacledDefender `json:"defenders"`
|
|
Effects *EffectsUnion `json:"effects"`
|
|
EndTime string `json:"endTime"`
|
|
ID string `json:"id"`
|
|
Progress *ProgressUnion `json:"progress"`
|
|
Result PurpleResult `json:"result"`
|
|
Reward []interface{} `json:"reward"`
|
|
Seed string `json:"seed"`
|
|
StartTime string `json:"startTime"`
|
|
Type string `json:"type"`
|
|
TypeID string `json:"typeId"`
|
|
UserID string `json:"userId"`
|
|
}
|
|
|
|
type TentacledAttacker struct {
|
|
Agility *float64 `json:"agility,omitempty"`
|
|
Anticrit *int64 `json:"anticrit,omitempty"`
|
|
Antidodge *int64 `json:"antidodge,omitempty"`
|
|
Armor *float64 `json:"armor,omitempty"`
|
|
ArmorPenetration *float64 `json:"armorPenetration,omitempty"`
|
|
Artifacts []Artifact `json:"artifacts"`
|
|
Color *int64 `json:"color,omitempty"`
|
|
CurrentSkin *int64 `json:"currentSkin,omitempty"`
|
|
Dodge *float64 `json:"dodge,omitempty"`
|
|
Element *string `json:"element,omitempty"`
|
|
ElementArmor *float64 `json:"elementArmor,omitempty"`
|
|
ElementAttack *float64 `json:"elementAttack,omitempty"`
|
|
ElementSpiritLevel *League `json:"elementSpiritLevel"`
|
|
ElementSpiritPower *float64 `json:"elementSpiritPower,omitempty"`
|
|
ElementSpiritStar *League `json:"elementSpiritStar"`
|
|
FavorPetID *int64 `json:"favorPetId,omitempty"`
|
|
FavorPower *int64 `json:"favorPower,omitempty"`
|
|
HP *float64 `json:"hp,omitempty"`
|
|
ID *League `json:"id"`
|
|
Intelligence *float64 `json:"intelligence,omitempty"`
|
|
Level int64 `json:"level"`
|
|
Lifesteal *int64 `json:"lifesteal,omitempty"`
|
|
MagicPenetration *float64 `json:"magicPenetration,omitempty"`
|
|
MagicPower *float64 `json:"magicPower,omitempty"`
|
|
MagicResist *float64 `json:"magicResist,omitempty"`
|
|
Name interface{} `json:"name"`
|
|
Perks []int64 `json:"perks"`
|
|
PetID *int64 `json:"petId,omitempty"`
|
|
PhysicalAttack *float64 `json:"physicalAttack,omitempty"`
|
|
PhysicalCritChance *float64 `json:"physicalCritChance,omitempty"`
|
|
Power int64 `json:"power"`
|
|
Runes []int64 `json:"runes"`
|
|
Scale *float64 `json:"scale,omitempty"`
|
|
Skills map[string]int64 `json:"skills"`
|
|
Skin *int64 `json:"skin,omitempty"`
|
|
Skins *SkinsUnion `json:"skins"`
|
|
Slots *PurpleSlots `json:"slots"`
|
|
Star *League `json:"star"`
|
|
Strength *float64 `json:"strength,omitempty"`
|
|
TitanCoinsSpent *TitanCoinsSpent `json:"titanCoinsSpent"`
|
|
TitanGiftLevel *int64 `json:"titanGiftLevel,omitempty"`
|
|
Type string `json:"type"`
|
|
XP int64 `json:"xp"`
|
|
}
|
|
|
|
type TentacledDefender struct {
|
|
Agility *int64 `json:"agility,omitempty"`
|
|
Anticrit *int64 `json:"anticrit,omitempty"`
|
|
Antidodge *int64 `json:"antidodge,omitempty"`
|
|
Armor *float64 `json:"armor,omitempty"`
|
|
ArmorPenetration *float64 `json:"armorPenetration,omitempty"`
|
|
Artifacts []Artifact `json:"artifacts"`
|
|
Color *int64 `json:"color,omitempty"`
|
|
CurrentSkin *int64 `json:"currentSkin,omitempty"`
|
|
Dodge *float64 `json:"dodge,omitempty"`
|
|
Element *string `json:"element,omitempty"`
|
|
ElementArmor *float64 `json:"elementArmor,omitempty"`
|
|
ElementAttack *float64 `json:"elementAttack,omitempty"`
|
|
ElementSpiritLevel *int64 `json:"elementSpiritLevel,omitempty"`
|
|
ElementSpiritPower *float64 `json:"elementSpiritPower,omitempty"`
|
|
ElementSpiritStar *int64 `json:"elementSpiritStar,omitempty"`
|
|
FavorPetID *int64 `json:"favorPetId,omitempty"`
|
|
FavorPower *int64 `json:"favorPower,omitempty"`
|
|
HP *float64 `json:"hp,omitempty"`
|
|
ID int64 `json:"id"`
|
|
Intelligence *int64 `json:"intelligence,omitempty"`
|
|
Level int64 `json:"level"`
|
|
Lifesteal *int64 `json:"lifesteal,omitempty"`
|
|
MagicPenetration *float64 `json:"magicPenetration,omitempty"`
|
|
MagicPower *float64 `json:"magicPower,omitempty"`
|
|
MagicResist *float64 `json:"magicResist,omitempty"`
|
|
Name interface{} `json:"name"`
|
|
Perks []int64 `json:"perks"`
|
|
PetID *int64 `json:"petId,omitempty"`
|
|
PhysicalAttack *float64 `json:"physicalAttack,omitempty"`
|
|
PhysicalCritChance *int64 `json:"physicalCritChance,omitempty"`
|
|
Power int64 `json:"power"`
|
|
Runes []int64 `json:"runes"`
|
|
Scale *float64 `json:"scale,omitempty"`
|
|
Skills map[string]int64 `json:"skills"`
|
|
Skin *int64 `json:"skin,omitempty"`
|
|
Skins *SkinsUnion `json:"skins"`
|
|
Slots *PurpleSlots `json:"slots"`
|
|
Star int64 `json:"star"`
|
|
State *HeroValue `json:"state,omitempty"`
|
|
Strength *float64 `json:"strength,omitempty"`
|
|
TitanCoinsSpent *TitanCoinsSpent `json:"titanCoinsSpent"`
|
|
TitanGiftLevel *int64 `json:"titanGiftLevel,omitempty"`
|
|
Type string `json:"type"`
|
|
XP int64 `json:"xp"`
|
|
}
|
|
|
|
type EffectsClass struct {
|
|
Attackers EffectsAttackers `json:"attackers"`
|
|
Defenders EffectsDefenders `json:"defenders"`
|
|
}
|
|
|
|
type EffectsAttackers struct {
|
|
PercentBuffAllHealing int64 `json:"percentBuffAll_healing"`
|
|
PercentBuffByPerkCastSpeed10 int64 `json:"percentBuffByPerk_castSpeed_10"`
|
|
PercentBuffByPerkEnergyIncrease7 int64 `json:"percentBuffByPerk_energyIncrease_7"`
|
|
PercentIncomeDamageReducePhysical int64 `json:"percentIncomeDamageReduce_physical"`
|
|
}
|
|
|
|
type EffectsDefenders struct {
|
|
PercentBuffByPerkCastSpeed10 int64 `json:"percentBuffByPerk_castSpeed_10"`
|
|
PercentBuffByPerkEnergyIncrease7 int64 `json:"percentBuffByPerk_energyIncrease_7"`
|
|
}
|
|
|
|
type ReplayProgressClass struct {
|
|
Attackers FluffyAttackers `json:"attackers"`
|
|
B int64 `json:"b"`
|
|
Defenders PurpleDefenders `json:"defenders"`
|
|
Seed int64 `json:"seed"`
|
|
V int64 `json:"v"`
|
|
}
|
|
|
|
type FluffyAttackers struct {
|
|
Heroes *Heroes `json:"heroes"`
|
|
Input []Input `json:"input"`
|
|
}
|
|
|
|
type PurpleDefenders struct {
|
|
Heroes *Heroes `json:"heroes"`
|
|
Input []interface{} `json:"input"`
|
|
}
|
|
|
|
type PurpleProgress struct {
|
|
Attackers Ers `json:"attackers"`
|
|
B int64 `json:"b"`
|
|
Defenders FluffyDefenders `json:"defenders"`
|
|
Seed int64 `json:"seed"`
|
|
V int64 `json:"v"`
|
|
}
|
|
|
|
type FluffyDefenders struct {
|
|
Heroes []interface{} `json:"heroes"`
|
|
Input []interface{} `json:"input"`
|
|
}
|
|
|
|
type PurpleResult struct {
|
|
BattleOrder *int64 `json:"battleOrder,omitempty"`
|
|
EnemyPlace *string `json:"enemyPlace,omitempty"`
|
|
NewPlace *string `json:"newPlace,omitempty"`
|
|
OldPlace *string `json:"oldPlace,omitempty"`
|
|
ScoreAttack *int64 `json:"scoreAttack,omitempty"`
|
|
ScoreDefence *int64 `json:"scoreDefence,omitempty"`
|
|
ServerVersion int64 `json:"serverVersion"`
|
|
Stars *int64 `json:"stars,omitempty"`
|
|
Tier *string `json:"tier,omitempty"`
|
|
Win *bool `json:"win,omitempty"`
|
|
}
|
|
|
|
type ReplayElement struct {
|
|
Attackers map[string]StickyAttacker `json:"attackers"`
|
|
Defenders []map[string]StickyDefender `json:"defenders"`
|
|
Effects []interface{} `json:"effects"`
|
|
EndTime string `json:"endTime"`
|
|
ID string `json:"id"`
|
|
Progress []ReplayProgressClass `json:"progress"`
|
|
Result FluffyResult `json:"result"`
|
|
Reward []interface{} `json:"reward"`
|
|
Seed string `json:"seed"`
|
|
StartTime string `json:"startTime"`
|
|
Type string `json:"type"`
|
|
TypeID string `json:"typeId"`
|
|
UserID string `json:"userId"`
|
|
}
|
|
|
|
type StickyAttacker struct {
|
|
Agility *float64 `json:"agility,omitempty"`
|
|
Anticrit *int64 `json:"anticrit,omitempty"`
|
|
Antidodge *int64 `json:"antidodge,omitempty"`
|
|
Armor *float64 `json:"armor,omitempty"`
|
|
ArmorPenetration *float64 `json:"armorPenetration,omitempty"`
|
|
Artifacts []Artifact `json:"artifacts"`
|
|
Color *int64 `json:"color,omitempty"`
|
|
CurrentSkin *int64 `json:"currentSkin,omitempty"`
|
|
Dodge *float64 `json:"dodge,omitempty"`
|
|
Element *string `json:"element,omitempty"`
|
|
ElementArmor *float64 `json:"elementArmor,omitempty"`
|
|
ElementAttack *float64 `json:"elementAttack,omitempty"`
|
|
ElementSpiritLevel *int64 `json:"elementSpiritLevel,omitempty"`
|
|
ElementSpiritPower *float64 `json:"elementSpiritPower,omitempty"`
|
|
ElementSpiritStar *int64 `json:"elementSpiritStar,omitempty"`
|
|
FavorPetID *int64 `json:"favorPetId,omitempty"`
|
|
FavorPower *int64 `json:"favorPower,omitempty"`
|
|
HP *float64 `json:"hp,omitempty"`
|
|
ID int64 `json:"id"`
|
|
Intelligence *float64 `json:"intelligence,omitempty"`
|
|
Level int64 `json:"level"`
|
|
Lifesteal *int64 `json:"lifesteal,omitempty"`
|
|
MagicPenetration *float64 `json:"magicPenetration,omitempty"`
|
|
MagicPower *float64 `json:"magicPower,omitempty"`
|
|
MagicResist *float64 `json:"magicResist,omitempty"`
|
|
Name interface{} `json:"name"`
|
|
Perks []int64 `json:"perks"`
|
|
PetID *int64 `json:"petId,omitempty"`
|
|
PhysicalAttack *float64 `json:"physicalAttack,omitempty"`
|
|
PhysicalCritChance *float64 `json:"physicalCritChance,omitempty"`
|
|
Power int64 `json:"power"`
|
|
Runes []int64 `json:"runes"`
|
|
Scale *float64 `json:"scale,omitempty"`
|
|
Skills map[string]int64 `json:"skills"`
|
|
Skin *int64 `json:"skin,omitempty"`
|
|
Skins *SkinsUnion `json:"skins"`
|
|
Slots *PurpleSlots `json:"slots"`
|
|
Star int64 `json:"star"`
|
|
Strength *float64 `json:"strength,omitempty"`
|
|
TitanCoinsSpent *TitanCoinsSpent `json:"titanCoinsSpent"`
|
|
TitanGiftLevel *int64 `json:"titanGiftLevel,omitempty"`
|
|
Type string `json:"type"`
|
|
XP int64 `json:"xp"`
|
|
}
|
|
|
|
type StickyDefender struct {
|
|
Agility *float64 `json:"agility,omitempty"`
|
|
Anticrit *int64 `json:"anticrit,omitempty"`
|
|
Antidodge *int64 `json:"antidodge,omitempty"`
|
|
Armor *float64 `json:"armor,omitempty"`
|
|
ArmorPenetration *float64 `json:"armorPenetration,omitempty"`
|
|
Artifacts []Artifact `json:"artifacts"`
|
|
Color *int64 `json:"color,omitempty"`
|
|
CurrentSkin *int64 `json:"currentSkin,omitempty"`
|
|
Dodge *float64 `json:"dodge,omitempty"`
|
|
Element *string `json:"element,omitempty"`
|
|
ElementArmor *float64 `json:"elementArmor,omitempty"`
|
|
ElementAttack *float64 `json:"elementAttack,omitempty"`
|
|
ElementSpiritLevel *int64 `json:"elementSpiritLevel,omitempty"`
|
|
ElementSpiritPower *float64 `json:"elementSpiritPower,omitempty"`
|
|
ElementSpiritStar *int64 `json:"elementSpiritStar,omitempty"`
|
|
FavorPetID *int64 `json:"favorPetId,omitempty"`
|
|
FavorPower *int64 `json:"favorPower,omitempty"`
|
|
HP *float64 `json:"hp,omitempty"`
|
|
ID int64 `json:"id"`
|
|
Intelligence *float64 `json:"intelligence,omitempty"`
|
|
Level int64 `json:"level"`
|
|
Lifesteal *int64 `json:"lifesteal,omitempty"`
|
|
MagicPenetration *float64 `json:"magicPenetration,omitempty"`
|
|
MagicPower *float64 `json:"magicPower,omitempty"`
|
|
MagicResist *float64 `json:"magicResist,omitempty"`
|
|
Name interface{} `json:"name"`
|
|
Perks []int64 `json:"perks"`
|
|
PetID *int64 `json:"petId,omitempty"`
|
|
PhysicalAttack *float64 `json:"physicalAttack,omitempty"`
|
|
PhysicalCritChance *float64 `json:"physicalCritChance,omitempty"`
|
|
Power int64 `json:"power"`
|
|
Runes []int64 `json:"runes"`
|
|
Scale *float64 `json:"scale,omitempty"`
|
|
Skills map[string]int64 `json:"skills"`
|
|
Skin *int64 `json:"skin,omitempty"`
|
|
Skins *SkinsUnion `json:"skins"`
|
|
Slots *PurpleSlots `json:"slots"`
|
|
Star int64 `json:"star"`
|
|
State *HeroValue `json:"state,omitempty"`
|
|
Strength *float64 `json:"strength,omitempty"`
|
|
TitanCoinsSpent *TitanCoinsSpent `json:"titanCoinsSpent,omitempty"`
|
|
TitanGiftLevel *int64 `json:"titanGiftLevel,omitempty"`
|
|
Type string `json:"type"`
|
|
XP int64 `json:"xp"`
|
|
}
|
|
|
|
type FluffyResult struct {
|
|
ServerVersion int64 `json:"serverVersion"`
|
|
Stars int64 `json:"stars"`
|
|
Win bool `json:"win"`
|
|
}
|
|
|
|
type ResponseReward struct {
|
|
Coin Coin `json:"coin"`
|
|
}
|
|
|
|
type Coin struct {
|
|
The1 int64 `json:"1"`
|
|
}
|
|
|
|
type Slot struct {
|
|
AttackerID int64 `json:"attackerId"`
|
|
PointsFarmed int64 `json:"pointsFarmed"`
|
|
SlotID string `json:"slotId"`
|
|
Status string `json:"status"`
|
|
Team []map[string]EnemySlotTeam `json:"team"`
|
|
TotalPoints int64 `json:"totalPoints"`
|
|
User EnemyClanMember `json:"user"`
|
|
}
|
|
|
|
type State struct {
|
|
ArenaHeroes []ArenaHero `json:"arenaHeroes"`
|
|
ArenaPlace string `json:"arenaPlace"`
|
|
ArenaPower string `json:"arenaPower"`
|
|
Battles int64 `json:"battles"`
|
|
GrandCoin float64 `json:"grandCoin"`
|
|
GrandCoinTime int64 `json:"grandCoinTime"`
|
|
GrandHeroes [][]ArenaHero `json:"grandHeroes"`
|
|
GrandPlace string `json:"grandPlace"`
|
|
GrandPower string `json:"grandPower"`
|
|
RewardFlag int64 `json:"rewardFlag"`
|
|
RewardTime int64 `json:"rewardTime"`
|
|
UserID string `json:"userId"`
|
|
WINS int64 `json:"wins"`
|
|
}
|
|
|
|
type ResponseTeam struct {
|
|
ClanDefenceHeroes ClanDefence `json:"clanDefence_heroes"`
|
|
ClanDefenceTitans ClanDefence `json:"clanDefence_titans"`
|
|
UserID int64 `json:"userId"`
|
|
}
|
|
|
|
type ClanDefence struct {
|
|
Units map[string]ArenaHero `json:"units"`
|
|
}
|
|
|
|
type Users map[string]*EnemyClanMember
|
|
|
|
type ArgsHero struct {
|
|
Integer *int64
|
|
IntegerArray []int64
|
|
}
|
|
|
|
func (x *ArgsHero) UnmarshalJSON(data []byte) error {
|
|
x.IntegerArray = nil
|
|
object, err := unmarshalUnion(data, &x.Integer, nil, nil, nil, true, &x.IntegerArray, false, nil, false, nil, false, nil, false)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if object {
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *ArgsHero) MarshalJSON() ([]byte, error) {
|
|
return marshalUnion(x.Integer, nil, nil, nil, x.IntegerArray != nil, x.IntegerArray, false, nil, false, nil, false, nil, false)
|
|
}
|
|
|
|
type Input struct {
|
|
Double *float64
|
|
String *string
|
|
}
|
|
|
|
func (x *Input) UnmarshalJSON(data []byte) error {
|
|
object, err := unmarshalUnion(data, nil, &x.Double, nil, &x.String, false, nil, false, nil, false, nil, false, nil, false)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if object {
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *Input) MarshalJSON() ([]byte, error) {
|
|
return marshalUnion(nil, x.Double, nil, x.String, false, nil, false, nil, false, nil, false, nil, false)
|
|
}
|
|
|
|
type League struct {
|
|
Integer *int64
|
|
String *string
|
|
}
|
|
|
|
func (x *League) UnmarshalJSON(data []byte) error {
|
|
object, err := unmarshalUnion(data, &x.Integer, nil, nil, &x.String, false, nil, false, nil, false, nil, false, nil, false)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if object {
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *League) MarshalJSON() ([]byte, error) {
|
|
return marshalUnion(x.Integer, nil, nil, x.String, false, nil, false, nil, false, nil, false, nil, false)
|
|
}
|
|
|
|
type SkinsUnion struct {
|
|
AnythingArray []interface{}
|
|
IntegerMap map[string]int64
|
|
}
|
|
|
|
func (x *SkinsUnion) UnmarshalJSON(data []byte) error {
|
|
x.AnythingArray = nil
|
|
x.IntegerMap = nil
|
|
object, err := unmarshalUnion(data, nil, nil, nil, nil, true, &x.AnythingArray, false, nil, true, &x.IntegerMap, false, nil, false)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if object {
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *SkinsUnion) MarshalJSON() ([]byte, error) {
|
|
return marshalUnion(nil, nil, nil, nil, x.AnythingArray != nil, x.AnythingArray, false, nil, x.IntegerMap != nil, x.IntegerMap, false, nil, false)
|
|
}
|
|
|
|
type PurpleSlots struct {
|
|
IntegerArray []int64
|
|
IntegerMap map[string]int64
|
|
}
|
|
|
|
func (x *PurpleSlots) UnmarshalJSON(data []byte) error {
|
|
x.IntegerArray = nil
|
|
x.IntegerMap = nil
|
|
object, err := unmarshalUnion(data, nil, nil, nil, nil, true, &x.IntegerArray, false, nil, true, &x.IntegerMap, false, nil, false)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if object {
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *PurpleSlots) MarshalJSON() ([]byte, error) {
|
|
return marshalUnion(nil, nil, nil, nil, x.IntegerArray != nil, x.IntegerArray, false, nil, x.IntegerMap != nil, x.IntegerMap, false, nil, false)
|
|
}
|
|
|
|
type EnemyHero struct {
|
|
ArenaHero *ArenaHero
|
|
ArenaHeroArray []ArenaHero
|
|
}
|
|
|
|
func (x *EnemyHero) UnmarshalJSON(data []byte) error {
|
|
x.ArenaHeroArray = nil
|
|
x.ArenaHero = nil
|
|
var c ArenaHero
|
|
object, err := unmarshalUnion(data, nil, nil, nil, nil, true, &x.ArenaHeroArray, true, &c, false, nil, false, nil, false)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if object {
|
|
x.ArenaHero = &c
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *EnemyHero) MarshalJSON() ([]byte, error) {
|
|
return marshalUnion(nil, nil, nil, nil, x.ArenaHeroArray != nil, x.ArenaHeroArray, x.ArenaHero != nil, x.ArenaHero, false, nil, false, nil, false)
|
|
}
|
|
|
|
type EffectsUnion struct {
|
|
AnythingArray []interface{}
|
|
EffectsClass *EffectsClass
|
|
}
|
|
|
|
func (x *EffectsUnion) UnmarshalJSON(data []byte) error {
|
|
x.AnythingArray = nil
|
|
x.EffectsClass = nil
|
|
var c EffectsClass
|
|
object, err := unmarshalUnion(data, nil, nil, nil, nil, true, &x.AnythingArray, true, &c, false, nil, false, nil, false)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if object {
|
|
x.EffectsClass = &c
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *EffectsUnion) MarshalJSON() ([]byte, error) {
|
|
return marshalUnion(nil, nil, nil, nil, x.AnythingArray != nil, x.AnythingArray, x.EffectsClass != nil, x.EffectsClass, false, nil, false, nil, false)
|
|
}
|
|
|
|
type ProgressUnion struct {
|
|
PurpleProgress *PurpleProgress
|
|
ReplayProgressClassArray []ReplayProgressClass
|
|
}
|
|
|
|
func (x *ProgressUnion) UnmarshalJSON(data []byte) error {
|
|
x.ReplayProgressClassArray = nil
|
|
x.PurpleProgress = nil
|
|
var c PurpleProgress
|
|
object, err := unmarshalUnion(data, nil, nil, nil, nil, true, &x.ReplayProgressClassArray, true, &c, false, nil, false, nil, false)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if object {
|
|
x.PurpleProgress = &c
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *ProgressUnion) MarshalJSON() ([]byte, error) {
|
|
return marshalUnion(nil, nil, nil, nil, x.ReplayProgressClassArray != nil, x.ReplayProgressClassArray, x.PurpleProgress != nil, x.PurpleProgress, false, nil, false, nil, false)
|
|
}
|
|
|
|
type Heroes struct {
|
|
AnythingArray []interface{}
|
|
HeroValueMap map[string]HeroValue
|
|
}
|
|
|
|
func (x *Heroes) UnmarshalJSON(data []byte) error {
|
|
x.AnythingArray = nil
|
|
x.HeroValueMap = nil
|
|
object, err := unmarshalUnion(data, nil, nil, nil, nil, true, &x.AnythingArray, false, nil, true, &x.HeroValueMap, false, nil, false)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if object {
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *Heroes) MarshalJSON() ([]byte, error) {
|
|
return marshalUnion(nil, nil, nil, nil, x.AnythingArray != nil, x.AnythingArray, false, nil, x.HeroValueMap != nil, x.HeroValueMap, false, nil, false)
|
|
}
|
|
|
|
func unmarshalUnion(data []byte, pi **int64, pf **float64, pb **bool, ps **string, haveArray bool, pa interface{}, haveObject bool, pc interface{}, haveMap bool, pm interface{}, haveEnum bool, pe interface{}, nullable bool) (bool, error) {
|
|
if pi != nil {
|
|
*pi = nil
|
|
}
|
|
if pf != nil {
|
|
*pf = nil
|
|
}
|
|
if pb != nil {
|
|
*pb = nil
|
|
}
|
|
if ps != nil {
|
|
*ps = nil
|
|
}
|
|
|
|
dec := json.NewDecoder(bytes.NewReader(data))
|
|
dec.UseNumber()
|
|
tok, err := dec.Token()
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
|
|
switch v := tok.(type) {
|
|
case json.Number:
|
|
if pi != nil {
|
|
i, err := v.Int64()
|
|
if err == nil {
|
|
*pi = &i
|
|
return false, nil
|
|
}
|
|
}
|
|
if pf != nil {
|
|
f, err := v.Float64()
|
|
if err == nil {
|
|
*pf = &f
|
|
return false, nil
|
|
}
|
|
return false, errors.New("Unparsable number")
|
|
}
|
|
return false, errors.New("Union does not contain number")
|
|
case float64:
|
|
return false, errors.New("Decoder should not return float64")
|
|
case bool:
|
|
if pb != nil {
|
|
*pb = &v
|
|
return false, nil
|
|
}
|
|
return false, errors.New("Union does not contain bool")
|
|
case string:
|
|
if haveEnum {
|
|
return false, json.Unmarshal(data, pe)
|
|
}
|
|
if ps != nil {
|
|
*ps = &v
|
|
return false, nil
|
|
}
|
|
return false, errors.New("Union does not contain string")
|
|
case nil:
|
|
if nullable {
|
|
return false, nil
|
|
}
|
|
return false, errors.New("Union does not contain null")
|
|
case json.Delim:
|
|
if v == '{' {
|
|
if haveObject {
|
|
return true, json.Unmarshal(data, pc)
|
|
}
|
|
if haveMap {
|
|
return false, json.Unmarshal(data, pm)
|
|
}
|
|
return false, errors.New("Union does not contain object")
|
|
}
|
|
if v == '[' {
|
|
if haveArray {
|
|
return false, json.Unmarshal(data, pa)
|
|
}
|
|
return false, errors.New("Union does not contain array")
|
|
}
|
|
return false, errors.New("Cannot handle delimiter")
|
|
}
|
|
return false, errors.New("Cannot unmarshal union")
|
|
|
|
}
|
|
|
|
func marshalUnion(pi *int64, pf *float64, pb *bool, ps *string, haveArray bool, pa interface{}, haveObject bool, pc interface{}, haveMap bool, pm interface{}, haveEnum bool, pe interface{}, nullable bool) ([]byte, error) {
|
|
if pi != nil {
|
|
return json.Marshal(*pi)
|
|
}
|
|
if pf != nil {
|
|
return json.Marshal(*pf)
|
|
}
|
|
if pb != nil {
|
|
return json.Marshal(*pb)
|
|
}
|
|
if ps != nil {
|
|
return json.Marshal(*ps)
|
|
}
|
|
if haveArray {
|
|
return json.Marshal(pa)
|
|
}
|
|
if haveObject {
|
|
return json.Marshal(pc)
|
|
}
|
|
if haveMap {
|
|
return json.Marshal(pm)
|
|
}
|
|
if haveEnum {
|
|
return json.Marshal(pe)
|
|
}
|
|
if nullable {
|
|
return json.Marshal(nil)
|
|
}
|
|
return nil, errors.New("Union must not be null")
|
|
}
|