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