github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_characters_character_id_mail_labels_ok_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 easyjson30a3ef00DecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetCharactersCharacterIdMailLabelsOkList) { 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(GetCharactersCharacterIdMailLabelsOkList, 0, 2) 31 } else { 32 *out = GetCharactersCharacterIdMailLabelsOkList{} 33 } 34 } else { 35 *out = (*out)[:0] 36 } 37 for !in.IsDelim(']') { 38 var v1 GetCharactersCharacterIdMailLabelsOk 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 easyjson30a3ef00EncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetCharactersCharacterIdMailLabelsOkList) { 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 GetCharactersCharacterIdMailLabelsOkList) MarshalJSON() ([]byte, error) { 66 w := jwriter.Writer{} 67 easyjson30a3ef00EncodeGithubComAntihaxGoesiEsi(&w, v) 68 return w.Buffer.BuildBytes(), w.Error 69 } 70 71 // MarshalEasyJSON supports easyjson.Marshaler interface 72 func (v GetCharactersCharacterIdMailLabelsOkList) MarshalEasyJSON(w *jwriter.Writer) { 73 easyjson30a3ef00EncodeGithubComAntihaxGoesiEsi(w, v) 74 } 75 76 // UnmarshalJSON supports json.Unmarshaler interface 77 func (v *GetCharactersCharacterIdMailLabelsOkList) UnmarshalJSON(data []byte) error { 78 r := jlexer.Lexer{Data: data} 79 easyjson30a3ef00DecodeGithubComAntihaxGoesiEsi(&r, v) 80 return r.Error() 81 } 82 83 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 84 func (v *GetCharactersCharacterIdMailLabelsOkList) UnmarshalEasyJSON(l *jlexer.Lexer) { 85 easyjson30a3ef00DecodeGithubComAntihaxGoesiEsi(l, v) 86 } 87 func easyjson30a3ef00DecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetCharactersCharacterIdMailLabelsOk) { 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 "labels": 107 if in.IsNull() { 108 in.Skip() 109 out.Labels = nil 110 } else { 111 in.Delim('[') 112 if out.Labels == nil { 113 if !in.IsDelim(']') { 114 out.Labels = make([]GetCharactersCharacterIdMailLabelsLabel, 0, 1) 115 } else { 116 out.Labels = []GetCharactersCharacterIdMailLabelsLabel{} 117 } 118 } else { 119 out.Labels = (out.Labels)[:0] 120 } 121 for !in.IsDelim(']') { 122 var v4 GetCharactersCharacterIdMailLabelsLabel 123 (v4).UnmarshalEasyJSON(in) 124 out.Labels = append(out.Labels, v4) 125 in.WantComma() 126 } 127 in.Delim(']') 128 } 129 case "total_unread_count": 130 out.TotalUnreadCount = int32(in.Int32()) 131 default: 132 in.SkipRecursive() 133 } 134 in.WantComma() 135 } 136 in.Delim('}') 137 if isTopLevel { 138 in.Consumed() 139 } 140 } 141 func easyjson30a3ef00EncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetCharactersCharacterIdMailLabelsOk) { 142 out.RawByte('{') 143 first := true 144 _ = first 145 if len(in.Labels) != 0 { 146 const prefix string = ",\"labels\":" 147 first = false 148 out.RawString(prefix[1:]) 149 { 150 out.RawByte('[') 151 for v5, v6 := range in.Labels { 152 if v5 > 0 { 153 out.RawByte(',') 154 } 155 (v6).MarshalEasyJSON(out) 156 } 157 out.RawByte(']') 158 } 159 } 160 if in.TotalUnreadCount != 0 { 161 const prefix string = ",\"total_unread_count\":" 162 if first { 163 first = false 164 out.RawString(prefix[1:]) 165 } else { 166 out.RawString(prefix) 167 } 168 out.Int32(int32(in.TotalUnreadCount)) 169 } 170 out.RawByte('}') 171 } 172 173 // MarshalJSON supports json.Marshaler interface 174 func (v GetCharactersCharacterIdMailLabelsOk) MarshalJSON() ([]byte, error) { 175 w := jwriter.Writer{} 176 easyjson30a3ef00EncodeGithubComAntihaxGoesiEsi1(&w, v) 177 return w.Buffer.BuildBytes(), w.Error 178 } 179 180 // MarshalEasyJSON supports easyjson.Marshaler interface 181 func (v GetCharactersCharacterIdMailLabelsOk) MarshalEasyJSON(w *jwriter.Writer) { 182 easyjson30a3ef00EncodeGithubComAntihaxGoesiEsi1(w, v) 183 } 184 185 // UnmarshalJSON supports json.Unmarshaler interface 186 func (v *GetCharactersCharacterIdMailLabelsOk) UnmarshalJSON(data []byte) error { 187 r := jlexer.Lexer{Data: data} 188 easyjson30a3ef00DecodeGithubComAntihaxGoesiEsi1(&r, v) 189 return r.Error() 190 } 191 192 // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 193 func (v *GetCharactersCharacterIdMailLabelsOk) UnmarshalEasyJSON(l *jlexer.Lexer) { 194 easyjson30a3ef00DecodeGithubComAntihaxGoesiEsi1(l, v) 195 }