github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_fw_leaderboards_victory_points_easyjson.go (about) 1 // Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT. 2 3 package esi 4 5 import ( 6 json "encoding/json" 7 8 easyjson "github.com/mailru/easyjson" 9 jlexer "github.com/mailru/easyjson/jlexer" 10 jwriter "github.com/mailru/easyjson/jwriter" 11 ) 12 13 // suppress unused package warning 14 var ( 15 _ *json.RawMessage 16 _ *jlexer.Lexer 17 _ *jwriter.Writer 18 _ easyjson.Marshaler 19 ) 20 21 func easyjson682940b2DecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetFwLeaderboardsVictoryPointsList) { 22 isTopLevel := in.IsStart() 23 if in.IsNull() { 24 in.Skip() 25 *out = nil 26 } else { 27 in.Delim('[') 28 if *out == nil { 29 if !in.IsDelim(']') { 30 *out = make(GetFwLeaderboardsVictoryPointsList, 0, 0) 31 } else { 32 *out = GetFwLeaderboardsVictoryPointsList{} 33 } 34 } else { 35 *out = (*out)[:0] 36 } 37 for !in.IsDelim(']') { 38 var v1 GetFwLeaderboardsVictoryPoints 39 (v1).UnmarshalEasyJSON(in) 40 *out = append(*out, v1) 41 in.WantComma() 42 } 43 in.Delim(']') 44 } 45 if isTopLevel { 46 in.Consumed() 47 } 48 } 49 func easyjson682940b2EncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetFwLeaderboardsVictoryPointsList) { 50 if in == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { 51 out.RawString("null") 52 } else { 53 out.RawByte('[') 54 for v2, v3 := range in { 55 if v2 > 0 { 56 out.RawByte(',') 57 } 58 (v3).MarshalEasyJSON(out) 59 } 60 out.RawByte(']') 61 } 62 } 63 64 // MarshalJSON supports json.Marshaler interface 65 func (v GetFwLeaderboardsVictoryPointsList) MarshalJSON() ([]byte, error) { 66 w := jwriter.Writer{} 67 easyjson682940b2EncodeGithubComAntihaxGoesiEsi(&w, v) 68 return w.Buffer.BuildBytes(), w.Error 69 } 70 71 // MarshalEasyJSON supports easyjson.Marshaler interface 72 func (v GetFwLeaderboardsVictoryPointsList) MarshalEasyJSON(w *jwriter.Writer) { 73 easyjson682940b2EncodeGithubComAntihaxGoesiEsi(w, v) 74 } 75 76 // UnmarshalJSON supports json.Unmarshaler interface 77 func (v *GetFwLeaderboardsVictoryPointsList) UnmarshalJSON(data []byte) error { 78 r := jlexer.Lexer{Data: data} 79 easyjson682940b2DecodeGithubComAntihaxGoesiEsi(&r, v) 80 return r.Error() 81 } 82 83 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 84 func (v *GetFwLeaderboardsVictoryPointsList) UnmarshalEasyJSON(l *jlexer.Lexer) { 85 easyjson682940b2DecodeGithubComAntihaxGoesiEsi(l, v) 86 } 87 func easyjson682940b2DecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetFwLeaderboardsVictoryPoints) { 88 isTopLevel := in.IsStart() 89 if in.IsNull() { 90 if isTopLevel { 91 in.Consumed() 92 } 93 in.Skip() 94 return 95 } 96 in.Delim('{') 97 for !in.IsDelim('}') { 98 key := in.UnsafeFieldName(false) 99 in.WantColon() 100 if in.IsNull() { 101 in.Skip() 102 in.WantComma() 103 continue 104 } 105 switch key { 106 case "active_total": 107 if in.IsNull() { 108 in.Skip() 109 out.ActiveTotal = nil 110 } else { 111 in.Delim('[') 112 if out.ActiveTotal == nil { 113 if !in.IsDelim(']') { 114 out.ActiveTotal = make([]GetFwLeaderboardsActiveTotalActiveTotal1, 0, 8) 115 } else { 116 out.ActiveTotal = []GetFwLeaderboardsActiveTotalActiveTotal1{} 117 } 118 } else { 119 out.ActiveTotal = (out.ActiveTotal)[:0] 120 } 121 for !in.IsDelim(']') { 122 var v4 GetFwLeaderboardsActiveTotalActiveTotal1 123 easyjson682940b2DecodeGithubComAntihaxGoesiEsi2(in, &v4) 124 out.ActiveTotal = append(out.ActiveTotal, v4) 125 in.WantComma() 126 } 127 in.Delim(']') 128 } 129 case "last_week": 130 if in.IsNull() { 131 in.Skip() 132 out.LastWeek = nil 133 } else { 134 in.Delim('[') 135 if out.LastWeek == nil { 136 if !in.IsDelim(']') { 137 out.LastWeek = make([]GetFwLeaderboardsLastWeekLastWeek1, 0, 8) 138 } else { 139 out.LastWeek = []GetFwLeaderboardsLastWeekLastWeek1{} 140 } 141 } else { 142 out.LastWeek = (out.LastWeek)[:0] 143 } 144 for !in.IsDelim(']') { 145 var v5 GetFwLeaderboardsLastWeekLastWeek1 146 (v5).UnmarshalEasyJSON(in) 147 out.LastWeek = append(out.LastWeek, v5) 148 in.WantComma() 149 } 150 in.Delim(']') 151 } 152 case "yesterday": 153 if in.IsNull() { 154 in.Skip() 155 out.Yesterday = nil 156 } else { 157 in.Delim('[') 158 if out.Yesterday == nil { 159 if !in.IsDelim(']') { 160 out.Yesterday = make([]GetFwLeaderboardsYesterdayYesterday1, 0, 8) 161 } else { 162 out.Yesterday = []GetFwLeaderboardsYesterdayYesterday1{} 163 } 164 } else { 165 out.Yesterday = (out.Yesterday)[:0] 166 } 167 for !in.IsDelim(']') { 168 var v6 GetFwLeaderboardsYesterdayYesterday1 169 easyjson682940b2DecodeGithubComAntihaxGoesiEsi3(in, &v6) 170 out.Yesterday = append(out.Yesterday, v6) 171 in.WantComma() 172 } 173 in.Delim(']') 174 } 175 default: 176 in.SkipRecursive() 177 } 178 in.WantComma() 179 } 180 in.Delim('}') 181 if isTopLevel { 182 in.Consumed() 183 } 184 } 185 func easyjson682940b2EncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetFwLeaderboardsVictoryPoints) { 186 out.RawByte('{') 187 first := true 188 _ = first 189 if len(in.ActiveTotal) != 0 { 190 const prefix string = ",\"active_total\":" 191 first = false 192 out.RawString(prefix[1:]) 193 { 194 out.RawByte('[') 195 for v7, v8 := range in.ActiveTotal { 196 if v7 > 0 { 197 out.RawByte(',') 198 } 199 easyjson682940b2EncodeGithubComAntihaxGoesiEsi2(out, v8) 200 } 201 out.RawByte(']') 202 } 203 } 204 if len(in.LastWeek) != 0 { 205 const prefix string = ",\"last_week\":" 206 if first { 207 first = false 208 out.RawString(prefix[1:]) 209 } else { 210 out.RawString(prefix) 211 } 212 { 213 out.RawByte('[') 214 for v9, v10 := range in.LastWeek { 215 if v9 > 0 { 216 out.RawByte(',') 217 } 218 (v10).MarshalEasyJSON(out) 219 } 220 out.RawByte(']') 221 } 222 } 223 if len(in.Yesterday) != 0 { 224 const prefix string = ",\"yesterday\":" 225 if first { 226 first = false 227 out.RawString(prefix[1:]) 228 } else { 229 out.RawString(prefix) 230 } 231 { 232 out.RawByte('[') 233 for v11, v12 := range in.Yesterday { 234 if v11 > 0 { 235 out.RawByte(',') 236 } 237 easyjson682940b2EncodeGithubComAntihaxGoesiEsi3(out, v12) 238 } 239 out.RawByte(']') 240 } 241 } 242 out.RawByte('}') 243 } 244 245 // MarshalJSON supports json.Marshaler interface 246 func (v GetFwLeaderboardsVictoryPoints) MarshalJSON() ([]byte, error) { 247 w := jwriter.Writer{} 248 easyjson682940b2EncodeGithubComAntihaxGoesiEsi1(&w, v) 249 return w.Buffer.BuildBytes(), w.Error 250 } 251 252 // MarshalEasyJSON supports easyjson.Marshaler interface 253 func (v GetFwLeaderboardsVictoryPoints) MarshalEasyJSON(w *jwriter.Writer) { 254 easyjson682940b2EncodeGithubComAntihaxGoesiEsi1(w, v) 255 } 256 257 // UnmarshalJSON supports json.Unmarshaler interface 258 func (v *GetFwLeaderboardsVictoryPoints) UnmarshalJSON(data []byte) error { 259 r := jlexer.Lexer{Data: data} 260 easyjson682940b2DecodeGithubComAntihaxGoesiEsi1(&r, v) 261 return r.Error() 262 } 263 264 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 265 func (v *GetFwLeaderboardsVictoryPoints) UnmarshalEasyJSON(l *jlexer.Lexer) { 266 easyjson682940b2DecodeGithubComAntihaxGoesiEsi1(l, v) 267 } 268 func easyjson682940b2DecodeGithubComAntihaxGoesiEsi3(in *jlexer.Lexer, out *GetFwLeaderboardsYesterdayYesterday1) { 269 isTopLevel := in.IsStart() 270 if in.IsNull() { 271 if isTopLevel { 272 in.Consumed() 273 } 274 in.Skip() 275 return 276 } 277 in.Delim('{') 278 for !in.IsDelim('}') { 279 key := in.UnsafeFieldName(false) 280 in.WantColon() 281 if in.IsNull() { 282 in.Skip() 283 in.WantComma() 284 continue 285 } 286 switch key { 287 case "amount": 288 out.Amount = int32(in.Int32()) 289 case "faction_id": 290 out.FactionId = int32(in.Int32()) 291 default: 292 in.SkipRecursive() 293 } 294 in.WantComma() 295 } 296 in.Delim('}') 297 if isTopLevel { 298 in.Consumed() 299 } 300 } 301 func easyjson682940b2EncodeGithubComAntihaxGoesiEsi3(out *jwriter.Writer, in GetFwLeaderboardsYesterdayYesterday1) { 302 out.RawByte('{') 303 first := true 304 _ = first 305 if in.Amount != 0 { 306 const prefix string = ",\"amount\":" 307 first = false 308 out.RawString(prefix[1:]) 309 out.Int32(int32(in.Amount)) 310 } 311 if in.FactionId != 0 { 312 const prefix string = ",\"faction_id\":" 313 if first { 314 first = false 315 out.RawString(prefix[1:]) 316 } else { 317 out.RawString(prefix) 318 } 319 out.Int32(int32(in.FactionId)) 320 } 321 out.RawByte('}') 322 } 323 func easyjson682940b2DecodeGithubComAntihaxGoesiEsi2(in *jlexer.Lexer, out *GetFwLeaderboardsActiveTotalActiveTotal1) { 324 isTopLevel := in.IsStart() 325 if in.IsNull() { 326 if isTopLevel { 327 in.Consumed() 328 } 329 in.Skip() 330 return 331 } 332 in.Delim('{') 333 for !in.IsDelim('}') { 334 key := in.UnsafeFieldName(false) 335 in.WantColon() 336 if in.IsNull() { 337 in.Skip() 338 in.WantComma() 339 continue 340 } 341 switch key { 342 case "amount": 343 out.Amount = int32(in.Int32()) 344 case "faction_id": 345 out.FactionId = int32(in.Int32()) 346 default: 347 in.SkipRecursive() 348 } 349 in.WantComma() 350 } 351 in.Delim('}') 352 if isTopLevel { 353 in.Consumed() 354 } 355 } 356 func easyjson682940b2EncodeGithubComAntihaxGoesiEsi2(out *jwriter.Writer, in GetFwLeaderboardsActiveTotalActiveTotal1) { 357 out.RawByte('{') 358 first := true 359 _ = first 360 if in.Amount != 0 { 361 const prefix string = ",\"amount\":" 362 first = false 363 out.RawString(prefix[1:]) 364 out.Int32(int32(in.Amount)) 365 } 366 if in.FactionId != 0 { 367 const prefix string = ",\"faction_id\":" 368 if first { 369 first = false 370 out.RawString(prefix[1:]) 371 } else { 372 out.RawString(prefix) 373 } 374 out.Int32(int32(in.FactionId)) 375 } 376 out.RawByte('}') 377 }