github.com/antihax/goesi@v0.0.0-20240126031043-6c54d0cb7f95/esi/model_get_fleets_fleet_id_members_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 easyjson3a1ded9fDecodeGithubComAntihaxGoesiEsi(in *jlexer.Lexer, out *GetFleetsFleetIdMembers200OkList) {
    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(GetFleetsFleetIdMembers200OkList, 0, 0)
    31  			} else {
    32  				*out = GetFleetsFleetIdMembers200OkList{}
    33  			}
    34  		} else {
    35  			*out = (*out)[:0]
    36  		}
    37  		for !in.IsDelim(']') {
    38  			var v1 GetFleetsFleetIdMembers200Ok
    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 easyjson3a1ded9fEncodeGithubComAntihaxGoesiEsi(out *jwriter.Writer, in GetFleetsFleetIdMembers200OkList) {
    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 GetFleetsFleetIdMembers200OkList) MarshalJSON() ([]byte, error) {
    66  	w := jwriter.Writer{}
    67  	easyjson3a1ded9fEncodeGithubComAntihaxGoesiEsi(&w, v)
    68  	return w.Buffer.BuildBytes(), w.Error
    69  }
    70  
    71  // MarshalEasyJSON supports easyjson.Marshaler interface
    72  func (v GetFleetsFleetIdMembers200OkList) MarshalEasyJSON(w *jwriter.Writer) {
    73  	easyjson3a1ded9fEncodeGithubComAntihaxGoesiEsi(w, v)
    74  }
    75  
    76  // UnmarshalJSON supports json.Unmarshaler interface
    77  func (v *GetFleetsFleetIdMembers200OkList) UnmarshalJSON(data []byte) error {
    78  	r := jlexer.Lexer{Data: data}
    79  	easyjson3a1ded9fDecodeGithubComAntihaxGoesiEsi(&r, v)
    80  	return r.Error()
    81  }
    82  
    83  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
    84  func (v *GetFleetsFleetIdMembers200OkList) UnmarshalEasyJSON(l *jlexer.Lexer) {
    85  	easyjson3a1ded9fDecodeGithubComAntihaxGoesiEsi(l, v)
    86  }
    87  func easyjson3a1ded9fDecodeGithubComAntihaxGoesiEsi1(in *jlexer.Lexer, out *GetFleetsFleetIdMembers200Ok) {
    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 "character_id":
   107  			out.CharacterId = int32(in.Int32())
   108  		case "join_time":
   109  			if data := in.Raw(); in.Ok() {
   110  				in.AddError((out.JoinTime).UnmarshalJSON(data))
   111  			}
   112  		case "role":
   113  			out.Role = string(in.String())
   114  		case "role_name":
   115  			out.RoleName = string(in.String())
   116  		case "ship_type_id":
   117  			out.ShipTypeId = int32(in.Int32())
   118  		case "solar_system_id":
   119  			out.SolarSystemId = int32(in.Int32())
   120  		case "squad_id":
   121  			out.SquadId = int64(in.Int64())
   122  		case "station_id":
   123  			out.StationId = int64(in.Int64())
   124  		case "takes_fleet_warp":
   125  			out.TakesFleetWarp = bool(in.Bool())
   126  		case "wing_id":
   127  			out.WingId = int64(in.Int64())
   128  		default:
   129  			in.SkipRecursive()
   130  		}
   131  		in.WantComma()
   132  	}
   133  	in.Delim('}')
   134  	if isTopLevel {
   135  		in.Consumed()
   136  	}
   137  }
   138  func easyjson3a1ded9fEncodeGithubComAntihaxGoesiEsi1(out *jwriter.Writer, in GetFleetsFleetIdMembers200Ok) {
   139  	out.RawByte('{')
   140  	first := true
   141  	_ = first
   142  	if in.CharacterId != 0 {
   143  		const prefix string = ",\"character_id\":"
   144  		first = false
   145  		out.RawString(prefix[1:])
   146  		out.Int32(int32(in.CharacterId))
   147  	}
   148  	if true {
   149  		const prefix string = ",\"join_time\":"
   150  		if first {
   151  			first = false
   152  			out.RawString(prefix[1:])
   153  		} else {
   154  			out.RawString(prefix)
   155  		}
   156  		out.Raw((in.JoinTime).MarshalJSON())
   157  	}
   158  	if in.Role != "" {
   159  		const prefix string = ",\"role\":"
   160  		if first {
   161  			first = false
   162  			out.RawString(prefix[1:])
   163  		} else {
   164  			out.RawString(prefix)
   165  		}
   166  		out.String(string(in.Role))
   167  	}
   168  	if in.RoleName != "" {
   169  		const prefix string = ",\"role_name\":"
   170  		if first {
   171  			first = false
   172  			out.RawString(prefix[1:])
   173  		} else {
   174  			out.RawString(prefix)
   175  		}
   176  		out.String(string(in.RoleName))
   177  	}
   178  	if in.ShipTypeId != 0 {
   179  		const prefix string = ",\"ship_type_id\":"
   180  		if first {
   181  			first = false
   182  			out.RawString(prefix[1:])
   183  		} else {
   184  			out.RawString(prefix)
   185  		}
   186  		out.Int32(int32(in.ShipTypeId))
   187  	}
   188  	if in.SolarSystemId != 0 {
   189  		const prefix string = ",\"solar_system_id\":"
   190  		if first {
   191  			first = false
   192  			out.RawString(prefix[1:])
   193  		} else {
   194  			out.RawString(prefix)
   195  		}
   196  		out.Int32(int32(in.SolarSystemId))
   197  	}
   198  	if in.SquadId != 0 {
   199  		const prefix string = ",\"squad_id\":"
   200  		if first {
   201  			first = false
   202  			out.RawString(prefix[1:])
   203  		} else {
   204  			out.RawString(prefix)
   205  		}
   206  		out.Int64(int64(in.SquadId))
   207  	}
   208  	if in.StationId != 0 {
   209  		const prefix string = ",\"station_id\":"
   210  		if first {
   211  			first = false
   212  			out.RawString(prefix[1:])
   213  		} else {
   214  			out.RawString(prefix)
   215  		}
   216  		out.Int64(int64(in.StationId))
   217  	}
   218  	if in.TakesFleetWarp {
   219  		const prefix string = ",\"takes_fleet_warp\":"
   220  		if first {
   221  			first = false
   222  			out.RawString(prefix[1:])
   223  		} else {
   224  			out.RawString(prefix)
   225  		}
   226  		out.Bool(bool(in.TakesFleetWarp))
   227  	}
   228  	if in.WingId != 0 {
   229  		const prefix string = ",\"wing_id\":"
   230  		if first {
   231  			first = false
   232  			out.RawString(prefix[1:])
   233  		} else {
   234  			out.RawString(prefix)
   235  		}
   236  		out.Int64(int64(in.WingId))
   237  	}
   238  	out.RawByte('}')
   239  }
   240  
   241  // MarshalJSON supports json.Marshaler interface
   242  func (v GetFleetsFleetIdMembers200Ok) MarshalJSON() ([]byte, error) {
   243  	w := jwriter.Writer{}
   244  	easyjson3a1ded9fEncodeGithubComAntihaxGoesiEsi1(&w, v)
   245  	return w.Buffer.BuildBytes(), w.Error
   246  }
   247  
   248  // MarshalEasyJSON supports easyjson.Marshaler interface
   249  func (v GetFleetsFleetIdMembers200Ok) MarshalEasyJSON(w *jwriter.Writer) {
   250  	easyjson3a1ded9fEncodeGithubComAntihaxGoesiEsi1(w, v)
   251  }
   252  
   253  // UnmarshalJSON supports json.Unmarshaler interface
   254  func (v *GetFleetsFleetIdMembers200Ok) UnmarshalJSON(data []byte) error {
   255  	r := jlexer.Lexer{Data: data}
   256  	easyjson3a1ded9fDecodeGithubComAntihaxGoesiEsi1(&r, v)
   257  	return r.Error()
   258  }
   259  
   260  // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
   261  func (v *GetFleetsFleetIdMembers200Ok) UnmarshalEasyJSON(l *jlexer.Lexer) {
   262  	easyjson3a1ded9fDecodeGithubComAntihaxGoesiEsi1(l, v)
   263  }