github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_characters_character_id_mail_mail_id_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 easyjson3c1b7f3cDecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetCharactersCharacterIdMailMailIdOkList) {
    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(GetCharactersCharacterIdMailMailIdOkList, 0, 0)
    31  			} else {
    32  				*out = GetCharactersCharacterIdMailMailIdOkList{}
    33  			}
    34  		} else {
    35  			*out = (*out)[:0]
    36  		}
    37  		for !in.IsDelim(']') {
    38  			var v1 GetCharactersCharacterIdMailMailIdOk
    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 easyjson3c1b7f3cEncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetCharactersCharacterIdMailMailIdOkList) {
    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 GetCharactersCharacterIdMailMailIdOkList) MarshalJSON() ([]byte, error) {
    66  	w := jwriter.Writer{}
    67  	easyjson3c1b7f3cEncodeGithubComAntihaxGoesiEsi(&w, v)
    68  	return w.Buffer.BuildBytes(), w.Error
    69  }
    70  
    71  // MarshalEasyJSON supports easyjson.Marshaler interface
    72  func (v GetCharactersCharacterIdMailMailIdOkList) MarshalEasyJSON(w *jwriter.Writer) {
    73  	easyjson3c1b7f3cEncodeGithubComAntihaxGoesiEsi(w, v)
    74  }
    75  
    76  // UnmarshalJSON supports json.Unmarshaler interface
    77  func (v *GetCharactersCharacterIdMailMailIdOkList) UnmarshalJSON(data []byte) error {
    78  	r := jlexer.Lexer{Data: data}
    79  	easyjson3c1b7f3cDecodeGithubComAntihaxGoesiEsi(&r, v)
    80  	return r.Error()
    81  }
    82  
    83  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    84  func (v *GetCharactersCharacterIdMailMailIdOkList) UnmarshalEasyJSON(l *jlexer.Lexer) {
    85  	easyjson3c1b7f3cDecodeGithubComAntihaxGoesiEsi(l, v)
    86  }
    87  func easyjson3c1b7f3cDecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetCharactersCharacterIdMailMailIdOk) {
    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 "body":
   107  			out.Body = string(in.String())
   108  		case "from":
   109  			out.From = int32(in.Int32())
   110  		case "labels":
   111  			if in.IsNull() {
   112  				in.Skip()
   113  				out.Labels = nil
   114  			} else {
   115  				in.Delim('[')
   116  				if out.Labels == nil {
   117  					if !in.IsDelim(']') {
   118  						out.Labels = make([]int32, 0, 16)
   119  					} else {
   120  						out.Labels = []int32{}
   121  					}
   122  				} else {
   123  					out.Labels = (out.Labels)[:0]
   124  				}
   125  				for !in.IsDelim(']') {
   126  					var v4 int32
   127  					v4 = int32(in.Int32())
   128  					out.Labels = append(out.Labels, v4)
   129  					in.WantComma()
   130  				}
   131  				in.Delim(']')
   132  			}
   133  		case "read":
   134  			out.Read = bool(in.Bool())
   135  		case "recipients":
   136  			if in.IsNull() {
   137  				in.Skip()
   138  				out.Recipients = nil
   139  			} else {
   140  				in.Delim('[')
   141  				if out.Recipients == nil {
   142  					if !in.IsDelim(']') {
   143  						out.Recipients = make([]GetCharactersCharacterIdMailMailIdRecipient, 0, 2)
   144  					} else {
   145  						out.Recipients = []GetCharactersCharacterIdMailMailIdRecipient{}
   146  					}
   147  				} else {
   148  					out.Recipients = (out.Recipients)[:0]
   149  				}
   150  				for !in.IsDelim(']') {
   151  					var v5 GetCharactersCharacterIdMailMailIdRecipient
   152  					easyjson3c1b7f3cDecodeGithubComAntihaxGoesiEsi2(in, &v5)
   153  					out.Recipients = append(out.Recipients, v5)
   154  					in.WantComma()
   155  				}
   156  				in.Delim(']')
   157  			}
   158  		case "subject":
   159  			out.Subject = string(in.String())
   160  		case "timestamp":
   161  			if data := in.Raw(); in.Ok() {
   162  				in.AddError((out.Timestamp).UnmarshalJSON(data))
   163  			}
   164  		default:
   165  			in.SkipRecursive()
   166  		}
   167  		in.WantComma()
   168  	}
   169  	in.Delim('}')
   170  	if isTopLevel {
   171  		in.Consumed()
   172  	}
   173  }
   174  func easyjson3c1b7f3cEncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetCharactersCharacterIdMailMailIdOk) {
   175  	out.RawByte('{')
   176  	first := true
   177  	_ = first
   178  	if in.Body != "" {
   179  		const prefix string = ",\"body\":"
   180  		first = false
   181  		out.RawString(prefix[1:])
   182  		out.String(string(in.Body))
   183  	}
   184  	if in.From != 0 {
   185  		const prefix string = ",\"from\":"
   186  		if first {
   187  			first = false
   188  			out.RawString(prefix[1:])
   189  		} else {
   190  			out.RawString(prefix)
   191  		}
   192  		out.Int32(int32(in.From))
   193  	}
   194  	if len(in.Labels) != 0 {
   195  		const prefix string = ",\"labels\":"
   196  		if first {
   197  			first = false
   198  			out.RawString(prefix[1:])
   199  		} else {
   200  			out.RawString(prefix)
   201  		}
   202  		{
   203  			out.RawByte('[')
   204  			for v6, v7 := range in.Labels {
   205  				if v6 > 0 {
   206  					out.RawByte(',')
   207  				}
   208  				out.Int32(int32(v7))
   209  			}
   210  			out.RawByte(']')
   211  		}
   212  	}
   213  	if in.Read {
   214  		const prefix string = ",\"read\":"
   215  		if first {
   216  			first = false
   217  			out.RawString(prefix[1:])
   218  		} else {
   219  			out.RawString(prefix)
   220  		}
   221  		out.Bool(bool(in.Read))
   222  	}
   223  	if len(in.Recipients) != 0 {
   224  		const prefix string = ",\"recipients\":"
   225  		if first {
   226  			first = false
   227  			out.RawString(prefix[1:])
   228  		} else {
   229  			out.RawString(prefix)
   230  		}
   231  		{
   232  			out.RawByte('[')
   233  			for v8, v9 := range in.Recipients {
   234  				if v8 > 0 {
   235  					out.RawByte(',')
   236  				}
   237  				easyjson3c1b7f3cEncodeGithubComAntihaxGoesiEsi2(out, v9)
   238  			}
   239  			out.RawByte(']')
   240  		}
   241  	}
   242  	if in.Subject != "" {
   243  		const prefix string = ",\"subject\":"
   244  		if first {
   245  			first = false
   246  			out.RawString(prefix[1:])
   247  		} else {
   248  			out.RawString(prefix)
   249  		}
   250  		out.String(string(in.Subject))
   251  	}
   252  	if true {
   253  		const prefix string = ",\"timestamp\":"
   254  		if first {
   255  			first = false
   256  			out.RawString(prefix[1:])
   257  		} else {
   258  			out.RawString(prefix)
   259  		}
   260  		out.Raw((in.Timestamp).MarshalJSON())
   261  	}
   262  	out.RawByte('}')
   263  }
   264  
   265  // MarshalJSON supports json.Marshaler interface
   266  func (v GetCharactersCharacterIdMailMailIdOk) MarshalJSON() ([]byte, error) {
   267  	w := jwriter.Writer{}
   268  	easyjson3c1b7f3cEncodeGithubComAntihaxGoesiEsi1(&w, v)
   269  	return w.Buffer.BuildBytes(), w.Error
   270  }
   271  
   272  // MarshalEasyJSON supports easyjson.Marshaler interface
   273  func (v GetCharactersCharacterIdMailMailIdOk) MarshalEasyJSON(w *jwriter.Writer) {
   274  	easyjson3c1b7f3cEncodeGithubComAntihaxGoesiEsi1(w, v)
   275  }
   276  
   277  // UnmarshalJSON supports json.Unmarshaler interface
   278  func (v *GetCharactersCharacterIdMailMailIdOk) UnmarshalJSON(data []byte) error {
   279  	r := jlexer.Lexer{Data: data}
   280  	easyjson3c1b7f3cDecodeGithubComAntihaxGoesiEsi1(&r, v)
   281  	return r.Error()
   282  }
   283  
   284  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   285  func (v *GetCharactersCharacterIdMailMailIdOk) UnmarshalEasyJSON(l *jlexer.Lexer) {
   286  	easyjson3c1b7f3cDecodeGithubComAntihaxGoesiEsi1(l, v)
   287  }
   288  func easyjson3c1b7f3cDecodeGithubComAntihaxGoesiEsi2(in *jlexer.Lexer, out *GetCharactersCharacterIdMailMailIdRecipient) {
   289  	isTopLevel := in.IsStart()
   290  	if in.IsNull() {
   291  		if isTopLevel {
   292  			in.Consumed()
   293  		}
   294  		in.Skip()
   295  		return
   296  	}
   297  	in.Delim('{')
   298  	for !in.IsDelim('}') {
   299  		key := in.UnsafeFieldName(false)
   300  		in.WantColon()
   301  		if in.IsNull() {
   302  			in.Skip()
   303  			in.WantComma()
   304  			continue
   305  		}
   306  		switch key {
   307  		case "recipient_id":
   308  			out.RecipientId = int32(in.Int32())
   309  		case "recipient_type":
   310  			out.RecipientType = string(in.String())
   311  		default:
   312  			in.SkipRecursive()
   313  		}
   314  		in.WantComma()
   315  	}
   316  	in.Delim('}')
   317  	if isTopLevel {
   318  		in.Consumed()
   319  	}
   320  }
   321  func easyjson3c1b7f3cEncodeGithubComAntihaxGoesiEsi2(out *jwriter.Writer, in GetCharactersCharacterIdMailMailIdRecipient) {
   322  	out.RawByte('{')
   323  	first := true
   324  	_ = first
   325  	if in.RecipientId != 0 {
   326  		const prefix string = ",\"recipient_id\":"
   327  		first = false
   328  		out.RawString(prefix[1:])
   329  		out.Int32(int32(in.RecipientId))
   330  	}
   331  	if in.RecipientType != "" {
   332  		const prefix string = ",\"recipient_type\":"
   333  		if first {
   334  			first = false
   335  			out.RawString(prefix[1:])
   336  		} else {
   337  			out.RawString(prefix)
   338  		}
   339  		out.String(string(in.RecipientType))
   340  	}
   341  	out.RawByte('}')
   342  }