Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

6.5 KB
Raw Blame
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.

package events

import (
	json "encoding/json"
	easyjson "github.com/mailru/easyjson"
	jlexer "github.com/mailru/easyjson/jlexer"
	jwriter "github.com/mailru/easyjson/jwriter"
)

// suppress unused package warning
var (
	_ *json.RawMessage
	_ *jlexer.Lexer
	_ *jwriter.Writer
	_ easyjson.Marshaler
)

func easyjson4d398eaaDecodeGithubComPosthogPosthogLivestreamEvents(in *jlexer.Lexer, out *ResponsePostHogEvent) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		if isTopLevel {
			in.Consumed()
		}
		in.Skip()
		return
	}
	in.Delim('{')
	for !in.IsDelim('}') {
		key := in.UnsafeFieldName(false)
		in.WantColon()
		if in.IsNull() {
			in.Skip()
			in.WantComma()
			continue
		}
		switch key {
		case "uuid":
			out.Uuid = string(in.String())
		case "timestamp":
			if m, ok := out.Timestamp.(easyjson.Unmarshaler); ok {
				m.UnmarshalEasyJSON(in)
			} else if m, ok := out.Timestamp.(json.Unmarshaler); ok {
				_ = m.UnmarshalJSON(in.Raw())
			} else {
				out.Timestamp = in.Interface()
			}
		case "distinct_id":
			out.DistinctId = string(in.String())
		case "person_id":
			out.PersonId = string(in.String())
		case "event":
			out.Event = string(in.String())
		case "properties":
			if in.IsNull() {
				in.Skip()
			} else {
				in.Delim('{')
				out.Properties = make(map[string]interface{})
				for !in.IsDelim('}') {
					key := string(in.String())
					in.WantColon()
					var v1 interface{}
					if m, ok := v1.(easyjson.Unmarshaler); ok {
						m.UnmarshalEasyJSON(in)
					} else if m, ok := v1.(json.Unmarshaler); ok {
						_ = m.UnmarshalJSON(in.Raw())
					} else {
						v1 = in.Interface()
					}
					(out.Properties)[key] = v1
					in.WantComma()
				}
				in.Delim('}')
			}
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjson4d398eaaEncodeGithubComPosthogPosthogLivestreamEvents(out *jwriter.Writer, in ResponsePostHogEvent) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"uuid\":"
		out.RawString(prefix[1:])
		out.String(string(in.Uuid))
	}
	{
		const prefix string = ",\"timestamp\":"
		out.RawString(prefix)
		if m, ok := in.Timestamp.(easyjson.Marshaler); ok {
			m.MarshalEasyJSON(out)
		} else if m, ok := in.Timestamp.(json.Marshaler); ok {
			out.Raw(m.MarshalJSON())
		} else {
			out.Raw(json.Marshal(in.Timestamp))
		}
	}
	{
		const prefix string = ",\"distinct_id\":"
		out.RawString(prefix)
		out.String(string(in.DistinctId))
	}
	{
		const prefix string = ",\"person_id\":"
		out.RawString(prefix)
		out.String(string(in.PersonId))
	}
	{
		const prefix string = ",\"event\":"
		out.RawString(prefix)
		out.String(string(in.Event))
	}
	{
		const prefix string = ",\"properties\":"
		out.RawString(prefix)
		if in.Properties == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
			out.RawString(`null`)
		} else {
			out.RawByte('{')
			v2First := true
			for v2Name, v2Value := range in.Properties {
				if v2First {
					v2First = false
				} else {
					out.RawByte(',')
				}
				out.String(string(v2Name))
				out.RawByte(':')
				if m, ok := v2Value.(easyjson.Marshaler); ok {
					m.MarshalEasyJSON(out)
				} else if m, ok := v2Value.(json.Marshaler); ok {
					out.Raw(m.MarshalJSON())
				} else {
					out.Raw(json.Marshal(v2Value))
				}
			}
			out.RawByte('}')
		}
	}
	out.RawByte('}')
}

// MarshalJSON supports json.Marshaler interface
func (v ResponsePostHogEvent) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjson4d398eaaEncodeGithubComPosthogPosthogLivestreamEvents(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}

// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ResponsePostHogEvent) MarshalEasyJSON(w *jwriter.Writer) {
	easyjson4d398eaaEncodeGithubComPosthogPosthogLivestreamEvents(w, v)
}

// UnmarshalJSON supports json.Unmarshaler interface
func (v *ResponsePostHogEvent) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjson4d398eaaDecodeGithubComPosthogPosthogLivestreamEvents(&r, v)
	return r.Error()
}

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ResponsePostHogEvent) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjson4d398eaaDecodeGithubComPosthogPosthogLivestreamEvents(l, v)
}
func easyjson4d398eaaDecodeGithubComPosthogPosthogLivestreamEvents1(in *jlexer.Lexer, out *ResponseGeoEvent) {
	isTopLevel := in.IsStart()
	if in.IsNull() {
		if isTopLevel {
			in.Consumed()
		}
		in.Skip()
		return
	}
	in.Delim('{')
	for !in.IsDelim('}') {
		key := in.UnsafeFieldName(false)
		in.WantColon()
		if in.IsNull() {
			in.Skip()
			in.WantComma()
			continue
		}
		switch key {
		case "lat":
			out.Lat = float64(in.Float64())
		case "lng":
			out.Lng = float64(in.Float64())
		case "country_code":
			out.CountryCode = string(in.String())
		case "distinct_id":
			out.DistinctId = string(in.String())
		case "count":
			out.Count = uint(in.Uint())
		default:
			in.SkipRecursive()
		}
		in.WantComma()
	}
	in.Delim('}')
	if isTopLevel {
		in.Consumed()
	}
}
func easyjson4d398eaaEncodeGithubComPosthogPosthogLivestreamEvents1(out *jwriter.Writer, in ResponseGeoEvent) {
	out.RawByte('{')
	first := true
	_ = first
	{
		const prefix string = ",\"lat\":"
		out.RawString(prefix[1:])
		out.Float64(float64(in.Lat))
	}
	{
		const prefix string = ",\"lng\":"
		out.RawString(prefix)
		out.Float64(float64(in.Lng))
	}
	{
		const prefix string = ",\"country_code\":"
		out.RawString(prefix)
		out.String(string(in.CountryCode))
	}
	{
		const prefix string = ",\"distinct_id\":"
		out.RawString(prefix)
		out.String(string(in.DistinctId))
	}
	{
		const prefix string = ",\"count\":"
		out.RawString(prefix)
		out.Uint(uint(in.Count))
	}
	out.RawByte('}')
}

// MarshalJSON supports json.Marshaler interface
func (v ResponseGeoEvent) MarshalJSON() ([]byte, error) {
	w := jwriter.Writer{}
	easyjson4d398eaaEncodeGithubComPosthogPosthogLivestreamEvents1(&w, v)
	return w.Buffer.BuildBytes(), w.Error
}

// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ResponseGeoEvent) MarshalEasyJSON(w *jwriter.Writer) {
	easyjson4d398eaaEncodeGithubComPosthogPosthogLivestreamEvents1(w, v)
}

// UnmarshalJSON supports json.Unmarshaler interface
func (v *ResponseGeoEvent) UnmarshalJSON(data []byte) error {
	r := jlexer.Lexer{Data: data}
	easyjson4d398eaaDecodeGithubComPosthogPosthogLivestreamEvents1(&r, v)
	return r.Error()
}

// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ResponseGeoEvent) UnmarshalEasyJSON(l *jlexer.Lexer) {
	easyjson4d398eaaDecodeGithubComPosthogPosthogLivestreamEvents1(l, v)
}