github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_post_ui_openwindow_newmail_new_mail_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 easyjson6b8ca5bfDecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *PostUiOpenwindowNewmailNewMailList) {
    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(PostUiOpenwindowNewmailNewMailList, 0, 1)
    31  			} else {
    32  				*out = PostUiOpenwindowNewmailNewMailList{}
    33  			}
    34  		} else {
    35  			*out = (*out)[:0]
    36  		}
    37  		for !in.IsDelim(']') {
    38  			var v1 PostUiOpenwindowNewmailNewMail
    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 easyjson6b8ca5bfEncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in PostUiOpenwindowNewmailNewMailList) {
    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 PostUiOpenwindowNewmailNewMailList) MarshalJSON() ([]byte, error) {
    66  	w := jwriter.Writer{}
    67  	easyjson6b8ca5bfEncodeGithubComAntihaxGoesiEsi(&w, v)
    68  	return w.Buffer.BuildBytes(), w.Error
    69  }
    70  
    71  // MarshalEasyJSON supports easyjson.Marshaler interface
    72  func (v PostUiOpenwindowNewmailNewMailList) MarshalEasyJSON(w *jwriter.Writer) {
    73  	easyjson6b8ca5bfEncodeGithubComAntihaxGoesiEsi(w, v)
    74  }
    75  
    76  // UnmarshalJSON supports json.Unmarshaler interface
    77  func (v *PostUiOpenwindowNewmailNewMailList) UnmarshalJSON(data []byte) error {
    78  	r := jlexer.Lexer{Data: data}
    79  	easyjson6b8ca5bfDecodeGithubComAntihaxGoesiEsi(&r, v)
    80  	return r.Error()
    81  }
    82  
    83  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    84  func (v *PostUiOpenwindowNewmailNewMailList) UnmarshalEasyJSON(l *jlexer.Lexer) {
    85  	easyjson6b8ca5bfDecodeGithubComAntihaxGoesiEsi(l, v)
    86  }
    87  func easyjson6b8ca5bfDecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *PostUiOpenwindowNewmailNewMail) {
    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 "recipients":
   109  			if in.IsNull() {
   110  				in.Skip()
   111  				out.Recipients = nil
   112  			} else {
   113  				in.Delim('[')
   114  				if out.Recipients == nil {
   115  					if !in.IsDelim(']') {
   116  						out.Recipients = make([]int32, 0, 16)
   117  					} else {
   118  						out.Recipients = []int32{}
   119  					}
   120  				} else {
   121  					out.Recipients = (out.Recipients)[:0]
   122  				}
   123  				for !in.IsDelim(']') {
   124  					var v4 int32
   125  					v4 = int32(in.Int32())
   126  					out.Recipients = append(out.Recipients, v4)
   127  					in.WantComma()
   128  				}
   129  				in.Delim(']')
   130  			}
   131  		case "subject":
   132  			out.Subject = string(in.String())
   133  		case "to_corp_or_alliance_id":
   134  			out.ToCorpOrAllianceId = int32(in.Int32())
   135  		case "to_mailing_list_id":
   136  			out.ToMailingListId = int32(in.Int32())
   137  		default:
   138  			in.SkipRecursive()
   139  		}
   140  		in.WantComma()
   141  	}
   142  	in.Delim('}')
   143  	if isTopLevel {
   144  		in.Consumed()
   145  	}
   146  }
   147  func easyjson6b8ca5bfEncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in PostUiOpenwindowNewmailNewMail) {
   148  	out.RawByte('{')
   149  	first := true
   150  	_ = first
   151  	if in.Body != "" {
   152  		const prefix string = ",\"body\":"
   153  		first = false
   154  		out.RawString(prefix[1:])
   155  		out.String(string(in.Body))
   156  	}
   157  	if len(in.Recipients) != 0 {
   158  		const prefix string = ",\"recipients\":"
   159  		if first {
   160  			first = false
   161  			out.RawString(prefix[1:])
   162  		} else {
   163  			out.RawString(prefix)
   164  		}
   165  		{
   166  			out.RawByte('[')
   167  			for v5, v6 := range in.Recipients {
   168  				if v5 > 0 {
   169  					out.RawByte(',')
   170  				}
   171  				out.Int32(int32(v6))
   172  			}
   173  			out.RawByte(']')
   174  		}
   175  	}
   176  	if in.Subject != "" {
   177  		const prefix string = ",\"subject\":"
   178  		if first {
   179  			first = false
   180  			out.RawString(prefix[1:])
   181  		} else {
   182  			out.RawString(prefix)
   183  		}
   184  		out.String(string(in.Subject))
   185  	}
   186  	if in.ToCorpOrAllianceId != 0 {
   187  		const prefix string = ",\"to_corp_or_alliance_id\":"
   188  		if first {
   189  			first = false
   190  			out.RawString(prefix[1:])
   191  		} else {
   192  			out.RawString(prefix)
   193  		}
   194  		out.Int32(int32(in.ToCorpOrAllianceId))
   195  	}
   196  	if in.ToMailingListId != 0 {
   197  		const prefix string = ",\"to_mailing_list_id\":"
   198  		if first {
   199  			first = false
   200  			out.RawString(prefix[1:])
   201  		} else {
   202  			out.RawString(prefix)
   203  		}
   204  		out.Int32(int32(in.ToMailingListId))
   205  	}
   206  	out.RawByte('}')
   207  }
   208  
   209  // MarshalJSON supports json.Marshaler interface
   210  func (v PostUiOpenwindowNewmailNewMail) MarshalJSON() ([]byte, error) {
   211  	w := jwriter.Writer{}
   212  	easyjson6b8ca5bfEncodeGithubComAntihaxGoesiEsi1(&w, v)
   213  	return w.Buffer.BuildBytes(), w.Error
   214  }
   215  
   216  // MarshalEasyJSON supports easyjson.Marshaler interface
   217  func (v PostUiOpenwindowNewmailNewMail) MarshalEasyJSON(w *jwriter.Writer) {
   218  	easyjson6b8ca5bfEncodeGithubComAntihaxGoesiEsi1(w, v)
   219  }
   220  
   221  // UnmarshalJSON supports json.Unmarshaler interface
   222  func (v *PostUiOpenwindowNewmailNewMail) UnmarshalJSON(data []byte) error {
   223  	r := jlexer.Lexer{Data: data}
   224  	easyjson6b8ca5bfDecodeGithubComAntihaxGoesiEsi1(&r, v)
   225  	return r.Error()
   226  }
   227  
   228  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   229  func (v *PostUiOpenwindowNewmailNewMail) UnmarshalEasyJSON(l *jlexer.Lexer) {
   230  	easyjson6b8ca5bfDecodeGithubComAntihaxGoesiEsi1(l, v)
   231  }