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