-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtypes.go
184 lines (162 loc) · 5.47 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
package poeapi
import "time"
const (
testHost = "127.0.0.1:8000"
)
var (
validHosts = map[string]struct{}{
"api.pathofexile.com": {},
testHost: {},
}
validRealms = map[string]struct{}{
"pc": {},
"xbox": {},
"sony": {},
}
validLeagueTypes = map[string]struct{}{
"main": {},
"event": {},
"season": {},
}
validLadderTypes = map[string]struct{}{
"league": {},
"labyrinth": {},
"pvp": {},
}
validLabyrinthDifficulties = map[string]struct{}{
"Normal": {},
"Cruel": {},
"Merciless": {},
"Eternal": {},
}
)
// League represents a permanent or challenge league.
type League struct {
Name string `json:"id" validate:"nonzero"`
Realm string `json:"realm"`
Description string `json:"description"`
LadderURL string `json:"url"`
StartTime time.Time `json:"startAt"`
EndTime time.Time `json:"endAt"`
DelveEnabled bool `json:"delveEvent"`
Rules []LeagueRule `json:"rules"`
}
// LeagueRule represents a modifier placed on a league.
type LeagueRule struct {
ID string `json:"id" validate:"nonzero"`
Name string `json:"name"`
Description string `json:"description"`
}
// Ladder represents the leaderboard for a specific league.
type Ladder struct {
TotalEntries int `json:"total" validate:"nonzero"`
Title string `json:"title"`
StartTime int `json:"startTime"`
Entries []LadderEntry `json:"entries"`
}
// LadderEntry represents an entry on the ladder.
type LadderEntry struct {
Online bool `json:"bool"`
Rank int `json:"rank"`
LabyrinthTime int `json:"time"`
Character Character `json:"character"`
Account Account `json:"account"`
}
// Character represents a player in a ladder entry.
type Character struct {
Name string `json:"name"`
Level int `json:"level"`
Class string `json:"class"`
ID string `json:"id"`
Experience int `json:"experience"`
}
// Account represents an account for a ladder entry.
type Account struct {
Name string `json:"name"`
Realm string `json:"realm"`
Challenges Challenges `json:"challenges"`
TwitchInfo TwitchInfo `json:"twitch"`
}
// TwitchInfo represents an account's linked Twitch user.
type TwitchInfo struct {
Username string `json:"name"`
}
// Challenges represents an account's completed challenges.
type Challenges struct {
Total int `json:"total"`
}
// PVPMatch represents a PVP event type.
type PVPMatch struct {
ID string `json:"id"`
Realm string `json:"realm"`
StartTime time.Time `json:"startAt"`
EndTime time.Time `json:"endAt"`
LadderURL string `json:"url"`
Description string `json:"description"`
GlickoRatings bool `json:"glickoRatings"`
PVP bool `json:"pvp"`
Style string `json:"style"`
RegisterTime time.Time `json:"registerAt"`
}
// StashResponse represents a response from the stash tab API which contains
// multiples stashes.
type StashResponse struct {
NextChangeID string `json:"next_change_id"`
Stashes []Stash `json:"stashes"`
}
// Stash represents a single public stash tab.
type Stash struct {
ID string `json:"id"`
AccountName string `json:"accountName"`
LastCharacterName string `json:"lastCharacterName"`
Index string `json:"stash"`
Type string `json:"stashType"`
Items []Item `json:"items"`
Public bool `json:"public"`
}
// Item represents an item listing in the stash tab API.
type Item struct {
Corrupted bool `json:"corrupted"`
ExplicitMods []string `json:"explicitMods"`
FlavorText []string `json:"flavourText"`
FrameType int64 `json:"frameType"`
Height int64 `json:"h"`
ID string `json:"id"`
Icon string `json:"icon"`
Identified bool `json:"identified"`
ImplicitMods []string `json:"implicitMods"`
InventoryID string `json:"inventoryId"`
ItemLevel int64 `json:"ilvl"`
League string `json:"league"`
LockedToCharacter bool `json:"lockedToCharacter"`
Name string `json:"name"`
Note string `json:"note"`
Properties []Property `json:"properties"`
Requirements []Requirement `json:"requirements"`
SocketedItems interface{} `json:"socketedItems"`
Sockets []Socket `json:"sockets"`
Support bool `json:"support"`
TalismanTier int64 `json:"talismanTier"`
TypeLine string `json:"typeLine"`
Verified bool `json:"verified"`
Width int64 `json:"w"`
XPosition int64 `json:"x"`
YPosition int64 `json:"y"`
}
// Property represents a property of an Item.
type Property struct {
DisplayMode int64 `json:"displayMode"`
Name string `json:"name"`
Values [][]interface{} `json:"values"`
}
// Requirement represents an attribute requirement on an Item, such as strength.
type Requirement struct {
DisplayMode int64 `json:"displayMode"`
Name string `json:"name"`
Values [][]interface{} `json:"values"`
}
// Socket represents a socket on an item, including its color and links.
type Socket struct {
Attribute string `json:"attr"`
Group int64 `json:"group"`
}