-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstructs.go
348 lines (326 loc) · 11.5 KB
/
structs.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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
package gohq
import (
"time"
"github.com/gorilla/websocket"
)
// Account information
type Account struct {
UserID int `json:"userId"`
Username string `json:"username"`
Admin bool `json:"admin"`
Tester bool `json:"tester"`
Guest bool `json:"guest"`
AvatarURL string `json:"avatarUrl"`
LoginToken string `json:"loginToken"`
AccessToken string `json:"accessToken"`
AuthToken string `json:"authToken"`
}
// HQ specific errors
type HQError struct {
Error string `json:"error"`
ErrorCode int `json:"errorCode"`
}
// HQ token refresh data
type Tokens struct {
UserID int `json:"userId"`
Username string `json:"username"`
Admin bool `json:"admin"`
Tester bool `json:"tester"`
Guest bool `json:"guest"`
AvatarURL string `json:"avatarUrl"`
LoginToken string `json:"loginToken"`
AccessToken string `json:"accessToken"`
AuthToken string `json:"authToken"`
}
// Me contains profile information
type Me struct {
UserID int `json:"userId"`
Username string `json:"username"`
AvatarURL string `json:"avatarUrl"`
Created time.Time `json:"created"`
Broadcasts struct {
Data []interface{} `json:"data"`
} `json:"broadcasts"`
Featured bool `json:"featured"`
Voip bool `json:"voip"`
DeviceTokens []string `json:"deviceTokens"`
HasPhone bool `json:"hasPhone"`
PhoneNumber string `json:"phoneNumber"`
ReferralURL string `json:"referralUrl"`
Referred bool `json:"referred"`
ReferringUserID int `json:"referringUserId"`
HighScore int `json:"highScore"`
GamesPlayed int `json:"gamesPlayed"`
WinCount int `json:"winCount"`
Blocked bool `json:"blocked"`
BlocksMe bool `json:"blocksMe"`
Preferences struct {
SharingEnabled bool `json:"sharingEnabled"`
} `json:"preferences"`
FriendIds []int `json:"friendIds"`
Lives string `json:"lives"`
Stk string `json:"stk"`
Leaderboard struct {
TotalCents int `json:"totalCents"`
Total string `json:"total"`
Unclaimed string `json:"unclaimed"`
Wins int `json:"wins"`
Rank int `json:"rank"`
Alltime struct {
Total string `json:"total"`
Wins int `json:"wins"`
Rank int `json:"rank"`
} `json:"alltime"`
Weekly struct {
Total string `json:"total"`
Wins int `json:"wins"`
Rank int `json:"rank"`
} `json:"weekly"`
} `json:"leaderboard"`
}
// CashoutData is data you get after cashing out
type CashoutData struct {
Data struct {
PayoutID int `json:"payoutId"`
UserID int `json:"userId"`
Amount string `json:"amount"`
Currency string `json:"currency"`
TargetUserID interface{} `json:"targetUserId"`
TargetEmail string `json:"targetEmail"`
TargetPhone interface{} `json:"targetPhone"`
Status int `json:"status"`
Metadata struct {
PayoutsConnected bool `json:"payoutsConnected"`
Client string `json:"client"`
} `json:"metadata"`
Created time.Time `json:"created"`
Modified time.Time `json:"modified"`
} `json:"data"`
}
// PayoutData is data of all payouts
type PayoutData struct {
Payouts []struct {
PayoutID int `json:"payoutId"`
UserID int `json:"userId"`
Amount string `json:"amount"`
Currency string `json:"currency"`
TargetUserID interface{} `json:"targetUserId"`
TargetEmail string `json:"targetEmail"`
TargetPhone interface{} `json:"targetPhone"`
Status int `json:"status"`
Metadata struct {
PayoutsConnected bool `json:"payoutsConnected"`
Client string `json:"client"`
} `json:"metadata"`
Created time.Time `json:"created"`
Modified time.Time `json:"modified"`
} `json:"payouts"`
Balance struct {
PrizeTotal string `json:"prizeTotal"`
Paid string `json:"paid"`
Pending string `json:"pending"`
Unpaid string `json:"unpaid"`
EligibleForPayout bool `json:"eligibleForPayout"`
HasPending bool `json:"hasPending"`
PayoutsConnected bool `json:"payoutsConnected"`
PayoutsEmail string `json:"payoutsEmail"`
DocumentRequired bool `json:"documentRequired"`
DocumentStatus string `json:"documentStatus"`
} `json:"balance"`
}
// SearchData is data from when a user is searched for
type SearchData struct {
Data []struct {
UserID int `json:"userId,int"`
Username string `json:"username"`
AvatarURL string `json:"avatarUrl,omitempty"`
Created time.Time `json:"created"`
Live bool `json:"live,omitempty"`
SubscriberCount int `json:"subscriberCount,omitempty"`
LastLive interface{} `json:"lastLive,omitempty"`
Featured bool `json:"featured,omitempty"`
} `json:"data"`
Links struct {
Next interface{} `json:"next"`
Prev string `json:"prev"`
Self string `json:"self"`
} `json:"links"`
}
// ScheduleData contains information about the upcoming and ongoing HQ games
type ScheduleData struct {
Active bool `json:"active"`
AtCapacity bool `json:"atCapacity"`
ShowID int `json:"showId"`
ShowType string `json:"showType"`
StartTime time.Time `json:"startTime"`
NextShowTime time.Time `json:"nextShowTime"`
NextShowPrize string `json:"nextShowPrize"`
Upcoming []struct {
Time time.Time `json:"time"`
Prize string `json:"prize"`
} `json:"upcoming"`
Prize int `json:"prize"`
Broadcast struct {
BroadcastID int `json:"broadcastId"`
UserID int `json:"userId"`
Title string `json:"title"`
Status int `json:"status"`
State string `json:"state"`
ChannelID int `json:"channelId"`
Created time.Time `json:"created"`
Started time.Time `json:"started"`
Ended interface{} `json:"ended"`
Permalink string `json:"permalink"`
ThumbnailData interface{} `json:"thumbnailData"`
Tags []interface{} `json:"tags"`
SocketURL string `json:"socketUrl"`
Streams struct {
Source string `json:"source"`
Passthrough string `json:"passthrough"`
High string `json:"high"`
Medium string `json:"medium"`
Low string `json:"low"`
} `json:"streams"`
StreamURL string `json:"streamUrl"`
StreamKey string `json:"streamKey"`
RelativeTimestamp int `json:"relativeTimestamp"`
Links struct {
Self string `json:"self"`
Transcript string `json:"transcript"`
Viewers string `json:"viewers"`
} `json:"links"`
} `json:"broadcast"`
GameKey string `json:"gameKey"`
BroadcastFull bool `json:"broadcastFull"`
}
// Game is a type which contains information about websocket connections
type Game struct {
Conn *websocket.Conn
}
// BroadcastStats gives you information about the current broadcast
type BroadcastStats struct {
Type string `json:"type"`
LikeCount int `json:"likeCount"`
StatusMessage string `json:"statusMessage"`
ViewerCounts struct {
Connected int `json:"connected"`
Playing int `json:"playing"`
Watching int `json:"watching"`
} `json:"viewerCounts"`
BroadcastSubscribers []interface{} `json:"broadcastSubscribers"`
Ts time.Time `json:"ts"`
Sent time.Time `json:"sent"`
}
// Question gives you information about a new question
type Question struct {
Type string `json:"type"`
TotalTimeMs int `json:"totalTimeMs"`
TimeLeftMs int `json:"timeLeftMs"`
QuestionID int `json:"questionId"`
Question string `json:"question"`
Category string `json:"category"`
Answers []struct {
AnswerID int `json:"answerId"`
Text string `json:"text"`
} `json:"answers"`
QuestionNumber int `json:"questionNumber"`
QuestionCount int `json:"questionCount"`
Ts time.Time `json:"ts"`
Sent time.Time `json:"sent"`
}
// QuestionSummary returns post question information
type QuestionSummary struct {
AdvancingPlayersCount int `json:"advancingPlayersCount"`
AnswerCounts []struct {
Answer string `json:"answer"`
AnswerID int `json:"answerId"`
Correct bool `json:"correct"`
Count int `json:"count"`
} `json:"answerCounts"`
EliminatedPlayersCount int `json:"eliminatedPlayersCount"`
ExtraLivesRemaining int `json:"extraLivesRemaining"`
ID string `json:"id"`
Question string `json:"question"`
QuestionID int `json:"questionId"`
SavedByExtraLife bool `json:"savedByExtraLife"`
Sent time.Time `json:"sent"`
Ts time.Time `json:"ts"`
Type string `json:"type"`
YouGotItRight bool `json:"youGotItRight"`
YourAnswerID int `json:"yourAnswerId"`
}
// QuestionClosed indicates a question is no longer able to be answered
type QuestionClosed struct {
Type string `json:"type"`
QuestionID int `json:"questionId"`
Ts time.Time `json:"ts"`
Sent time.Time `json:"sent"`
}
// Question finished indicates the question is now over
type QuestionFinished struct {
Type string `json:"type"`
QuestionID int `json:"questionId"`
Ts time.Time `json:"ts"`
Sent time.Time `json:"sent"`
}
// GameStatus indicates status information for the game
type GameStatus struct {
CardPlaysRemaining int `json:"cardPlaysRemaining"`
Kind string `json:"kind"`
Prize string `json:"prize"`
InTheGame bool `json:"inTheGame"`
Type string `json:"type"`
QuestionCount int `json:"questionCount"`
ExtraLivesRemaining int `json:"extraLivesRemaining"`
CurrentState interface{} `json:"currentState"`
Cts time.Time `json:"cts"`
QuestionNumber int `json:"questionNumber"`
ExtraLives int `json:"extraLives"`
Ts time.Time `json:"ts"`
Sent time.Time `json:"sent"`
}
// ChatMessage shows chat messages sent by users
type ChatMessage struct {
Type string `json:"type"`
ItemID string `json:"itemId"`
UserID int `json:"userId"`
Metadata struct {
UserID int `json:"userId"`
Message string `json:"message"`
AvatarURL string `json:"avatarUrl"`
Interaction string `json:"interaction"`
Username string `json:"username"`
} `json:"metadata"`
Ts time.Time `json:"ts"`
Sent time.Time `json:"sent"`
}
// LoginToken response
type LoginTokenResponse struct {
LoginToken string `json:"loginToken"`
}
// Authentication information from logging in?
type Auth struct {
Auth *Account `json:"auth,omitempty"`
}
// AWSSession gives information for uploading avatars
type AWSSession struct {
AccessKeyID string `json:"accessKeyId"`
SecretKey string `json:"secretKey"`
SessionToken string `json:"sessionToken"`
Expiration time.Time `json:"expiration"`
}
// A verification session
type Verification struct {
CallsEnabled bool `json:"callsEnabled"`
Expires time.Time `json:"expires"`
Phone string `json:"phone"`
RetrySeconds int `json:"retrySeconds"`
VerificationID string `json:"verificationId"`
}
// The result to any update
type UpdateInfo struct {
UserID int `json:"userId"`
Username string `json:"username"`
AvatarURL string `json:"avatarUrl"`
Created time.Time `json:"created"`
}