From 426894e4dccb32c5e24cac4285b2c0970c0691be Mon Sep 17 00:00:00 2001 From: xiaopeng0216 Date: Wed, 26 May 2021 18:41:22 +0800 Subject: [PATCH 1/5] fix(openrtb): convert extension type from interface to json raw message --- go.mod | 1 + go.sum | 3 + openrtb/application.go | 10 +- openrtb/application_easyjson.go | 90 ++----- openrtb/audio.go | 5 +- openrtb/audio_easyjson.go | 54 +--- openrtb/banner.go | 9 +- openrtb/banner_easyjson.go | 36 +-- openrtb/bidrequest.go | 5 +- openrtb/bidrequest_easyjson.go | 252 ++++-------------- openrtb/content.go | 10 +- openrtb/content_easyjson.go | 72 ++--- openrtb/data.go | 10 +- openrtb/data_easyjson.go | 36 +-- openrtb/deal.go | 5 +- openrtb/deal_easyjson.go | 18 +- openrtb/device.go | 12 +- openrtb/device_easyjson.go | 36 +-- openrtb/format.go | 10 +- openrtb/format_easyjson.go | 18 +- openrtb/geo.go | 10 +- openrtb/geo_easyjson.go | 18 +- openrtb/impression.go | 10 +- openrtb/impression_easyjson.go | 72 ++--- openrtb/metric.go | 5 +- openrtb/metric_easyjson.go | 18 +- openrtb/metric_test.go | 3 +- openrtb/native.go | 5 +- openrtb/native/request/asset.go | 4 +- openrtb/native/request/asset_easyjson.go | 90 ++----- openrtb/native/request/data.go | 8 +- openrtb/native/request/data_easyjson.go | 18 +- openrtb/native/request/eventtracker.go | 8 +- .../native/request/eventtracker_easyjson.go | 18 +- openrtb/native/request/image.go | 8 +- openrtb/native/request/image_easyjson.go | 18 +- openrtb/native/request/request.go | 8 +- openrtb/native/request/request_easyjson.go | 18 +- openrtb/native/request/title.go | 4 +- openrtb/native/request/title_easyjson.go | 18 +- openrtb/native/request/video.go | 8 +- openrtb/native/request/video_easyjson.go | 18 +- openrtb/native/response/asset.go | 4 +- openrtb/native/response/asset_easyjson.go | 90 ++----- openrtb/native/response/data.go | 8 +- openrtb/native/response/data_easyjson.go | 18 +- openrtb/native/response/eventtracker.go | 2 +- .../native/response/eventtracker_easyjson.go | 18 +- openrtb/native/response/image.go | 8 +- openrtb/native/response/image_easyjson.go | 18 +- openrtb/native/response/link.go | 4 +- openrtb/native/response/link_easyjson.go | 18 +- openrtb/native/response/response.go | 4 +- openrtb/native/response/response_easyjson.go | 18 +- openrtb/native/response/title.go | 4 +- openrtb/native/response/title_easyjson.go | 18 +- openrtb/native_easyjson.go | 18 +- openrtb/openrtbtest/testutil.go | 17 +- openrtb/openrtbutil/request_test.go | 16 -- openrtb/producer.go | 10 +- openrtb/producer_easyjson.go | 18 +- openrtb/segment.go | 10 +- openrtb/segment_easyjson.go | 18 +- openrtb/site.go | 10 +- openrtb/site_easyjson.go | 18 +- openrtb/source.go | 10 +- openrtb/testdata/bidrequest.json | 21 +- openrtb/user.go | 2 +- openrtb/video.go | 5 +- openrtb/video_easyjson.go | 18 +- 70 files changed, 450 insertions(+), 1052 deletions(-) diff --git a/go.mod b/go.mod index 50b7610..586da5b 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.12 require ( github.com/go-test/deep v1.0.4 + github.com/google/go-cmp v0.5.6 github.com/mailru/easyjson v0.7.1 golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 // indirect ) diff --git a/go.sum b/go.sum index 0ca811a..146dc48 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ github.com/go-test/deep v1.0.4 h1:u2CU3YKy9I2pmu9pX0eq50wCgjfGIt539SqR7FbHiho= github.com/go-test/deep v1.0.4/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/mailru/easyjson v0.7.1 h1:mdxE1MF9o53iCb2Ghj1VfWvh7ZOwHpnVG/xwXrV90U8= github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -18,3 +20,4 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7 h1:EBZoQjiKKPaLbPrbpssUfuHtwM6KV/vb4U85g/cigFY= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/openrtb/application.go b/openrtb/application.go index 6d67dd3..fb337e9 100644 --- a/openrtb/application.go +++ b/openrtb/application.go @@ -1,6 +1,10 @@ package openrtb -import "github.com/Vungle/vungo/internal/util" +import ( + "encoding/json" + + "github.com/Vungle/vungo/internal/util" +) // Application object should be included if the ad supported content is a // non-browser application (typically in mobile) as opposed to a website. @@ -134,7 +138,7 @@ type Application struct { // object // Description: // Placeholder for exchange-specific extensions to OpenRTB. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } // Validate method checks to see if the Application object contains required and well-formatted data @@ -171,7 +175,7 @@ func (a *Application) Copy() *Application { appCopy.Publisher = a.Publisher.Copy() appCopy.Content = a.Content.Copy() - appCopy.Extension = util.DeepCopyCopiable(a.Extension) + appCopy.Extension = util.DeepCopyJSONRawMsg(a.Extension) return &appCopy } diff --git a/openrtb/application_easyjson.go b/openrtb/application_easyjson.go index 1b3fff5..538f1ac 100644 --- a/openrtb/application_easyjson.go +++ b/openrtb/application_easyjson.go @@ -148,12 +148,8 @@ func easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Ap case "keywords": out.Keywords = string(in.String()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -332,7 +328,7 @@ func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in A } out.String(string(in.Keywords)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -340,13 +336,7 @@ func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in A } else { out.RawString(prefix) } - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -548,12 +538,8 @@ func easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb2(in *jlexer.Lexer, out *C in.Delim(']') } case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -837,7 +823,7 @@ func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb2(out *jwriter.Writer, in out.RawByte(']') } } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -845,13 +831,7 @@ func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb2(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } @@ -910,12 +890,8 @@ func easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb4(in *jlexer.Lexer, out *D in.Delim(']') } case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -970,7 +946,7 @@ func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb4(out *jwriter.Writer, in out.RawByte(']') } } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -978,13 +954,7 @@ func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb4(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } @@ -1014,12 +984,8 @@ func easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb5(in *jlexer.Lexer, out *S case "value": out.Value = string(in.String()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -1061,7 +1027,7 @@ func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb5(out *jwriter.Writer, in } out.String(string(in.Value)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -1069,13 +1035,7 @@ func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb5(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } @@ -1128,12 +1088,8 @@ func easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb3(in *jlexer.Lexer, out *P case "domain": out.Domain = string(in.String()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -1194,7 +1150,7 @@ func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb3(out *jwriter.Writer, in } out.String(string(in.Domain)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -1202,13 +1158,7 @@ func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb3(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/audio.go b/openrtb/audio.go index cc39a5e..14a88d8 100644 --- a/openrtb/audio.go +++ b/openrtb/audio.go @@ -1,6 +1,7 @@ package openrtb import ( + "encoding/json" "errors" "github.com/Vungle/vungo/internal/util" @@ -185,7 +186,7 @@ type Audio struct { // object // Description: // Placeholder for exchange-specific extensions to OpenRTB. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } // Validate method implements a Validater interface and return a validation error according to the @@ -249,7 +250,7 @@ func (a *Audio) Copy() *Audio { copy(vCopy.CompanionTypes, a.CompanionTypes) } - vCopy.Extension = util.DeepCopyCopiable(a.Extension) + vCopy.Extension = util.DeepCopyJSONRawMsg(a.Extension) return &vCopy } diff --git a/openrtb/audio_easyjson.go b/openrtb/audio_easyjson.go index 45334ed..2158832 100644 --- a/openrtb/audio_easyjson.go +++ b/openrtb/audio_easyjson.go @@ -246,12 +246,8 @@ func easyjson48f1e884DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Au case "nvol": out.NormalizedVolume = VolumeNormalizationMode(in.Int()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -422,16 +418,10 @@ func easyjson48f1e884EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in A out.RawString(prefix) out.Int(int(in.NormalizedVolume)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -685,12 +675,8 @@ func easyjson48f1e884DecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *B case "vcm": out.VCM = CompanionRenderingMode(in.Int()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -916,7 +902,7 @@ func easyjson48f1e884EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in } out.Int(int(in.VCM)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -924,13 +910,7 @@ func easyjson48f1e884EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -964,12 +944,8 @@ func easyjson48f1e884DecodeGithubComVungleVungoOpenrtb2(in *jlexer.Lexer, out *F case "wmin": out.WMin = uint64(in.Uint64()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -1031,7 +1007,7 @@ func easyjson48f1e884EncodeGithubComVungleVungoOpenrtb2(out *jwriter.Writer, in } out.Uint64(uint64(in.WMin)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -1039,13 +1015,7 @@ func easyjson48f1e884EncodeGithubComVungleVungoOpenrtb2(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/banner.go b/openrtb/banner.go index aeacca2..c62ebd1 100644 --- a/openrtb/banner.go +++ b/openrtb/banner.go @@ -1,6 +1,7 @@ package openrtb import ( + "encoding/json" "errors" "github.com/Vungle/vungo/internal/util" @@ -179,7 +180,7 @@ type Banner struct { // object // Description: // Placeholder for exchange-specific extensions to OpenRTB. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } // Validate method implements a Validater interface and return a validation error according to the @@ -213,10 +214,12 @@ func (v *Banner) Copy() *Banner { if v.Format != nil { vCopy.Format = make([]Format, len(v.Format)) - copy(vCopy.Format, v.Format) + for i, format := range v.Format { + vCopy.Format[i] = *format.Copy() + } } - vCopy.Extension = util.DeepCopyCopiable(v.Extension) + vCopy.Extension = util.DeepCopyJSONRawMsg(v.Extension) return &vCopy } diff --git a/openrtb/banner_easyjson.go b/openrtb/banner_easyjson.go index 7cb01ca..f836c0d 100644 --- a/openrtb/banner_easyjson.go +++ b/openrtb/banner_easyjson.go @@ -243,12 +243,8 @@ func easyjsonC16456caDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Ba case "vcm": out.VCM = CompanionRenderingMode(in.Int()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -474,7 +470,7 @@ func easyjsonC16456caEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in B } out.Int(int(in.VCM)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -482,13 +478,7 @@ func easyjsonC16456caEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in B } else { out.RawString(prefix) } - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -546,12 +536,8 @@ func easyjsonC16456caDecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *F case "wmin": out.WMin = uint64(in.Uint64()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -613,7 +599,7 @@ func easyjsonC16456caEncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in } out.Uint64(uint64(in.WMin)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -621,13 +607,7 @@ func easyjsonC16456caEncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/bidrequest.go b/openrtb/bidrequest.go index 56ee724..7c18785 100644 --- a/openrtb/bidrequest.go +++ b/openrtb/bidrequest.go @@ -1,6 +1,7 @@ package openrtb import ( + "encoding/json" "fmt" "github.com/Vungle/vungo/internal/util" @@ -218,7 +219,7 @@ type BidRequest struct { // object // Description: // Placeholder for exchange-specific extensions to OpenRTB. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } // Validate method checks to see if the BidRequest object contains required and well-formatted data @@ -285,6 +286,6 @@ func (r *BidRequest) Copy() *BidRequest { brCopy.BlockedAdvertisersByMarketID = util.DeepCopyStrSlice(r.BlockedAdvertisersByMarketID) brCopy.Regulation = r.Regulation.Copy() brCopy.Source = r.Source.Copy() - brCopy.Extension = util.DeepCopyCopiable(r.Extension) + brCopy.Extension = util.DeepCopyJSONRawMsg(r.Extension) return &brCopy } diff --git a/openrtb/bidrequest_easyjson.go b/openrtb/bidrequest_easyjson.go index fb2778d..460b132 100644 --- a/openrtb/bidrequest_easyjson.go +++ b/openrtb/bidrequest_easyjson.go @@ -303,12 +303,8 @@ func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Bi easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb6(in, out.Regulation) } case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -497,16 +493,10 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in B out.RawString(prefix) easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb6(out, *in.Regulation) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -637,12 +627,8 @@ func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb5(in *jlexer.Lexer, out *S case "pchain": out.PChain = string(in.String()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -684,7 +670,7 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb5(out *jwriter.Writer, in } out.String(string(in.PChain)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -692,13 +678,7 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb5(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } @@ -946,12 +926,8 @@ func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb8(in *jlexer.Lexer, out *D in.Delim(']') } case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -1006,7 +982,7 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb8(out *jwriter.Writer, in out.RawByte(']') } } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -1014,13 +990,7 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb8(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } @@ -1050,12 +1020,8 @@ func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb9(in *jlexer.Lexer, out *S case "value": out.Value = string(in.String()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -1097,7 +1063,7 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb9(out *jwriter.Writer, in } out.String(string(in.Value)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -1105,13 +1071,7 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb9(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } @@ -1161,12 +1121,8 @@ func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb7(in *jlexer.Lexer, out *G case "utcoffset": out.UTCOffset = int(in.Int()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -1308,7 +1264,7 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb7(out *jwriter.Writer, in } out.Int(int(in.UTCOffset)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -1316,13 +1272,7 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb7(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } @@ -1456,12 +1406,8 @@ func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb3(in *jlexer.Lexer, out *D case "macmd5": out.MACMD5 = string(in.String()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -1773,7 +1719,7 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb3(out *jwriter.Writer, in } out.String(string(in.MACMD5)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -1781,13 +1727,7 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb3(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -1938,12 +1878,8 @@ func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb2(in *jlexer.Lexer, out *S case "keywords": out.Keywords = string(in.String()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -2122,7 +2058,7 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb2(out *jwriter.Writer, in } out.String(string(in.Keywords)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -2130,13 +2066,7 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb2(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } @@ -2314,12 +2244,8 @@ func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb11(in *jlexer.Lexer, out * in.Delim(']') } case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -2603,7 +2529,7 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb11(out *jwriter.Writer, in out.RawByte(']') } } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -2611,13 +2537,7 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb11(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } @@ -2670,12 +2590,8 @@ func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb12(in *jlexer.Lexer, out * case "domain": out.Domain = string(in.String()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -2736,7 +2652,7 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb12(out *jwriter.Writer, in } out.String(string(in.Domain)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -2744,13 +2660,7 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb12(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } @@ -3003,12 +2913,8 @@ func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *I case "exp": out.Exp = int(in.Int()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -3131,16 +3037,10 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in out.RawString(prefix) out.Int(int(in.Exp)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -3332,12 +3232,8 @@ func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb17(in *jlexer.Lexer, out * in.Delim(']') } case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -3401,16 +3297,10 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb17(out *jwriter.Writer, in out.RawByte(']') } } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -3484,12 +3374,8 @@ func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb15(in *jlexer.Lexer, out * in.Delim(']') } case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -3543,16 +3429,10 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb15(out *jwriter.Writer, in out.RawByte(']') } } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -3822,12 +3702,8 @@ func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb14(in *jlexer.Lexer, out * in.Delim(']') } case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -4047,16 +3923,10 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb14(out *jwriter.Writer, in out.RawByte(']') } } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -4086,12 +3956,8 @@ func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb13(in *jlexer.Lexer, out * case "vendor": out.Vendor = string(in.String()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -4122,16 +3988,10 @@ func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb13(out *jwriter.Writer, in out.RawString(prefix) out.String(string(in.Vendor)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/content.go b/openrtb/content.go index e0ba44a..4c0fc08 100644 --- a/openrtb/content.go +++ b/openrtb/content.go @@ -1,6 +1,10 @@ package openrtb -import "github.com/Vungle/vungo/internal/util" +import ( + "encoding/json" + + "github.com/Vungle/vungo/internal/util" +) // Content object describes the content in which the impression will appear, // which may be syndicated or nonsyndicated content. @@ -237,7 +241,7 @@ type Content struct { // object // Description: // Placeholder for exchange-specific extensions to OpenRTB. - Ext interface{} `json:"ext,omitempty"` + Ext json.RawMessage `json:"ext,omitempty"` } // Validate method checks to see if the Site object contains required and @@ -267,6 +271,6 @@ func (c *Content) Copy() *Content { cCopy.Data[i] = c.Data[i].Copy() } } - cCopy.Ext = util.DeepCopyCopiable(c.Ext) + cCopy.Ext = util.DeepCopyJSONRawMsg(c.Ext) return &cCopy } diff --git a/openrtb/content_easyjson.go b/openrtb/content_easyjson.go index 9e08eb4..fee277e 100644 --- a/openrtb/content_easyjson.go +++ b/openrtb/content_easyjson.go @@ -191,12 +191,8 @@ func easyjson344736e9DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Co in.Delim(']') } case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -480,7 +476,7 @@ func easyjson344736e9EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in C out.RawByte(']') } } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -488,13 +484,7 @@ func easyjson344736e9EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in C } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } @@ -577,12 +567,8 @@ func easyjson344736e9DecodeGithubComVungleVungoOpenrtb2(in *jlexer.Lexer, out *D in.Delim(']') } case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -637,7 +623,7 @@ func easyjson344736e9EncodeGithubComVungleVungoOpenrtb2(out *jwriter.Writer, in out.RawByte(']') } } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -645,13 +631,7 @@ func easyjson344736e9EncodeGithubComVungleVungoOpenrtb2(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } @@ -681,12 +661,8 @@ func easyjson344736e9DecodeGithubComVungleVungoOpenrtb3(in *jlexer.Lexer, out *S case "value": out.Value = string(in.String()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -728,7 +704,7 @@ func easyjson344736e9EncodeGithubComVungleVungoOpenrtb3(out *jwriter.Writer, in } out.String(string(in.Value)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -736,13 +712,7 @@ func easyjson344736e9EncodeGithubComVungleVungoOpenrtb3(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } @@ -795,12 +765,8 @@ func easyjson344736e9DecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *P case "domain": out.Domain = string(in.String()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -861,7 +827,7 @@ func easyjson344736e9EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in } out.String(string(in.Domain)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -869,13 +835,7 @@ func easyjson344736e9EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/data.go b/openrtb/data.go index 3f7b27b..1f504c3 100644 --- a/openrtb/data.go +++ b/openrtb/data.go @@ -1,6 +1,10 @@ package openrtb -import "github.com/Vungle/vungo/internal/util" +import ( + "encoding/json" + + "github.com/Vungle/vungo/internal/util" +) // Data object // The data and segment objects together allow additional data about the related @@ -46,7 +50,7 @@ type Data struct { // object // Description: // Placeholder for exchange-specific extensions to OpenRTB. - Ext interface{} `json:"ext,omitempty"` + Ext json.RawMessage `json:"ext,omitempty"` } // Validate method checks to see if the Site object contains required and @@ -69,6 +73,6 @@ func (d *Data) Copy() *Data { dCopy.Segment[i] = d.Segment[i].Copy() } } - dCopy.Ext = util.DeepCopyCopiable(d.Ext) + dCopy.Ext = util.DeepCopyJSONRawMsg(d.Ext) return &dCopy } diff --git a/openrtb/data_easyjson.go b/openrtb/data_easyjson.go index 1ff064c..55f90e4 100644 --- a/openrtb/data_easyjson.go +++ b/openrtb/data_easyjson.go @@ -72,12 +72,8 @@ func easyjson794297d0DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Da in.Delim(']') } case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -132,7 +128,7 @@ func easyjson794297d0EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in D out.RawByte(']') } } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -140,13 +136,7 @@ func easyjson794297d0EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in D } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } @@ -200,12 +190,8 @@ func easyjson794297d0DecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *S case "value": out.Value = string(in.String()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -247,7 +233,7 @@ func easyjson794297d0EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in } out.String(string(in.Value)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -255,13 +241,7 @@ func easyjson794297d0EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/deal.go b/openrtb/deal.go index 9c53356..aa9be5a 100644 --- a/openrtb/deal.go +++ b/openrtb/deal.go @@ -1,6 +1,7 @@ package openrtb import ( + "encoding/json" "errors" "github.com/Vungle/vungo/internal/util" @@ -75,7 +76,7 @@ type Deal struct { // object // Description: // Placeholder for exchange-specific extensions to OpenRTB. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } // Validate method implements a Validater interface and return a validation error according to the @@ -97,7 +98,7 @@ func (d *Deal) Copy() *Deal { dealCopy := *d dealCopy.WhitelistedSeats = util.DeepCopyStrSlice(d.WhitelistedSeats) dealCopy.AdvertiserDomains = util.DeepCopyStrSlice(d.AdvertiserDomains) - dealCopy.Extension = util.DeepCopyCopiable(d.Extension) + dealCopy.Extension = util.DeepCopyJSONRawMsg(d.Extension) return &dealCopy } diff --git a/openrtb/deal_easyjson.go b/openrtb/deal_easyjson.go index 849eb8d..4265e08 100644 --- a/openrtb/deal_easyjson.go +++ b/openrtb/deal_easyjson.go @@ -91,12 +91,8 @@ func easyjson8a221a72DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *De in.Delim(']') } case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -160,16 +156,10 @@ func easyjson8a221a72EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in D out.RawByte(']') } } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/device.go b/openrtb/device.go index 5b8e042..9d396ac 100644 --- a/openrtb/device.go +++ b/openrtb/device.go @@ -1,6 +1,10 @@ package openrtb -import "github.com/Vungle/vungo/internal/util" +import ( + "encoding/json" + + "github.com/Vungle/vungo/internal/util" +) // Device object provides information pertaining to the device through which the // user is interacting. @@ -267,7 +271,7 @@ type Device struct { // object // Description: // Placeholder for exchange-specific extensions to OpenRTB. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } // Copy do deep copy of Device. @@ -280,7 +284,7 @@ func (d *Device) Copy() *Device { deviceCopy := *d if d.Geo != nil { - geoCopy := *d.Geo + geoCopy := *d.Geo.Copy() deviceCopy.Geo = &geoCopy } @@ -299,7 +303,7 @@ func (d *Device) Copy() *Device { deviceCopy.SupportsJavaScript = &SupportsJavaScriptCopy } deviceCopy.GeoFetch = d.GeoFetch.Copy() - deviceCopy.Extension = util.DeepCopyCopiable(d.Extension) + deviceCopy.Extension = util.DeepCopyJSONRawMsg(d.Extension) return &deviceCopy } diff --git a/openrtb/device_easyjson.go b/openrtb/device_easyjson.go index cbc5639..cf1b833 100644 --- a/openrtb/device_easyjson.go +++ b/openrtb/device_easyjson.go @@ -147,12 +147,8 @@ func easyjson3073ac56DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *De case "macmd5": out.MACMD5 = string(in.String()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -464,7 +460,7 @@ func easyjson3073ac56EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in D } out.String(string(in.MACMD5)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -472,13 +468,7 @@ func easyjson3073ac56EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in D } else { out.RawString(prefix) } - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -552,12 +542,8 @@ func easyjson3073ac56DecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *G case "utcoffset": out.UTCOffset = int(in.Int()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -699,7 +685,7 @@ func easyjson3073ac56EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in } out.Int(int(in.UTCOffset)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -707,13 +693,7 @@ func easyjson3073ac56EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/format.go b/openrtb/format.go index c96206d..71aa62f 100644 --- a/openrtb/format.go +++ b/openrtb/format.go @@ -1,6 +1,10 @@ package openrtb -import "github.com/Vungle/vungo/internal/util" +import ( + "encoding/json" + + "github.com/Vungle/vungo/internal/util" +) // Format object represents an allowed size (i.e., height and width combination) or Flex Ad parameters for a banner impression. // These are typically used in an array where multiple sizes are permitted. @@ -56,7 +60,7 @@ type Format struct { // object // Description: // Placeholder for exchange-specific extensions to OpenRTB. - Ext interface{} `json:"ext,omitempty"` + Ext json.RawMessage `json:"ext,omitempty"` } // Copy do deep copy of Format. @@ -67,6 +71,6 @@ func (f *Format) Copy() *Format { return nil } fCopy := *f - fCopy.Ext = util.DeepCopyCopiable(f.Ext) + fCopy.Ext = util.DeepCopyJSONRawMsg(f.Ext) return &fCopy } diff --git a/openrtb/format_easyjson.go b/openrtb/format_easyjson.go index 16597e0..377c08c 100644 --- a/openrtb/format_easyjson.go +++ b/openrtb/format_easyjson.go @@ -47,12 +47,8 @@ func easyjson72863a49DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Fo case "wmin": out.WMin = uint64(in.Uint64()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -114,7 +110,7 @@ func easyjson72863a49EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in F } out.Uint64(uint64(in.WMin)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -122,13 +118,7 @@ func easyjson72863a49EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in F } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/geo.go b/openrtb/geo.go index 27dcd10..520833a 100644 --- a/openrtb/geo.go +++ b/openrtb/geo.go @@ -1,6 +1,10 @@ package openrtb -import "github.com/Vungle/vungo/internal/util" +import ( + "encoding/json" + + "github.com/Vungle/vungo/internal/util" +) // Geo object encapsulates various methods for specifying a geographic location. // When subordinate to a Device object, it indicates the location of the device @@ -138,7 +142,7 @@ type Geo struct { // object // Description: // Placeholder for exchange-specific extensions to OpenRTB. - Ext interface{} `json:"ext,omitempty"` + Ext json.RawMessage `json:"ext,omitempty"` } // Copy do deep copy of Geo. @@ -149,6 +153,6 @@ func (g *Geo) Copy() *Geo { return nil } gCopy := *g - gCopy.Ext = util.DeepCopyCopiable(g.Ext) + gCopy.Ext = util.DeepCopyJSONRawMsg(g.Ext) return &gCopy } diff --git a/openrtb/geo_easyjson.go b/openrtb/geo_easyjson.go index 75518af..824c668 100644 --- a/openrtb/geo_easyjson.go +++ b/openrtb/geo_easyjson.go @@ -63,12 +63,8 @@ func easyjsonA0535929DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Ge case "utcoffset": out.UTCOffset = int(in.Int()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -210,7 +206,7 @@ func easyjsonA0535929EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in G } out.Int(int(in.UTCOffset)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -218,13 +214,7 @@ func easyjsonA0535929EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in G } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/impression.go b/openrtb/impression.go index 092bdc7..fa6b4ab 100644 --- a/openrtb/impression.go +++ b/openrtb/impression.go @@ -1,6 +1,10 @@ package openrtb -import "github.com/Vungle/vungo/internal/util" +import ( + "encoding/json" + + "github.com/Vungle/vungo/internal/util" +) // Impression object describes an ad placement or impression being auctioned. // A single bid request can include multiple Imp objects, a use case for which @@ -184,7 +188,7 @@ type Impression struct { // object // Description: // Placeholder for exchange-specific extensions to OpenRTB. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } // Copy returns a pointer to a copy of the Impression object. @@ -210,7 +214,7 @@ func (imp *Impression) Copy() *Impression { } impressionCopy.IframeBuster = util.DeepCopyStrSlice(imp.IframeBuster) - impressionCopy.Extension = util.DeepCopyCopiable(imp.Extension) + impressionCopy.Extension = util.DeepCopyJSONRawMsg(imp.Extension) return &impressionCopy } diff --git a/openrtb/impression_easyjson.go b/openrtb/impression_easyjson.go index 6b3a3be..bce52ba 100644 --- a/openrtb/impression_easyjson.go +++ b/openrtb/impression_easyjson.go @@ -173,12 +173,8 @@ func easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Im case "exp": out.Exp = int(in.Int()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -301,16 +297,10 @@ func easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in I out.RawString(prefix) out.Int(int(in.Exp)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -522,12 +512,8 @@ func easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb3(in *jlexer.Lexer, out *N in.Delim(']') } case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -581,16 +567,10 @@ func easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb3(out *jwriter.Writer, in out.RawByte(']') } } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -860,12 +840,8 @@ func easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb2(in *jlexer.Lexer, out *V in.Delim(']') } case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -1085,16 +1061,10 @@ func easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb2(out *jwriter.Writer, in out.RawByte(']') } } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -1124,12 +1094,8 @@ func easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *M case "vendor": out.Vendor = string(in.String()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -1160,16 +1126,10 @@ func easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in out.RawString(prefix) out.String(string(in.Vendor)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/metric.go b/openrtb/metric.go index e4d73af..f887130 100644 --- a/openrtb/metric.go +++ b/openrtb/metric.go @@ -1,6 +1,7 @@ package openrtb import ( + "encoding/json" "errors" "github.com/Vungle/vungo/internal/util" @@ -46,7 +47,7 @@ type Metric struct { // object // Description: // Placeholder for exchange-specific extensions to OpenRTB. - Ext interface{} `json:"ext,omitempty"` + Ext json.RawMessage `json:"ext,omitempty"` } // Validate method implements a Validater interface and return a validation error according to the @@ -67,6 +68,6 @@ func (m *Metric) Copy() *Metric { return nil } mCopy := *m - mCopy.Ext = util.DeepCopyCopiable(m.Ext) + mCopy.Ext = util.DeepCopyJSONRawMsg(m.Ext) return &mCopy } diff --git a/openrtb/metric_easyjson.go b/openrtb/metric_easyjson.go index d486c9d..f6cd82f 100644 --- a/openrtb/metric_easyjson.go +++ b/openrtb/metric_easyjson.go @@ -43,12 +43,8 @@ func easyjson9478868cDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Me case "vendor": out.Vendor = string(in.String()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -79,16 +75,10 @@ func easyjson9478868cEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in M out.RawString(prefix) out.String(string(in.Vendor)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/metric_test.go b/openrtb/metric_test.go index 606fbf6..06bf0aa 100644 --- a/openrtb/metric_test.go +++ b/openrtb/metric_test.go @@ -1,6 +1,7 @@ package openrtb_test import ( + "encoding/json" "testing" "github.com/Vungle/vungo/openrtb" @@ -26,7 +27,7 @@ func TestMetric_Validate(t *testing.T) { Type string Value float64 Vendor string - Ext interface{} + Ext json.RawMessage } tests := []struct { name string diff --git a/openrtb/native.go b/openrtb/native.go index 06945e6..795190c 100644 --- a/openrtb/native.go +++ b/openrtb/native.go @@ -1,6 +1,7 @@ package openrtb import ( + "encoding/json" "errors" "github.com/Vungle/vungo/internal/util" @@ -62,7 +63,7 @@ type Native struct { // object // Description: // Placeholder for exchange-specific extensions to OpenRTB. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } // Validate method implements a Validater interface and return a validation error according to the @@ -93,7 +94,7 @@ func (n *Native) Copy() *Native { copy(vCopy.APIFrameworks, n.APIFrameworks) } - vCopy.Extension = util.DeepCopyCopiable(n.Extension) + vCopy.Extension = util.DeepCopyJSONRawMsg(n.Extension) return &vCopy } diff --git a/openrtb/native/request/asset.go b/openrtb/native/request/asset.go index 5899120..7212e6d 100644 --- a/openrtb/native/request/asset.go +++ b/openrtb/native/request/asset.go @@ -1,5 +1,7 @@ package request +import "encoding/json" + // Asset Object is the main container object for each asset requested or supported by Exchange on behalf of the rendering client. // Any object that is required is to be flagged as such. // Only one of the {title,img,video,data} objects should be present in each object. @@ -96,5 +98,5 @@ type Asset struct { // Description: // This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility // beyond the standard defined in this specification. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } diff --git a/openrtb/native/request/asset_easyjson.go b/openrtb/native/request/asset_easyjson.go index 5cf3bef..714a8d7 100644 --- a/openrtb/native/request/asset_easyjson.go +++ b/openrtb/native/request/asset_easyjson.go @@ -83,12 +83,8 @@ func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.L easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest4(in, out.Data) } case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -134,16 +130,10 @@ func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter out.RawString(prefix) easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest4(out, *in.Data) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -195,12 +185,8 @@ func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest4(in *jlexer. case "len": out.Len = int64(in.Int64()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -226,16 +212,10 @@ func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest4(out *jwrite out.RawString(prefix) out.Int64(int64(in.Len)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -309,12 +289,8 @@ func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest3(in *jlexer. in.Delim(']') } case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -372,16 +348,10 @@ func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest3(out *jwrite out.RawByte(']') } } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -438,12 +408,8 @@ func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest2(in *jlexer. in.Delim(']') } case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -524,7 +490,7 @@ func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest2(out *jwrite out.RawByte(']') } } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -532,13 +498,7 @@ func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest2(out *jwrite } else { out.RawString(prefix) } - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -564,12 +524,8 @@ func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest1(in *jlexer. case "len": out.Len = int64(in.Int64()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -590,16 +546,10 @@ func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest1(out *jwrite out.RawString(prefix[1:]) out.Int64(int64(in.Len)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/native/request/data.go b/openrtb/native/request/data.go index ac579b9..7daaa7d 100644 --- a/openrtb/native/request/data.go +++ b/openrtb/native/request/data.go @@ -1,6 +1,10 @@ package request -import "github.com/Vungle/vungo/openrtb/native" +import ( + "encoding/json" + + "github.com/Vungle/vungo/openrtb/native" +) // Data Object is to be used for all non-core elements of the native unit such as Brand Name, Ratings, Review Count, Stars, Download count, descriptions etc. // It is also generic for future native elements not contemplated at the time of the writing of this document. @@ -41,5 +45,5 @@ type Data struct { // object // Description: // This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility beyond the standard defined in this specification - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } diff --git a/openrtb/native/request/data_easyjson.go b/openrtb/native/request/data_easyjson.go index e77812f..035a36f 100644 --- a/openrtb/native/request/data_easyjson.go +++ b/openrtb/native/request/data_easyjson.go @@ -42,12 +42,8 @@ func easyjson794297d0DecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.L case "len": out.Len = int64(in.Int64()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -73,16 +69,10 @@ func easyjson794297d0EncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter out.RawString(prefix) out.Int64(int64(in.Len)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/native/request/eventtracker.go b/openrtb/native/request/eventtracker.go index 72919c9..5a5b80f 100644 --- a/openrtb/native/request/eventtracker.go +++ b/openrtb/native/request/eventtracker.go @@ -1,6 +1,10 @@ package request -import "github.com/Vungle/vungo/openrtb/native" +import ( + "encoding/json" + + "github.com/Vungle/vungo/openrtb/native" +) // EventTracker object specifies the types of events the bidder can request to be tracked in the bid response, and which //types of tracking are available for each event type, and is included as an array in the request. @@ -39,5 +43,5 @@ type EventTracker struct { // Description: // This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility // beyond the standard defined in this specification. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } diff --git a/openrtb/native/request/eventtracker_easyjson.go b/openrtb/native/request/eventtracker_easyjson.go index 58b26b6..3cff83d 100644 --- a/openrtb/native/request/eventtracker_easyjson.go +++ b/openrtb/native/request/eventtracker_easyjson.go @@ -63,12 +63,8 @@ func easyjson88abeb4cDecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.L in.Delim(']') } case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -105,16 +101,10 @@ func easyjson88abeb4cEncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter out.RawByte(']') } } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/native/request/image.go b/openrtb/native/request/image.go index 152935d..1633f08 100644 --- a/openrtb/native/request/image.go +++ b/openrtb/native/request/image.go @@ -1,6 +1,10 @@ package request -import "github.com/Vungle/vungo/openrtb/native" +import ( + "encoding/json" + + "github.com/Vungle/vungo/openrtb/native" +) // Image object to be used for all image elements of the Native ad such as Icons, Main Image, etc. // Recommended sizes and aspect ratios are included in the Image Asset Types section. @@ -93,5 +97,5 @@ type Image struct { // Description: // This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility // beyond the standard defined in this specification. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } diff --git a/openrtb/native/request/image_easyjson.go b/openrtb/native/request/image_easyjson.go index a4a6892..93c56ba 100644 --- a/openrtb/native/request/image_easyjson.go +++ b/openrtb/native/request/image_easyjson.go @@ -71,12 +71,8 @@ func easyjson220accf5DecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.L in.Delim(']') } case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -157,7 +153,7 @@ func easyjson220accf5EncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter out.RawByte(']') } } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -165,13 +161,7 @@ func easyjson220accf5EncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter } else { out.RawString(prefix) } - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/native/request/request.go b/openrtb/native/request/request.go index 468e7e4..7fe34b9 100644 --- a/openrtb/native/request/request.go +++ b/openrtb/native/request/request.go @@ -1,6 +1,10 @@ package request -import "github.com/Vungle/vungo/openrtb/native" +import ( + "encoding/json" + + "github.com/Vungle/vungo/openrtb/native" +) // Request Object defines the native advertising opportunity available for bid via this bid // request. It will be included as a JSON-encoded string in the bid request’s imp.native field or as a @@ -156,5 +160,5 @@ type Request struct { // Description: // This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility beyond //the standard defined in this specification - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } diff --git a/openrtb/native/request/request_easyjson.go b/openrtb/native/request/request_easyjson.go index ba56f15..2cec868 100644 --- a/openrtb/native/request/request_easyjson.go +++ b/openrtb/native/request/request_easyjson.go @@ -102,12 +102,8 @@ func easyjson3c9d2b01DecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.L case "privacy": out.Privacy = int8(in.Int8()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -229,16 +225,10 @@ func easyjson3c9d2b01EncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter out.RawString(prefix) out.Int8(int8(in.Privacy)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/native/request/title.go b/openrtb/native/request/title.go index b1466d8..2af805f 100644 --- a/openrtb/native/request/title.go +++ b/openrtb/native/request/title.go @@ -1,5 +1,7 @@ package request +import "encoding/json" + // Title object is to be used for title element of the Native ad. // // See OpenRTB Native 1.2 Sec 4.3 Title Object @@ -26,5 +28,5 @@ type Title struct { // Description: // This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility // beyond the standard defined in this specification. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } diff --git a/openrtb/native/request/title_easyjson.go b/openrtb/native/request/title_easyjson.go index 930b8e5..4993dde 100644 --- a/openrtb/native/request/title_easyjson.go +++ b/openrtb/native/request/title_easyjson.go @@ -39,12 +39,8 @@ func easyjsonE7952480DecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.L case "len": out.Len = int64(in.Int64()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -65,16 +61,10 @@ func easyjsonE7952480EncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter out.RawString(prefix[1:]) out.Int64(int64(in.Len)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/native/request/video.go b/openrtb/native/request/video.go index 7eff2cd..c64ae06 100644 --- a/openrtb/native/request/video.go +++ b/openrtb/native/request/video.go @@ -1,6 +1,10 @@ package request -import "github.com/Vungle/vungo/openrtb" +import ( + "encoding/json" + + "github.com/Vungle/vungo/openrtb" +) // Video object to be used for all video elements supported in the Native Ad. This corresponds to the Video object of // OpenRTB. Exchange implementers can impose their own specific restrictions. Here are the required attributes of the @@ -62,5 +66,5 @@ type Video struct { // Description: // This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility beyond // the standard defined in this specification. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } diff --git a/openrtb/native/request/video_easyjson.go b/openrtb/native/request/video_easyjson.go index 3dde97f..b36b8fa 100644 --- a/openrtb/native/request/video_easyjson.go +++ b/openrtb/native/request/video_easyjson.go @@ -88,12 +88,8 @@ func easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.L in.Delim(']') } case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -151,16 +147,10 @@ func easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter out.RawByte(']') } } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/native/response/asset.go b/openrtb/native/response/asset.go index ab0ce71..b666479 100644 --- a/openrtb/native/response/asset.go +++ b/openrtb/native/response/asset.go @@ -1,5 +1,7 @@ package response +import "encoding/json" + // Asset Object is the main container object for each asset requested or supported by Exchange on behalf of the // rendering client. Any object that is required is to be flagged as such. Only one of the {title,img,video,data} // objects should be present in each object. All others should be null/absent. The id is to be unique within the @@ -98,5 +100,5 @@ type Asset struct { // This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility // beyond the standard defined in this specification. // Bidders are encouraged not to use asset.ext for exchanging text assets. Use data.ext with custom type instead. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } diff --git a/openrtb/native/response/asset_easyjson.go b/openrtb/native/response/asset_easyjson.go index f8839a8..cedcf7b 100644 --- a/openrtb/native/response/asset_easyjson.go +++ b/openrtb/native/response/asset_easyjson.go @@ -92,12 +92,8 @@ func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer. easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse5(in, out.Link) } case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -179,7 +175,7 @@ func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwrite } easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse5(out, *in.Link) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -187,13 +183,7 @@ func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwrite } else { out.RawString(prefix) } - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -268,12 +258,8 @@ func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse5(in *jlexer case "fallback": out.Fallback = string(in.String()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -313,16 +299,10 @@ func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse5(out *jwrit out.RawString(prefix) out.String(string(in.Fallback)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -352,12 +332,8 @@ func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse4(in *jlexer case "value": out.Value = string(in.String()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -399,16 +375,10 @@ func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse4(out *jwrit } out.String(string(in.Value)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -482,12 +452,8 @@ func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse2(in *jlexer case "h": out.H = int64(in.Int64()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -529,16 +495,10 @@ func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse2(out *jwrit out.RawString(prefix) out.Int64(int64(in.H)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } @@ -566,12 +526,8 @@ func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse1(in *jlexer case "len": out.Len = int64(in.Int64()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -597,16 +553,10 @@ func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse1(out *jwrit out.RawString(prefix) out.Int64(int64(in.Len)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/native/response/data.go b/openrtb/native/response/data.go index 4238e74..de065e2 100644 --- a/openrtb/native/response/data.go +++ b/openrtb/native/response/data.go @@ -1,6 +1,10 @@ package response -import "github.com/Vungle/vungo/openrtb/native" +import ( + "encoding/json" + + "github.com/Vungle/vungo/openrtb/native" +) // Data corresponds to the Data Object in the request, with the value filled in. The Data Object is to be used for all // miscellaneous elements of the native unit such as Brand Name, Ratings, Review Count, Stars, Downloads, Price count @@ -53,5 +57,5 @@ type Data struct { // Description: // This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility // beyond the standard defined in this specification. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } diff --git a/openrtb/native/response/data_easyjson.go b/openrtb/native/response/data_easyjson.go index c92e546..1344a0e 100644 --- a/openrtb/native/response/data_easyjson.go +++ b/openrtb/native/response/data_easyjson.go @@ -44,12 +44,8 @@ func easyjson794297d0DecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer. case "value": out.Value = string(in.String()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -91,16 +87,10 @@ func easyjson794297d0EncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwrite } out.String(string(in.Value)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/native/response/eventtracker.go b/openrtb/native/response/eventtracker.go index adabd10..10bb3b2 100644 --- a/openrtb/native/response/eventtracker.go +++ b/openrtb/native/response/eventtracker.go @@ -65,5 +65,5 @@ type EventTracker struct { // Description: // This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility // beyond the standard defined in this specification. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } diff --git a/openrtb/native/response/eventtracker_easyjson.go b/openrtb/native/response/eventtracker_easyjson.go index 92cedd3..82cb6c9 100644 --- a/openrtb/native/response/eventtracker_easyjson.go +++ b/openrtb/native/response/eventtracker_easyjson.go @@ -48,12 +48,8 @@ func easyjson88abeb4cDecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer. in.AddError((out.CustomData).UnmarshalJSON(data)) } case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -89,16 +85,10 @@ func easyjson88abeb4cEncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwrite out.RawString(prefix) out.Raw((in.CustomData).MarshalJSON()) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/native/response/image.go b/openrtb/native/response/image.go index 08cadd1..3e58134 100644 --- a/openrtb/native/response/image.go +++ b/openrtb/native/response/image.go @@ -1,6 +1,10 @@ package response -import "github.com/Vungle/vungo/openrtb/native" +import ( + "encoding/json" + + "github.com/Vungle/vungo/openrtb/native" +) // Image object to be used for all image elements of the Native ad such as Icons, Main Image, etc. // It is recommended that if assetsurl/dcourl is being used rather than embedded assets, that an image of each @@ -64,5 +68,5 @@ type Image struct { // Description: // This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility // beyond the standard defined in this specification. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } diff --git a/openrtb/native/response/image_easyjson.go b/openrtb/native/response/image_easyjson.go index 807a5b8..8850ce1 100644 --- a/openrtb/native/response/image_easyjson.go +++ b/openrtb/native/response/image_easyjson.go @@ -46,12 +46,8 @@ func easyjson220accf5DecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer. case "h": out.H = int64(in.Int64()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -93,16 +89,10 @@ func easyjson220accf5EncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwrite out.RawString(prefix) out.Int64(int64(in.H)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/native/response/link.go b/openrtb/native/response/link.go index 6a31590..dc043db 100644 --- a/openrtb/native/response/link.go +++ b/openrtb/native/response/link.go @@ -1,5 +1,7 @@ package response +import "encoding/json" + // Link object is used for ‘call to action’ assets, or other links from the Native ad. // This Object should be associated to its peer object in the parent Asset Object or as the master link in the top level // Native Ad response object. When that peer object is activated (clicked) the action should take the user to the @@ -49,5 +51,5 @@ type Link struct { // Description: // This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility // beyond the standard defined in this specification. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } diff --git a/openrtb/native/response/link_easyjson.go b/openrtb/native/response/link_easyjson.go index d592d9e..d612b96 100644 --- a/openrtb/native/response/link_easyjson.go +++ b/openrtb/native/response/link_easyjson.go @@ -64,12 +64,8 @@ func easyjson16eb09bcDecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer. case "fallback": out.Fallback = string(in.String()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -109,16 +105,10 @@ func easyjson16eb09bcEncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwrite out.RawString(prefix) out.String(string(in.Fallback)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/native/response/response.go b/openrtb/native/response/response.go index 81f4e17..2b37db9 100644 --- a/openrtb/native/response/response.go +++ b/openrtb/native/response/response.go @@ -1,5 +1,7 @@ package response +import "encoding/json" + // Response object is the top level JSON object which identifies a native response. // // See OpenRTB Native 1.2 Sec 5.1 Native Markup Response Object @@ -124,5 +126,5 @@ type Response struct { // Description: // This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility // beyond the standard defined in this specification. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } diff --git a/openrtb/native/response/response_easyjson.go b/openrtb/native/response/response_easyjson.go index cd27864..721d796 100644 --- a/openrtb/native/response/response_easyjson.go +++ b/openrtb/native/response/response_easyjson.go @@ -118,12 +118,8 @@ func easyjson6ff3ac1dDecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer. case "privacy": out.Privacy = string(in.String()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -232,16 +228,10 @@ func easyjson6ff3ac1dEncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwrite out.RawString(prefix) out.String(string(in.Privacy)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/native/response/title.go b/openrtb/native/response/title.go index 1a1b26d..cb64c33 100644 --- a/openrtb/native/response/title.go +++ b/openrtb/native/response/title.go @@ -1,5 +1,7 @@ package response +import "encoding/json" + // Title corresponds to the Title Object in the request, with the value filled in. // If using assetsurl or dcourl response rather than embedded asset response, it is recommended that three title objects // be provided, the length of each of which is less than or equal to the three recommended maximum title lengths @@ -39,5 +41,5 @@ type Title struct { // Description: // This object is a placeholder that may contain custom JSON agreed to by the parties to support flexibility // beyond the standard defined in this specification. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } diff --git a/openrtb/native/response/title_easyjson.go b/openrtb/native/response/title_easyjson.go index 97e663b..1ce79d9 100644 --- a/openrtb/native/response/title_easyjson.go +++ b/openrtb/native/response/title_easyjson.go @@ -41,12 +41,8 @@ func easyjsonE7952480DecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer. case "len": out.Len = int64(in.Int64()) case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -72,16 +68,10 @@ func easyjsonE7952480EncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwrite out.RawString(prefix) out.Int64(int64(in.Len)) } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/native_easyjson.go b/openrtb/native_easyjson.go index 60469f8..a9c1fb8 100644 --- a/openrtb/native_easyjson.go +++ b/openrtb/native_easyjson.go @@ -87,12 +87,8 @@ func easyjson3eeb1cddDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Na in.Delim(']') } case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -146,16 +142,10 @@ func easyjson3eeb1cddEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in N out.RawByte(']') } } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/openrtbtest/testutil.go b/openrtb/openrtbtest/testutil.go index d53be4d..0c0928f 100644 --- a/openrtb/openrtbtest/testutil.go +++ b/openrtb/openrtbtest/testutil.go @@ -13,6 +13,7 @@ import ( "github.com/Vungle/vungo/internal/util/utiltest" "github.com/Vungle/vungo/openrtb" "github.com/go-test/deep" + "github.com/google/go-cmp/cmp" ) // UnmarshalFromJSONFile method reads from a testdata/*.json file and unmarshals the content into @@ -60,13 +61,17 @@ func VerifyModelAgainstFile(t Testing, file string, modelType reflect.Type) { t.Fatalf("Cannot unmarshal JSON data into %v because of\n%v.", modelType, err) } - if !reflect.DeepEqual(model1, model2) { - m1JSON, _ := json.MarshalIndent(model1, "", " ") - m2JSON, _ := json.MarshalIndent(model2, "", " ") - t.Logf("Unmarshaled: %s\nRe-marshaled: %s.", m1JSON, m2JSON) - t.Error("Unmarshaled model should be the same as re-marshaled model.") + if d := cmp.Diff(model1, model2); d != "" { + t.Errorf("Reduce() mismatch (-got +want):\n%s", d) } + //if !reflect.DeepEqual(model1, model2) { + // m1JSON, _ := json.MarshalIndent(model1, "", " ") + // m2JSON, _ := json.MarshalIndent(model2, "", " ") + // t.Logf("Unmarshaled: %s\nRe-marshaled: %s.", m1JSON, m2JSON) + // t.Error("Unmarshaled model should be the same as re-marshaled model.") + //} + verifyModelNonEmptyFields(t, jsonBytes, modelType) } @@ -304,7 +309,7 @@ func verifyDeepCopyImpl(prefix string, src, dst reflect.Value) []string { } if src.CanAddr() && dst.CanAddr() && dst.Addr() == src.Addr() { r = append(r, fmt.Sprintf("%v share\n\tgot %#+v\n\twant %#+v\n", - prefix, dst.Addr(), src.Addr())) + prefix, dst.Kind().String(), src.Kind().String())) } switch src.Kind() { case reflect.Ptr: diff --git a/openrtb/openrtbutil/request_test.go b/openrtb/openrtbutil/request_test.go index 20150f8..faafd72 100644 --- a/openrtb/openrtbutil/request_test.go +++ b/openrtb/openrtbutil/request_test.go @@ -2,7 +2,6 @@ package openrtbutil_test import ( "context" - "encoding/json" "net/url" "reflect" "testing" @@ -31,21 +30,6 @@ func TestNewRequestError(t *testing.T) { openrtbutil.ErrEmptyURL.Error(), }, - // Should return JSON marshaling error. - { - &openrtb.BidRequest{ - Application: &openrtb.Application{ - // Fake a JSON marshaling error by creating an impossible-to-marshal value. - Extension: func() {}, - }, - }, - "http://localhost", - []reflect.Type{ - reflect.TypeOf((*json.MarshalerError)(nil)), - reflect.TypeOf((*json.UnsupportedTypeError)(nil)), - }, // seems like diff os will report diff err type - }, - // Should return URL parsing error. { &openrtb.BidRequest{}, diff --git a/openrtb/producer.go b/openrtb/producer.go index d5531d4..151472b 100644 --- a/openrtb/producer.go +++ b/openrtb/producer.go @@ -1,6 +1,10 @@ package openrtb -import "github.com/Vungle/vungo/internal/util" +import ( + "encoding/json" + + "github.com/Vungle/vungo/internal/util" +) // Producer object defines the producer of the content in which the ad will be // shown. @@ -53,7 +57,7 @@ type Producer struct { // object // Description: // Placeholder for exchange-specific extensions to OpenRTB. - Ext interface{} `json:"ext,omitempty"` + Ext json.RawMessage `json:"ext,omitempty"` } // Validate method checks to see if the Site object contains required and @@ -71,6 +75,6 @@ func (p *Producer) Copy() *Producer { } pCopy := *p pCopy.Cat = util.DeepCopyStrSlice(p.Cat) - pCopy.Ext = util.DeepCopyCopiable(p.Ext) + pCopy.Ext = util.DeepCopyJSONRawMsg(p.Ext) return &pCopy } diff --git a/openrtb/producer_easyjson.go b/openrtb/producer_easyjson.go index 924614f..cd6ceef 100644 --- a/openrtb/producer_easyjson.go +++ b/openrtb/producer_easyjson.go @@ -66,12 +66,8 @@ func easyjson92a4b12aDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Pr case "domain": out.Domain = string(in.String()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -132,7 +128,7 @@ func easyjson92a4b12aEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in P } out.String(string(in.Domain)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -140,13 +136,7 @@ func easyjson92a4b12aEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in P } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/segment.go b/openrtb/segment.go index c14d138..48f2f58 100644 --- a/openrtb/segment.go +++ b/openrtb/segment.go @@ -1,6 +1,10 @@ package openrtb -import "github.com/Vungle/vungo/internal/util" +import ( + "encoding/json" + + "github.com/Vungle/vungo/internal/util" +) // Segment objects are essentially key-value pairs that convey specific units of // data. @@ -43,7 +47,7 @@ type Segment struct { // object // Description: // Placeholder for exchange-specific extensions to OpenRTB. - Ext interface{} `json:"ext,omitempty"` + Ext json.RawMessage `json:"ext,omitempty"` } // Validate method checks to see if the Site object contains required and @@ -60,6 +64,6 @@ func (s *Segment) Copy() *Segment { return nil } sCopy := *s - sCopy.Ext = util.DeepCopyCopiable(s.Ext) + sCopy.Ext = util.DeepCopyJSONRawMsg(s.Ext) return &sCopy } diff --git a/openrtb/segment_easyjson.go b/openrtb/segment_easyjson.go index 91b51c6..a926c4a 100644 --- a/openrtb/segment_easyjson.go +++ b/openrtb/segment_easyjson.go @@ -43,12 +43,8 @@ func easyjson88ee421DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Seg case "value": out.Value = string(in.String()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -90,7 +86,7 @@ func easyjson88ee421EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Se } out.String(string(in.Value)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -98,13 +94,7 @@ func easyjson88ee421EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Se } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/site.go b/openrtb/site.go index 10d00b4..70ca25f 100644 --- a/openrtb/site.go +++ b/openrtb/site.go @@ -1,6 +1,10 @@ package openrtb -import "github.com/Vungle/vungo/internal/util" +import ( + "encoding/json" + + "github.com/Vungle/vungo/internal/util" +) // Site object should be included if the ad supported content is a website as // opposed to a non-browser application. @@ -133,7 +137,7 @@ type Site struct { // object // Description: // Placeholder for exchange-specific extensions to OpenRTB. - Ext interface{} `json:"ext,omitempty"` + Ext json.RawMessage `json:"ext,omitempty"` } // Validate method checks to see if the Site object contains required and @@ -157,6 +161,6 @@ func (s *Site) Copy() *Site { sCopy.PrivacyPolicy = s.PrivacyPolicy.Copy() sCopy.Publisher = s.Publisher.Copy() sCopy.Content = s.Content.Copy() - sCopy.Ext = util.DeepCopyCopiable(s.Ext) + sCopy.Ext = util.DeepCopyJSONRawMsg(s.Ext) return &sCopy } diff --git a/openrtb/site_easyjson.go b/openrtb/site_easyjson.go index 97968b6..3fa33ad 100644 --- a/openrtb/site_easyjson.go +++ b/openrtb/site_easyjson.go @@ -164,12 +164,8 @@ func easyjsonD9064c5DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Sit case "keywords": out.Keywords = string(in.String()) case "ext": - if m, ok := out.Ext.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Ext.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Ext = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -348,7 +344,7 @@ func easyjsonD9064c5EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Si } out.String(string(in.Keywords)) } - if in.Ext != nil { + if len(in.Ext) != 0 { const prefix string = ",\"ext\":" if first { first = false @@ -356,13 +352,7 @@ func easyjsonD9064c5EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Si } else { out.RawString(prefix) } - if m, ok := in.Ext.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Ext.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Ext)) - } + out.Raw((in.Ext).MarshalJSON()) } out.RawByte('}') } diff --git a/openrtb/source.go b/openrtb/source.go index 0cc9429..ed68fd3 100644 --- a/openrtb/source.go +++ b/openrtb/source.go @@ -1,6 +1,10 @@ package openrtb -import "github.com/Vungle/vungo/internal/util" +import ( + "encoding/json" + + "github.com/Vungle/vungo/internal/util" +) // Source object describes the nature and behavior of the entity that is the source of the bid request upstream from the exchange. // The primary purpose of this object is to define post-auction or upstream decisioning when the exchange itself does not control the final decision. @@ -40,7 +44,7 @@ type Source struct { // object // Description: // Placeholder for exchange-specific extensions to OpenRTB. - Ext interface{} `json:"ext,omitempty"` + Ext json.RawMessage `json:"ext,omitempty"` } // Copy returns a pointer to a copy of the Source object. @@ -49,6 +53,6 @@ func (s *Source) Copy() *Source { return nil } sourceCopy := *s - sourceCopy.Ext = util.DeepCopyCopiable(s.Ext) + sourceCopy.Ext = util.DeepCopyJSONRawMsg(s.Ext) return &sourceCopy } diff --git a/openrtb/testdata/bidrequest.json b/openrtb/testdata/bidrequest.json index 06083dd..a170629 100644 --- a/openrtb/testdata/bidrequest.json +++ b/openrtb/testdata/bidrequest.json @@ -130,26 +130,7 @@ "coppa": 1 }, "source": { - "ext": { - "schain": { - "ver": "1.0", - "complete": 1, - "nodes": [ - { - "asi": "directseller.com", - "sid": "00001", - "rid": "BidRequest1", - "hp": 1 - }, - { - "asi": "reseller.com", - "sid": "aaaaa", - "rid": "BidRequest2", - "hp": 1 - } - ] - } - } + "ext": {"schain":{"ver":"1.0","complete":1,"nodes":[{"asi":"directseller.com","sid":"00001","rid":"BidRequest1","hp":1},{"asi":"reseller.com","sid":"aaaaa","rid":"BidRequest2","hp":1}]}} }, "ext": {} } diff --git a/openrtb/user.go b/openrtb/user.go index d8e5aa8..59be8c6 100644 --- a/openrtb/user.go +++ b/openrtb/user.go @@ -28,7 +28,7 @@ func (u *User) Copy() *User { userCopy := *u if u.Geo != nil { - GeoCopy := *u.Geo + GeoCopy := *u.Geo.Copy() userCopy.Geo = &GeoCopy } diff --git a/openrtb/video.go b/openrtb/video.go index cb01be8..18ba488 100644 --- a/openrtb/video.go +++ b/openrtb/video.go @@ -1,6 +1,7 @@ package openrtb import ( + "encoding/json" "errors" "github.com/Vungle/vungo/internal/util" @@ -260,7 +261,7 @@ type Video struct { // object // Description: // Placeholder for exchange-specific extensions to OpenRTB. - Extension interface{} `json:"ext,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } // Validate method implements a Validater interface and return a validation error according to the @@ -325,7 +326,7 @@ func (v *Video) Copy() *Video { copy(vCopy.CompanionTypes, v.CompanionTypes) } - vCopy.Extension = util.DeepCopyCopiable(v.Extension) + vCopy.Extension = util.DeepCopyJSONRawMsg(v.Extension) return &vCopy } diff --git a/openrtb/video_easyjson.go b/openrtb/video_easyjson.go index bb4c359..195e0c5 100644 --- a/openrtb/video_easyjson.go +++ b/openrtb/video_easyjson.go @@ -283,12 +283,8 @@ func easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Vi in.Delim(']') } case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) } default: in.SkipRecursive() @@ -508,16 +504,10 @@ func easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in V out.RawByte(']') } } - if in.Extension != nil { + if len(in.Extension) != 0 { const prefix string = ",\"ext\":" out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } + out.Raw((in.Extension).MarshalJSON()) } out.RawByte('}') } From eb9b8e586da140f0a0f15ae5d48520ab59e77f7b Mon Sep 17 00:00:00 2001 From: xiaopeng0216 Date: Mon, 12 Jul 2021 12:48:04 +0800 Subject: [PATCH 2/5] convert user/reg extension to RawMessage --- openrtb/application_easyjson.go | 1239 ----- openrtb/audio_easyjson.go | 1003 ----- openrtb/banner_easyjson.go | 595 --- openrtb/bid_easyjson.go | 341 -- openrtb/bidrequest_easyjson.go | 3979 ----------------- openrtb/bidresponse.go | 18 +- openrtb/bidresponse_easyjson.go | 262 -- openrtb/bidresponse_test.go | 2 - openrtb/content_easyjson.go | 823 ---- openrtb/data_easyjson.go | 229 - openrtb/deal_easyjson.go | 171 - openrtb/device_easyjson.go | 681 --- openrtb/format_easyjson.go | 130 - openrtb/geo_easyjson.go | 226 - openrtb/impression_easyjson.go | 1117 ----- openrtb/metric_easyjson.go | 90 - openrtb/native/request/asset_easyjson.go | 537 --- openrtb/native/request/data_easyjson.go | 84 - .../native/request/eventtracker_easyjson.go | 116 - openrtb/native/request/image_easyjson.go | 173 - openrtb/native/request/request_easyjson.go | 240 - openrtb/native/request/title_easyjson.go | 76 - openrtb/native/request/video_easyjson.go | 162 - openrtb/native/response/asset_easyjson.go | 544 --- openrtb/native/response/data_easyjson.go | 102 - .../native/response/eventtracker_easyjson.go | 100 - openrtb/native/response/image_easyjson.go | 104 - openrtb/native/response/link_easyjson.go | 120 - openrtb/native/response/response_easyjson.go | 243 - openrtb/native/response/title_easyjson.go | 83 - openrtb/native/response/video_easyjson.go | 67 - openrtb/native_easyjson.go | 157 - openrtb/openrtbtest/testutil.go | 11 +- openrtb/privatemarketplace.go | 14 +- openrtb/privatemarketplace_easyjson.go | 139 - openrtb/producer_easyjson.go | 148 - openrtb/publisher_easyjson.go | 118 - openrtb/regulation.go | 12 +- openrtb/regulation_easyjson.go | 102 - openrtb/seatbid_easyjson.go | 134 - openrtb/segment_easyjson.go | 106 - openrtb/site_easyjson.go | 364 -- openrtb/testdata/regulation.json | 7 +- openrtb/user.go | 26 +- openrtb/user_easyjson.go | 214 - openrtb/video_easyjson.go | 519 --- 46 files changed, 43 insertions(+), 15685 deletions(-) diff --git a/openrtb/application_easyjson.go b/openrtb/application_easyjson.go index 538f1ac..793d66c 100644 --- a/openrtb/application_easyjson.go +++ b/openrtb/application_easyjson.go @@ -16,1242 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Application) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "bundle": - out.Bundle = string(in.String()) - case "domain": - out.Domain = string(in.String()) - case "storeurl": - out.StoreURL = string(in.String()) - case "cat": - if in.IsNull() { - in.Skip() - out.Categories = nil - } else { - in.Delim('[') - if out.Categories == nil { - if !in.IsDelim(']') { - out.Categories = make([]Category, 0, 4) - } else { - out.Categories = []Category{} - } - } else { - out.Categories = (out.Categories)[:0] - } - for !in.IsDelim(']') { - var v1 Category - v1 = Category(in.String()) - out.Categories = append(out.Categories, v1) - in.WantComma() - } - in.Delim(']') - } - case "sectioncat": - if in.IsNull() { - in.Skip() - out.SectionCategories = nil - } else { - in.Delim('[') - if out.SectionCategories == nil { - if !in.IsDelim(']') { - out.SectionCategories = make([]Category, 0, 4) - } else { - out.SectionCategories = []Category{} - } - } else { - out.SectionCategories = (out.SectionCategories)[:0] - } - for !in.IsDelim(']') { - var v2 Category - v2 = Category(in.String()) - out.SectionCategories = append(out.SectionCategories, v2) - in.WantComma() - } - in.Delim(']') - } - case "pagecat": - if in.IsNull() { - in.Skip() - out.PageCategories = nil - } else { - in.Delim('[') - if out.PageCategories == nil { - if !in.IsDelim(']') { - out.PageCategories = make([]Category, 0, 4) - } else { - out.PageCategories = []Category{} - } - } else { - out.PageCategories = (out.PageCategories)[:0] - } - for !in.IsDelim(']') { - var v3 Category - v3 = Category(in.String()) - out.PageCategories = append(out.PageCategories, v3) - in.WantComma() - } - in.Delim(']') - } - case "ver": - out.Version = string(in.String()) - case "privacypolicy": - if data := in.Raw(); in.Ok() { - in.AddError((out.HasPrivacyPolicy).UnmarshalJSON(data)) - } - case "paid": - if data := in.Raw(); in.Ok() { - in.AddError((out.IsPaid).UnmarshalJSON(data)) - } - case "publisher": - if in.IsNull() { - in.Skip() - out.Publisher = nil - } else { - if out.Publisher == nil { - out.Publisher = new(Publisher) - } - easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb1(in, out.Publisher) - } - case "content": - if in.IsNull() { - in.Skip() - out.Content = nil - } else { - if out.Content == nil { - out.Content = new(Content) - } - easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb2(in, out.Content) - } - case "keywords": - out.Keywords = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Application) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Name != "" { - const prefix string = ",\"name\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Name)) - } - if in.Bundle != "" { - const prefix string = ",\"bundle\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Bundle)) - } - if in.Domain != "" { - const prefix string = ",\"domain\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Domain)) - } - if in.StoreURL != "" { - const prefix string = ",\"storeurl\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.StoreURL)) - } - if len(in.Categories) != 0 { - const prefix string = ",\"cat\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v4, v5 := range in.Categories { - if v4 > 0 { - out.RawByte(',') - } - out.String(string(v5)) - } - out.RawByte(']') - } - } - if len(in.SectionCategories) != 0 { - const prefix string = ",\"sectioncat\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v6, v7 := range in.SectionCategories { - if v6 > 0 { - out.RawByte(',') - } - out.String(string(v7)) - } - out.RawByte(']') - } - } - if len(in.PageCategories) != 0 { - const prefix string = ",\"pagecat\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v8, v9 := range in.PageCategories { - if v8 > 0 { - out.RawByte(',') - } - out.String(string(v9)) - } - out.RawByte(']') - } - } - if in.Version != "" { - const prefix string = ",\"ver\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Version)) - } - if in.HasPrivacyPolicy { - const prefix string = ",\"privacypolicy\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.HasPrivacyPolicy).MarshalJSON()) - } - if in.IsPaid { - const prefix string = ",\"paid\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.IsPaid).MarshalJSON()) - } - if in.Publisher != nil { - const prefix string = ",\"publisher\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb1(out, *in.Publisher) - } - if in.Content != nil { - const prefix string = ",\"content\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb2(out, *in.Content) - } - if in.Keywords != "" { - const prefix string = ",\"keywords\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Keywords)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Application) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Application) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Application) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Application) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb(l, v) -} -func easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb2(in *jlexer.Lexer, out *Content) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "episode": - if in.IsNull() { - in.Skip() - out.Episode = nil - } else { - if out.Episode == nil { - out.Episode = new(int) - } - *out.Episode = int(in.Int()) - } - case "title": - out.Title = string(in.String()) - case "series": - out.Series = string(in.String()) - case "season": - out.Season = string(in.String()) - case "artist": - out.Artist = string(in.String()) - case "genre": - out.Genre = string(in.String()) - case "album": - out.Album = string(in.String()) - case "isrc": - out.ISRC = string(in.String()) - case "producer": - if in.IsNull() { - in.Skip() - out.Producer = nil - } else { - if out.Producer == nil { - out.Producer = new(Producer) - } - easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb3(in, out.Producer) - } - case "url": - out.URL = string(in.String()) - case "cat": - if in.IsNull() { - in.Skip() - out.Cat = nil - } else { - in.Delim('[') - if out.Cat == nil { - if !in.IsDelim(']') { - out.Cat = make([]string, 0, 4) - } else { - out.Cat = []string{} - } - } else { - out.Cat = (out.Cat)[:0] - } - for !in.IsDelim(']') { - var v10 string - v10 = string(in.String()) - out.Cat = append(out.Cat, v10) - in.WantComma() - } - in.Delim(']') - } - case "prodq": - out.ProdQ = ProductionQuality(in.Int()) - case "videoquality": - out.VideoQuality = ProductionQuality(in.Int()) - case "context": - out.Context = ContentContext(in.Int()) - case "contentrating": - out.ContentRating = string(in.String()) - case "userrating": - out.UserRating = string(in.String()) - case "qagmediarating": - out.QAGMediaRating = IQGMediaRating(in.Int()) - case "keywords": - out.Keywords = string(in.String()) - case "livestream": - if in.IsNull() { - in.Skip() - out.LiveStream = nil - } else { - if out.LiveStream == nil { - out.LiveStream = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.LiveStream).UnmarshalJSON(data)) - } - } - case "sourcerelationship": - if in.IsNull() { - in.Skip() - out.SourceRelationship = nil - } else { - if out.SourceRelationship == nil { - out.SourceRelationship = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.SourceRelationship).UnmarshalJSON(data)) - } - } - case "len": - if in.IsNull() { - in.Skip() - out.Len = nil - } else { - if out.Len == nil { - out.Len = new(int) - } - *out.Len = int(in.Int()) - } - case "language": - out.Language = string(in.String()) - case "embeddable": - if in.IsNull() { - in.Skip() - out.Embeddable = nil - } else { - if out.Embeddable == nil { - out.Embeddable = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.Embeddable).UnmarshalJSON(data)) - } - } - case "data": - if in.IsNull() { - in.Skip() - out.Data = nil - } else { - in.Delim('[') - if out.Data == nil { - if !in.IsDelim(']') { - out.Data = make([]*Data, 0, 8) - } else { - out.Data = []*Data{} - } - } else { - out.Data = (out.Data)[:0] - } - for !in.IsDelim(']') { - var v11 *Data - if in.IsNull() { - in.Skip() - v11 = nil - } else { - if v11 == nil { - v11 = new(Data) - } - easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb4(in, v11) - } - out.Data = append(out.Data, v11) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb2(out *jwriter.Writer, in Content) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Episode != nil { - const prefix string = ",\"episode\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(*in.Episode)) - } - if in.Title != "" { - const prefix string = ",\"title\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Title)) - } - if in.Series != "" { - const prefix string = ",\"series\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Series)) - } - if in.Season != "" { - const prefix string = ",\"season\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Season)) - } - if in.Artist != "" { - const prefix string = ",\"artist\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Artist)) - } - if in.Genre != "" { - const prefix string = ",\"genre\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Genre)) - } - if in.Album != "" { - const prefix string = ",\"album\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Album)) - } - if in.ISRC != "" { - const prefix string = ",\"isrc\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.ISRC)) - } - if in.Producer != nil { - const prefix string = ",\"producer\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb3(out, *in.Producer) - } - if in.URL != "" { - const prefix string = ",\"url\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.URL)) - } - if len(in.Cat) != 0 { - const prefix string = ",\"cat\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v12, v13 := range in.Cat { - if v12 > 0 { - out.RawByte(',') - } - out.String(string(v13)) - } - out.RawByte(']') - } - } - if in.ProdQ != 0 { - const prefix string = ",\"prodq\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.ProdQ)) - } - if in.VideoQuality != 0 { - const prefix string = ",\"videoquality\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.VideoQuality)) - } - if in.Context != 0 { - const prefix string = ",\"context\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Context)) - } - if in.ContentRating != "" { - const prefix string = ",\"contentrating\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.ContentRating)) - } - if in.UserRating != "" { - const prefix string = ",\"userrating\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.UserRating)) - } - if in.QAGMediaRating != 0 { - const prefix string = ",\"qagmediarating\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.QAGMediaRating)) - } - if in.Keywords != "" { - const prefix string = ",\"keywords\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Keywords)) - } - if in.LiveStream != nil { - const prefix string = ",\"livestream\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.LiveStream).MarshalJSON()) - } - if in.SourceRelationship != nil { - const prefix string = ",\"sourcerelationship\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.SourceRelationship).MarshalJSON()) - } - if in.Len != nil { - const prefix string = ",\"len\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(*in.Len)) - } - if in.Language != "" { - const prefix string = ",\"language\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Language)) - } - if in.Embeddable != nil { - const prefix string = ",\"embeddable\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.Embeddable).MarshalJSON()) - } - if len(in.Data) != 0 { - const prefix string = ",\"data\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v14, v15 := range in.Data { - if v14 > 0 { - out.RawByte(',') - } - if v15 == nil { - out.RawString("null") - } else { - easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb4(out, *v15) - } - } - out.RawByte(']') - } - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} -func easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb4(in *jlexer.Lexer, out *Data) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "segment": - if in.IsNull() { - in.Skip() - out.Segment = nil - } else { - in.Delim('[') - if out.Segment == nil { - if !in.IsDelim(']') { - out.Segment = make([]*Segment, 0, 8) - } else { - out.Segment = []*Segment{} - } - } else { - out.Segment = (out.Segment)[:0] - } - for !in.IsDelim(']') { - var v16 *Segment - if in.IsNull() { - in.Skip() - v16 = nil - } else { - if v16 == nil { - v16 = new(Segment) - } - easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb5(in, v16) - } - out.Segment = append(out.Segment, v16) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb4(out *jwriter.Writer, in Data) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Name != "" { - const prefix string = ",\"name\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Name)) - } - if len(in.Segment) != 0 { - const prefix string = ",\"segment\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v17, v18 := range in.Segment { - if v17 > 0 { - out.RawByte(',') - } - if v18 == nil { - out.RawString("null") - } else { - easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb5(out, *v18) - } - } - out.RawByte(']') - } - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} -func easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb5(in *jlexer.Lexer, out *Segment) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "value": - out.Value = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb5(out *jwriter.Writer, in Segment) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Name != "" { - const prefix string = ",\"name\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Name)) - } - if in.Value != "" { - const prefix string = ",\"value\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Value)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} -func easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb3(in *jlexer.Lexer, out *Producer) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "cat": - if in.IsNull() { - in.Skip() - out.Cat = nil - } else { - in.Delim('[') - if out.Cat == nil { - if !in.IsDelim(']') { - out.Cat = make([]string, 0, 4) - } else { - out.Cat = []string{} - } - } else { - out.Cat = (out.Cat)[:0] - } - for !in.IsDelim(']') { - var v19 string - v19 = string(in.String()) - out.Cat = append(out.Cat, v19) - in.WantComma() - } - in.Delim(']') - } - case "domain": - out.Domain = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb3(out *jwriter.Writer, in Producer) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Name != "" { - const prefix string = ",\"name\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Name)) - } - if len(in.Cat) != 0 { - const prefix string = ",\"cat\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v20, v21 := range in.Cat { - if v20 > 0 { - out.RawByte(',') - } - out.String(string(v21)) - } - out.RawByte(']') - } - } - if in.Domain != "" { - const prefix string = ",\"domain\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Domain)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} -func easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *Publisher) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "cat": - if in.IsNull() { - in.Skip() - out.Categories = nil - } else { - in.Delim('[') - if out.Categories == nil { - if !in.IsDelim(']') { - out.Categories = make([]Category, 0, 4) - } else { - out.Categories = []Category{} - } - } else { - out.Categories = (out.Categories)[:0] - } - for !in.IsDelim(']') { - var v22 Category - v22 = Category(in.String()) - out.Categories = append(out.Categories, v22) - in.WantComma() - } - in.Delim(']') - } - case "domain": - out.Domain = string(in.String()) - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in Publisher) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"id\":" - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Name != "" { - const prefix string = ",\"name\":" - out.RawString(prefix) - out.String(string(in.Name)) - } - if len(in.Categories) != 0 { - const prefix string = ",\"cat\":" - out.RawString(prefix) - { - out.RawByte('[') - for v23, v24 := range in.Categories { - if v23 > 0 { - out.RawByte(',') - } - out.String(string(v24)) - } - out.RawByte(']') - } - } - if in.Domain != "" { - const prefix string = ",\"domain\":" - out.RawString(prefix) - out.String(string(in.Domain)) - } - out.RawByte('}') -} diff --git a/openrtb/audio_easyjson.go b/openrtb/audio_easyjson.go index 2158832..793d66c 100644 --- a/openrtb/audio_easyjson.go +++ b/openrtb/audio_easyjson.go @@ -16,1006 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson48f1e884DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Audio) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "mimes": - if in.IsNull() { - in.Skip() - out.MIMETypes = nil - } else { - in.Delim('[') - if out.MIMETypes == nil { - if !in.IsDelim(']') { - out.MIMETypes = make([]string, 0, 4) - } else { - out.MIMETypes = []string{} - } - } else { - out.MIMETypes = (out.MIMETypes)[:0] - } - for !in.IsDelim(']') { - var v1 string - v1 = string(in.String()) - out.MIMETypes = append(out.MIMETypes, v1) - in.WantComma() - } - in.Delim(']') - } - case "minduration": - if in.IsNull() { - in.Skip() - out.MinDuration = nil - } else { - if out.MinDuration == nil { - out.MinDuration = new(int) - } - *out.MinDuration = int(in.Int()) - } - case "maxduration": - if in.IsNull() { - in.Skip() - out.MaxDuration = nil - } else { - if out.MaxDuration == nil { - out.MaxDuration = new(int) - } - *out.MaxDuration = int(in.Int()) - } - case "protocols": - if in.IsNull() { - in.Skip() - out.Protocols = nil - } else { - in.Delim('[') - if out.Protocols == nil { - if !in.IsDelim(']') { - out.Protocols = make([]Protocol, 0, 8) - } else { - out.Protocols = []Protocol{} - } - } else { - out.Protocols = (out.Protocols)[:0] - } - for !in.IsDelim(']') { - var v2 Protocol - v2 = Protocol(in.Int()) - out.Protocols = append(out.Protocols, v2) - in.WantComma() - } - in.Delim(']') - } - case "startdelay": - if in.IsNull() { - in.Skip() - out.StartDelay = nil - } else { - if out.StartDelay == nil { - out.StartDelay = new(StartDelay) - } - *out.StartDelay = StartDelay(in.Int()) - } - case "sequence": - out.Sequence = int(in.Int()) - case "battr": - if in.IsNull() { - in.Skip() - out.BlockedCreativeAttributes = nil - } else { - in.Delim('[') - if out.BlockedCreativeAttributes == nil { - if !in.IsDelim(']') { - out.BlockedCreativeAttributes = make([]CreativeAttribute, 0, 8) - } else { - out.BlockedCreativeAttributes = []CreativeAttribute{} - } - } else { - out.BlockedCreativeAttributes = (out.BlockedCreativeAttributes)[:0] - } - for !in.IsDelim(']') { - var v3 CreativeAttribute - v3 = CreativeAttribute(in.Int()) - out.BlockedCreativeAttributes = append(out.BlockedCreativeAttributes, v3) - in.WantComma() - } - in.Delim(']') - } - case "maxextended": - out.MaxExtendedDuration = int(in.Int()) - case "minbitrate": - out.MinBitRate = int(in.Int()) - case "maxbitrate": - out.MaxBitRate = int(in.Int()) - case "delivery": - if in.IsNull() { - in.Skip() - out.DeliveryMethods = nil - } else { - in.Delim('[') - if out.DeliveryMethods == nil { - if !in.IsDelim(']') { - out.DeliveryMethods = make([]DeliveryMethod, 0, 8) - } else { - out.DeliveryMethods = []DeliveryMethod{} - } - } else { - out.DeliveryMethods = (out.DeliveryMethods)[:0] - } - for !in.IsDelim(']') { - var v4 DeliveryMethod - v4 = DeliveryMethod(in.Int()) - out.DeliveryMethods = append(out.DeliveryMethods, v4) - in.WantComma() - } - in.Delim(']') - } - case "companionad": - if in.IsNull() { - in.Skip() - out.CompanionAds = nil - } else { - in.Delim('[') - if out.CompanionAds == nil { - if !in.IsDelim(']') { - out.CompanionAds = make([]Banner, 0, 1) - } else { - out.CompanionAds = []Banner{} - } - } else { - out.CompanionAds = (out.CompanionAds)[:0] - } - for !in.IsDelim(']') { - var v5 Banner - easyjson48f1e884DecodeGithubComVungleVungoOpenrtb1(in, &v5) - out.CompanionAds = append(out.CompanionAds, v5) - in.WantComma() - } - in.Delim(']') - } - case "api": - if in.IsNull() { - in.Skip() - out.APIFrameworks = nil - } else { - in.Delim('[') - if out.APIFrameworks == nil { - if !in.IsDelim(']') { - out.APIFrameworks = make([]APIFramework, 0, 8) - } else { - out.APIFrameworks = []APIFramework{} - } - } else { - out.APIFrameworks = (out.APIFrameworks)[:0] - } - for !in.IsDelim(']') { - var v6 APIFramework - v6 = APIFramework(in.Int()) - out.APIFrameworks = append(out.APIFrameworks, v6) - in.WantComma() - } - in.Delim(']') - } - case "companiontype": - if in.IsNull() { - in.Skip() - out.CompanionTypes = nil - } else { - in.Delim('[') - if out.CompanionTypes == nil { - if !in.IsDelim(']') { - out.CompanionTypes = make([]CompanionType, 0, 8) - } else { - out.CompanionTypes = []CompanionType{} - } - } else { - out.CompanionTypes = (out.CompanionTypes)[:0] - } - for !in.IsDelim(']') { - var v7 CompanionType - v7 = CompanionType(in.Int()) - out.CompanionTypes = append(out.CompanionTypes, v7) - in.WantComma() - } - in.Delim(']') - } - case "maxseq": - out.MaxSequence = int(in.Int()) - case "feed": - out.Feed = FeedType(in.Int()) - case "stitched": - if data := in.Raw(); in.Ok() { - in.AddError((out.Stitched).UnmarshalJSON(data)) - } - case "nvol": - out.NormalizedVolume = VolumeNormalizationMode(in.Int()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson48f1e884EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Audio) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"mimes\":" - out.RawString(prefix[1:]) - if in.MIMETypes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v8, v9 := range in.MIMETypes { - if v8 > 0 { - out.RawByte(',') - } - out.String(string(v9)) - } - out.RawByte(']') - } - } - if in.MinDuration != nil { - const prefix string = ",\"minduration\":" - out.RawString(prefix) - out.Int(int(*in.MinDuration)) - } - if in.MaxDuration != nil { - const prefix string = ",\"maxduration\":" - out.RawString(prefix) - out.Int(int(*in.MaxDuration)) - } - if len(in.Protocols) != 0 { - const prefix string = ",\"protocols\":" - out.RawString(prefix) - { - out.RawByte('[') - for v10, v11 := range in.Protocols { - if v10 > 0 { - out.RawByte(',') - } - out.Int(int(v11)) - } - out.RawByte(']') - } - } - if in.StartDelay != nil { - const prefix string = ",\"startdelay\":" - out.RawString(prefix) - out.Int(int(*in.StartDelay)) - } - if in.Sequence != 0 { - const prefix string = ",\"sequence\":" - out.RawString(prefix) - out.Int(int(in.Sequence)) - } - if len(in.BlockedCreativeAttributes) != 0 { - const prefix string = ",\"battr\":" - out.RawString(prefix) - { - out.RawByte('[') - for v12, v13 := range in.BlockedCreativeAttributes { - if v12 > 0 { - out.RawByte(',') - } - out.Int(int(v13)) - } - out.RawByte(']') - } - } - if in.MaxExtendedDuration != 0 { - const prefix string = ",\"maxextended\":" - out.RawString(prefix) - out.Int(int(in.MaxExtendedDuration)) - } - if in.MinBitRate != 0 { - const prefix string = ",\"minbitrate\":" - out.RawString(prefix) - out.Int(int(in.MinBitRate)) - } - if in.MaxBitRate != 0 { - const prefix string = ",\"maxbitrate\":" - out.RawString(prefix) - out.Int(int(in.MaxBitRate)) - } - if len(in.DeliveryMethods) != 0 { - const prefix string = ",\"delivery\":" - out.RawString(prefix) - { - out.RawByte('[') - for v14, v15 := range in.DeliveryMethods { - if v14 > 0 { - out.RawByte(',') - } - out.Int(int(v15)) - } - out.RawByte(']') - } - } - if len(in.CompanionAds) != 0 { - const prefix string = ",\"companionad\":" - out.RawString(prefix) - { - out.RawByte('[') - for v16, v17 := range in.CompanionAds { - if v16 > 0 { - out.RawByte(',') - } - easyjson48f1e884EncodeGithubComVungleVungoOpenrtb1(out, v17) - } - out.RawByte(']') - } - } - if len(in.APIFrameworks) != 0 { - const prefix string = ",\"api\":" - out.RawString(prefix) - { - out.RawByte('[') - for v18, v19 := range in.APIFrameworks { - if v18 > 0 { - out.RawByte(',') - } - out.Int(int(v19)) - } - out.RawByte(']') - } - } - if len(in.CompanionTypes) != 0 { - const prefix string = ",\"companiontype\":" - out.RawString(prefix) - { - out.RawByte('[') - for v20, v21 := range in.CompanionTypes { - if v20 > 0 { - out.RawByte(',') - } - out.Int(int(v21)) - } - out.RawByte(']') - } - } - if in.MaxSequence != 0 { - const prefix string = ",\"maxseq\":" - out.RawString(prefix) - out.Int(int(in.MaxSequence)) - } - if in.Feed != 0 { - const prefix string = ",\"feed\":" - out.RawString(prefix) - out.Int(int(in.Feed)) - } - if in.Stitched { - const prefix string = ",\"stitched\":" - out.RawString(prefix) - out.Raw((in.Stitched).MarshalJSON()) - } - if in.NormalizedVolume != 0 { - const prefix string = ",\"nvol\":" - out.RawString(prefix) - out.Int(int(in.NormalizedVolume)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Audio) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson48f1e884EncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Audio) MarshalEasyJSON(w *jwriter.Writer) { - easyjson48f1e884EncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Audio) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson48f1e884DecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Audio) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson48f1e884DecodeGithubComVungleVungoOpenrtb(l, v) -} -func easyjson48f1e884DecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *Banner) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "format": - if in.IsNull() { - in.Skip() - out.Format = nil - } else { - in.Delim('[') - if out.Format == nil { - if !in.IsDelim(']') { - out.Format = make([]Format, 0, 1) - } else { - out.Format = []Format{} - } - } else { - out.Format = (out.Format)[:0] - } - for !in.IsDelim(']') { - var v22 Format - easyjson48f1e884DecodeGithubComVungleVungoOpenrtb2(in, &v22) - out.Format = append(out.Format, v22) - in.WantComma() - } - in.Delim(']') - } - case "w": - out.Width = int(in.Int()) - case "h": - out.Height = int(in.Int()) - case "wmax": - if in.IsNull() { - in.Skip() - out.MaxWidth = nil - } else { - if out.MaxWidth == nil { - out.MaxWidth = new(int) - } - *out.MaxWidth = int(in.Int()) - } - case "hmax": - if in.IsNull() { - in.Skip() - out.MaxHeight = nil - } else { - if out.MaxHeight == nil { - out.MaxHeight = new(int) - } - *out.MaxHeight = int(in.Int()) - } - case "wmin": - if in.IsNull() { - in.Skip() - out.MinWidth = nil - } else { - if out.MinWidth == nil { - out.MinWidth = new(int) - } - *out.MinWidth = int(in.Int()) - } - case "hmin": - if in.IsNull() { - in.Skip() - out.MinHeight = nil - } else { - if out.MinHeight == nil { - out.MinHeight = new(int) - } - *out.MinHeight = int(in.Int()) - } - case "btype": - if in.IsNull() { - in.Skip() - out.BlockedTypes = nil - } else { - in.Delim('[') - if out.BlockedTypes == nil { - if !in.IsDelim(']') { - out.BlockedTypes = make([]int, 0, 8) - } else { - out.BlockedTypes = []int{} - } - } else { - out.BlockedTypes = (out.BlockedTypes)[:0] - } - for !in.IsDelim(']') { - var v23 int - v23 = int(in.Int()) - out.BlockedTypes = append(out.BlockedTypes, v23) - in.WantComma() - } - in.Delim(']') - } - case "battr": - if in.IsNull() { - in.Skip() - out.BlockedAttributes = nil - } else { - in.Delim('[') - if out.BlockedAttributes == nil { - if !in.IsDelim(']') { - out.BlockedAttributes = make([]int, 0, 8) - } else { - out.BlockedAttributes = []int{} - } - } else { - out.BlockedAttributes = (out.BlockedAttributes)[:0] - } - for !in.IsDelim(']') { - var v24 int - v24 = int(in.Int()) - out.BlockedAttributes = append(out.BlockedAttributes, v24) - in.WantComma() - } - in.Delim(']') - } - case "pos": - out.Position = AdPosition(in.Int()) - case "mimes": - if in.IsNull() { - in.Skip() - out.MIMETypes = nil - } else { - in.Delim('[') - if out.MIMETypes == nil { - if !in.IsDelim(']') { - out.MIMETypes = make([]string, 0, 4) - } else { - out.MIMETypes = []string{} - } - } else { - out.MIMETypes = (out.MIMETypes)[:0] - } - for !in.IsDelim(']') { - var v25 string - v25 = string(in.String()) - out.MIMETypes = append(out.MIMETypes, v25) - in.WantComma() - } - in.Delim(']') - } - case "topframe": - if in.IsNull() { - in.Skip() - out.TopFrame = nil - } else { - if out.TopFrame == nil { - out.TopFrame = new(int) - } - *out.TopFrame = int(in.Int()) - } - case "expdir": - if in.IsNull() { - in.Skip() - out.ExpandDirections = nil - } else { - in.Delim('[') - if out.ExpandDirections == nil { - if !in.IsDelim(']') { - out.ExpandDirections = make([]int, 0, 8) - } else { - out.ExpandDirections = []int{} - } - } else { - out.ExpandDirections = (out.ExpandDirections)[:0] - } - for !in.IsDelim(']') { - var v26 int - v26 = int(in.Int()) - out.ExpandDirections = append(out.ExpandDirections, v26) - in.WantComma() - } - in.Delim(']') - } - case "api": - if in.IsNull() { - in.Skip() - out.APIFrameworks = nil - } else { - in.Delim('[') - if out.APIFrameworks == nil { - if !in.IsDelim(']') { - out.APIFrameworks = make([]int, 0, 8) - } else { - out.APIFrameworks = []int{} - } - } else { - out.APIFrameworks = (out.APIFrameworks)[:0] - } - for !in.IsDelim(']') { - var v27 int - v27 = int(in.Int()) - out.APIFrameworks = append(out.APIFrameworks, v27) - in.WantComma() - } - in.Delim(']') - } - case "id": - if in.IsNull() { - in.Skip() - out.ID = nil - } else { - if out.ID == nil { - out.ID = new(string) - } - *out.ID = string(in.String()) - } - case "vcm": - out.VCM = CompanionRenderingMode(in.Int()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson48f1e884EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in Banner) { - out.RawByte('{') - first := true - _ = first - if len(in.Format) != 0 { - const prefix string = ",\"format\":" - first = false - out.RawString(prefix[1:]) - { - out.RawByte('[') - for v28, v29 := range in.Format { - if v28 > 0 { - out.RawByte(',') - } - easyjson48f1e884EncodeGithubComVungleVungoOpenrtb2(out, v29) - } - out.RawByte(']') - } - } - if in.Width != 0 { - const prefix string = ",\"w\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Width)) - } - if in.Height != 0 { - const prefix string = ",\"h\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Height)) - } - if in.MaxWidth != nil { - const prefix string = ",\"wmax\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(*in.MaxWidth)) - } - if in.MaxHeight != nil { - const prefix string = ",\"hmax\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(*in.MaxHeight)) - } - if in.MinWidth != nil { - const prefix string = ",\"wmin\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(*in.MinWidth)) - } - if in.MinHeight != nil { - const prefix string = ",\"hmin\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(*in.MinHeight)) - } - if len(in.BlockedTypes) != 0 { - const prefix string = ",\"btype\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v30, v31 := range in.BlockedTypes { - if v30 > 0 { - out.RawByte(',') - } - out.Int(int(v31)) - } - out.RawByte(']') - } - } - if len(in.BlockedAttributes) != 0 { - const prefix string = ",\"battr\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v32, v33 := range in.BlockedAttributes { - if v32 > 0 { - out.RawByte(',') - } - out.Int(int(v33)) - } - out.RawByte(']') - } - } - if in.Position != 0 { - const prefix string = ",\"pos\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Position)) - } - if len(in.MIMETypes) != 0 { - const prefix string = ",\"mimes\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v34, v35 := range in.MIMETypes { - if v34 > 0 { - out.RawByte(',') - } - out.String(string(v35)) - } - out.RawByte(']') - } - } - if in.TopFrame != nil { - const prefix string = ",\"topframe\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(*in.TopFrame)) - } - if len(in.ExpandDirections) != 0 { - const prefix string = ",\"expdir\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v36, v37 := range in.ExpandDirections { - if v36 > 0 { - out.RawByte(',') - } - out.Int(int(v37)) - } - out.RawByte(']') - } - } - if len(in.APIFrameworks) != 0 { - const prefix string = ",\"api\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v38, v39 := range in.APIFrameworks { - if v38 > 0 { - out.RawByte(',') - } - out.Int(int(v39)) - } - out.RawByte(']') - } - } - if in.ID != nil { - const prefix string = ",\"id\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(*in.ID)) - } - if in.VCM != 0 { - const prefix string = ",\"vcm\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.VCM)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson48f1e884DecodeGithubComVungleVungoOpenrtb2(in *jlexer.Lexer, out *Format) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "w": - out.W = uint64(in.Uint64()) - case "h": - out.H = uint64(in.Uint64()) - case "wratio": - out.WRatio = uint64(in.Uint64()) - case "hratio": - out.HRatio = uint64(in.Uint64()) - case "wmin": - out.WMin = uint64(in.Uint64()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson48f1e884EncodeGithubComVungleVungoOpenrtb2(out *jwriter.Writer, in Format) { - out.RawByte('{') - first := true - _ = first - if in.W != 0 { - const prefix string = ",\"w\":" - first = false - out.RawString(prefix[1:]) - out.Uint64(uint64(in.W)) - } - if in.H != 0 { - const prefix string = ",\"h\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Uint64(uint64(in.H)) - } - if in.WRatio != 0 { - const prefix string = ",\"wratio\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Uint64(uint64(in.WRatio)) - } - if in.HRatio != 0 { - const prefix string = ",\"hratio\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Uint64(uint64(in.HRatio)) - } - if in.WMin != 0 { - const prefix string = ",\"wmin\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Uint64(uint64(in.WMin)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} diff --git a/openrtb/banner_easyjson.go b/openrtb/banner_easyjson.go index f836c0d..793d66c 100644 --- a/openrtb/banner_easyjson.go +++ b/openrtb/banner_easyjson.go @@ -16,598 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjsonC16456caDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Banner) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "format": - if in.IsNull() { - in.Skip() - out.Format = nil - } else { - in.Delim('[') - if out.Format == nil { - if !in.IsDelim(']') { - out.Format = make([]Format, 0, 1) - } else { - out.Format = []Format{} - } - } else { - out.Format = (out.Format)[:0] - } - for !in.IsDelim(']') { - var v1 Format - easyjsonC16456caDecodeGithubComVungleVungoOpenrtb1(in, &v1) - out.Format = append(out.Format, v1) - in.WantComma() - } - in.Delim(']') - } - case "w": - out.Width = int(in.Int()) - case "h": - out.Height = int(in.Int()) - case "wmax": - if in.IsNull() { - in.Skip() - out.MaxWidth = nil - } else { - if out.MaxWidth == nil { - out.MaxWidth = new(int) - } - *out.MaxWidth = int(in.Int()) - } - case "hmax": - if in.IsNull() { - in.Skip() - out.MaxHeight = nil - } else { - if out.MaxHeight == nil { - out.MaxHeight = new(int) - } - *out.MaxHeight = int(in.Int()) - } - case "wmin": - if in.IsNull() { - in.Skip() - out.MinWidth = nil - } else { - if out.MinWidth == nil { - out.MinWidth = new(int) - } - *out.MinWidth = int(in.Int()) - } - case "hmin": - if in.IsNull() { - in.Skip() - out.MinHeight = nil - } else { - if out.MinHeight == nil { - out.MinHeight = new(int) - } - *out.MinHeight = int(in.Int()) - } - case "btype": - if in.IsNull() { - in.Skip() - out.BlockedTypes = nil - } else { - in.Delim('[') - if out.BlockedTypes == nil { - if !in.IsDelim(']') { - out.BlockedTypes = make([]int, 0, 8) - } else { - out.BlockedTypes = []int{} - } - } else { - out.BlockedTypes = (out.BlockedTypes)[:0] - } - for !in.IsDelim(']') { - var v2 int - v2 = int(in.Int()) - out.BlockedTypes = append(out.BlockedTypes, v2) - in.WantComma() - } - in.Delim(']') - } - case "battr": - if in.IsNull() { - in.Skip() - out.BlockedAttributes = nil - } else { - in.Delim('[') - if out.BlockedAttributes == nil { - if !in.IsDelim(']') { - out.BlockedAttributes = make([]int, 0, 8) - } else { - out.BlockedAttributes = []int{} - } - } else { - out.BlockedAttributes = (out.BlockedAttributes)[:0] - } - for !in.IsDelim(']') { - var v3 int - v3 = int(in.Int()) - out.BlockedAttributes = append(out.BlockedAttributes, v3) - in.WantComma() - } - in.Delim(']') - } - case "pos": - out.Position = AdPosition(in.Int()) - case "mimes": - if in.IsNull() { - in.Skip() - out.MIMETypes = nil - } else { - in.Delim('[') - if out.MIMETypes == nil { - if !in.IsDelim(']') { - out.MIMETypes = make([]string, 0, 4) - } else { - out.MIMETypes = []string{} - } - } else { - out.MIMETypes = (out.MIMETypes)[:0] - } - for !in.IsDelim(']') { - var v4 string - v4 = string(in.String()) - out.MIMETypes = append(out.MIMETypes, v4) - in.WantComma() - } - in.Delim(']') - } - case "topframe": - if in.IsNull() { - in.Skip() - out.TopFrame = nil - } else { - if out.TopFrame == nil { - out.TopFrame = new(int) - } - *out.TopFrame = int(in.Int()) - } - case "expdir": - if in.IsNull() { - in.Skip() - out.ExpandDirections = nil - } else { - in.Delim('[') - if out.ExpandDirections == nil { - if !in.IsDelim(']') { - out.ExpandDirections = make([]int, 0, 8) - } else { - out.ExpandDirections = []int{} - } - } else { - out.ExpandDirections = (out.ExpandDirections)[:0] - } - for !in.IsDelim(']') { - var v5 int - v5 = int(in.Int()) - out.ExpandDirections = append(out.ExpandDirections, v5) - in.WantComma() - } - in.Delim(']') - } - case "api": - if in.IsNull() { - in.Skip() - out.APIFrameworks = nil - } else { - in.Delim('[') - if out.APIFrameworks == nil { - if !in.IsDelim(']') { - out.APIFrameworks = make([]int, 0, 8) - } else { - out.APIFrameworks = []int{} - } - } else { - out.APIFrameworks = (out.APIFrameworks)[:0] - } - for !in.IsDelim(']') { - var v6 int - v6 = int(in.Int()) - out.APIFrameworks = append(out.APIFrameworks, v6) - in.WantComma() - } - in.Delim(']') - } - case "id": - if in.IsNull() { - in.Skip() - out.ID = nil - } else { - if out.ID == nil { - out.ID = new(string) - } - *out.ID = string(in.String()) - } - case "vcm": - out.VCM = CompanionRenderingMode(in.Int()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonC16456caEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Banner) { - out.RawByte('{') - first := true - _ = first - if len(in.Format) != 0 { - const prefix string = ",\"format\":" - first = false - out.RawString(prefix[1:]) - { - out.RawByte('[') - for v7, v8 := range in.Format { - if v7 > 0 { - out.RawByte(',') - } - easyjsonC16456caEncodeGithubComVungleVungoOpenrtb1(out, v8) - } - out.RawByte(']') - } - } - if in.Width != 0 { - const prefix string = ",\"w\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Width)) - } - if in.Height != 0 { - const prefix string = ",\"h\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Height)) - } - if in.MaxWidth != nil { - const prefix string = ",\"wmax\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(*in.MaxWidth)) - } - if in.MaxHeight != nil { - const prefix string = ",\"hmax\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(*in.MaxHeight)) - } - if in.MinWidth != nil { - const prefix string = ",\"wmin\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(*in.MinWidth)) - } - if in.MinHeight != nil { - const prefix string = ",\"hmin\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(*in.MinHeight)) - } - if len(in.BlockedTypes) != 0 { - const prefix string = ",\"btype\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v9, v10 := range in.BlockedTypes { - if v9 > 0 { - out.RawByte(',') - } - out.Int(int(v10)) - } - out.RawByte(']') - } - } - if len(in.BlockedAttributes) != 0 { - const prefix string = ",\"battr\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v11, v12 := range in.BlockedAttributes { - if v11 > 0 { - out.RawByte(',') - } - out.Int(int(v12)) - } - out.RawByte(']') - } - } - if in.Position != 0 { - const prefix string = ",\"pos\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Position)) - } - if len(in.MIMETypes) != 0 { - const prefix string = ",\"mimes\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v13, v14 := range in.MIMETypes { - if v13 > 0 { - out.RawByte(',') - } - out.String(string(v14)) - } - out.RawByte(']') - } - } - if in.TopFrame != nil { - const prefix string = ",\"topframe\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(*in.TopFrame)) - } - if len(in.ExpandDirections) != 0 { - const prefix string = ",\"expdir\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v15, v16 := range in.ExpandDirections { - if v15 > 0 { - out.RawByte(',') - } - out.Int(int(v16)) - } - out.RawByte(']') - } - } - if len(in.APIFrameworks) != 0 { - const prefix string = ",\"api\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v17, v18 := range in.APIFrameworks { - if v17 > 0 { - out.RawByte(',') - } - out.Int(int(v18)) - } - out.RawByte(']') - } - } - if in.ID != nil { - const prefix string = ",\"id\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(*in.ID)) - } - if in.VCM != 0 { - const prefix string = ",\"vcm\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.VCM)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Banner) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonC16456caEncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Banner) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC16456caEncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Banner) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonC16456caDecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Banner) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC16456caDecodeGithubComVungleVungoOpenrtb(l, v) -} -func easyjsonC16456caDecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *Format) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "w": - out.W = uint64(in.Uint64()) - case "h": - out.H = uint64(in.Uint64()) - case "wratio": - out.WRatio = uint64(in.Uint64()) - case "hratio": - out.HRatio = uint64(in.Uint64()) - case "wmin": - out.WMin = uint64(in.Uint64()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonC16456caEncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in Format) { - out.RawByte('{') - first := true - _ = first - if in.W != 0 { - const prefix string = ",\"w\":" - first = false - out.RawString(prefix[1:]) - out.Uint64(uint64(in.W)) - } - if in.H != 0 { - const prefix string = ",\"h\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Uint64(uint64(in.H)) - } - if in.WRatio != 0 { - const prefix string = ",\"wratio\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Uint64(uint64(in.WRatio)) - } - if in.HRatio != 0 { - const prefix string = ",\"hratio\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Uint64(uint64(in.HRatio)) - } - if in.WMin != 0 { - const prefix string = ",\"wmin\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Uint64(uint64(in.WMin)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} diff --git a/openrtb/bid_easyjson.go b/openrtb/bid_easyjson.go index a8097eb..793d66c 100644 --- a/openrtb/bid_easyjson.go +++ b/openrtb/bid_easyjson.go @@ -16,344 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson31527abDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Bid) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "impid": - out.ImpressionID = string(in.String()) - case "price": - out.Price = float64(in.Float64()) - case "nurl": - out.WinNotificationURL = string(in.String()) - case "burl": - out.BURL = string(in.String()) - case "lurl": - out.LossNotificationURL = string(in.String()) - case "adm": - out.AdMarkup = string(in.String()) - case "adid": - out.AdID = string(in.String()) - case "adomain": - if in.IsNull() { - in.Skip() - out.AdvertiserDomains = nil - } else { - in.Delim('[') - if out.AdvertiserDomains == nil { - if !in.IsDelim(']') { - out.AdvertiserDomains = make([]string, 0, 4) - } else { - out.AdvertiserDomains = []string{} - } - } else { - out.AdvertiserDomains = (out.AdvertiserDomains)[:0] - } - for !in.IsDelim(']') { - var v1 string - v1 = string(in.String()) - out.AdvertiserDomains = append(out.AdvertiserDomains, v1) - in.WantComma() - } - in.Delim(']') - } - case "bundle": - out.Bundle = string(in.String()) - case "iurl": - out.QualityImageURL = string(in.String()) - case "cid": - out.CampaignID = string(in.String()) - case "crid": - out.CreativeID = string(in.String()) - case "tactic": - out.Tactic = string(in.String()) - case "cat": - if in.IsNull() { - in.Skip() - out.Categories = nil - } else { - in.Delim('[') - if out.Categories == nil { - if !in.IsDelim(']') { - out.Categories = make([]Category, 0, 4) - } else { - out.Categories = []Category{} - } - } else { - out.Categories = (out.Categories)[:0] - } - for !in.IsDelim(']') { - var v2 Category - v2 = Category(in.String()) - out.Categories = append(out.Categories, v2) - in.WantComma() - } - in.Delim(']') - } - case "attr": - if in.IsNull() { - in.Skip() - out.CreativeAttributes = nil - } else { - in.Delim('[') - if out.CreativeAttributes == nil { - if !in.IsDelim(']') { - out.CreativeAttributes = make([]CreativeAttribute, 0, 8) - } else { - out.CreativeAttributes = []CreativeAttribute{} - } - } else { - out.CreativeAttributes = (out.CreativeAttributes)[:0] - } - for !in.IsDelim(']') { - var v3 CreativeAttribute - v3 = CreativeAttribute(in.Int()) - out.CreativeAttributes = append(out.CreativeAttributes, v3) - in.WantComma() - } - in.Delim(']') - } - case "api": - out.API = APIFramework(in.Int()) - case "protocol": - out.Protocol = Protocol(in.Int()) - case "qagmediarating": - out.QAGMediaRating = IQGMediaRating(in.Int()) - case "language": - out.Language = string(in.String()) - case "dealid": - out.DealID = string(in.String()) - case "w": - out.Width = int(in.Int()) - case "h": - out.Height = int(in.Int()) - case "wratio": - out.WRatio = int(in.Int()) - case "hratio": - out.HRatio = int(in.Int()) - case "exp": - out.Exp = int(in.Int()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson31527abEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Bid) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"id\":" - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - { - const prefix string = ",\"impid\":" - out.RawString(prefix) - out.String(string(in.ImpressionID)) - } - { - const prefix string = ",\"price\":" - out.RawString(prefix) - out.Float64(float64(in.Price)) - } - if in.WinNotificationURL != "" { - const prefix string = ",\"nurl\":" - out.RawString(prefix) - out.String(string(in.WinNotificationURL)) - } - if in.BURL != "" { - const prefix string = ",\"burl\":" - out.RawString(prefix) - out.String(string(in.BURL)) - } - if in.LossNotificationURL != "" { - const prefix string = ",\"lurl\":" - out.RawString(prefix) - out.String(string(in.LossNotificationURL)) - } - if in.AdMarkup != "" { - const prefix string = ",\"adm\":" - out.RawString(prefix) - out.String(string(in.AdMarkup)) - } - if in.AdID != "" { - const prefix string = ",\"adid\":" - out.RawString(prefix) - out.String(string(in.AdID)) - } - if len(in.AdvertiserDomains) != 0 { - const prefix string = ",\"adomain\":" - out.RawString(prefix) - { - out.RawByte('[') - for v4, v5 := range in.AdvertiserDomains { - if v4 > 0 { - out.RawByte(',') - } - out.String(string(v5)) - } - out.RawByte(']') - } - } - if in.Bundle != "" { - const prefix string = ",\"bundle\":" - out.RawString(prefix) - out.String(string(in.Bundle)) - } - if in.QualityImageURL != "" { - const prefix string = ",\"iurl\":" - out.RawString(prefix) - out.String(string(in.QualityImageURL)) - } - if in.CampaignID != "" { - const prefix string = ",\"cid\":" - out.RawString(prefix) - out.String(string(in.CampaignID)) - } - if in.CreativeID != "" { - const prefix string = ",\"crid\":" - out.RawString(prefix) - out.String(string(in.CreativeID)) - } - if in.Tactic != "" { - const prefix string = ",\"tactic\":" - out.RawString(prefix) - out.String(string(in.Tactic)) - } - if len(in.Categories) != 0 { - const prefix string = ",\"cat\":" - out.RawString(prefix) - { - out.RawByte('[') - for v6, v7 := range in.Categories { - if v6 > 0 { - out.RawByte(',') - } - out.String(string(v7)) - } - out.RawByte(']') - } - } - if len(in.CreativeAttributes) != 0 { - const prefix string = ",\"attr\":" - out.RawString(prefix) - { - out.RawByte('[') - for v8, v9 := range in.CreativeAttributes { - if v8 > 0 { - out.RawByte(',') - } - out.Int(int(v9)) - } - out.RawByte(']') - } - } - if in.API != 0 { - const prefix string = ",\"api\":" - out.RawString(prefix) - out.Int(int(in.API)) - } - if in.Protocol != 0 { - const prefix string = ",\"protocol\":" - out.RawString(prefix) - out.Int(int(in.Protocol)) - } - if in.QAGMediaRating != 0 { - const prefix string = ",\"qagmediarating\":" - out.RawString(prefix) - out.Int(int(in.QAGMediaRating)) - } - if in.Language != "" { - const prefix string = ",\"language\":" - out.RawString(prefix) - out.String(string(in.Language)) - } - if in.DealID != "" { - const prefix string = ",\"dealid\":" - out.RawString(prefix) - out.String(string(in.DealID)) - } - if in.Width != 0 { - const prefix string = ",\"w\":" - out.RawString(prefix) - out.Int(int(in.Width)) - } - if in.Height != 0 { - const prefix string = ",\"h\":" - out.RawString(prefix) - out.Int(int(in.Height)) - } - if in.WRatio != 0 { - const prefix string = ",\"wratio\":" - out.RawString(prefix) - out.Int(int(in.WRatio)) - } - if in.HRatio != 0 { - const prefix string = ",\"hratio\":" - out.RawString(prefix) - out.Int(int(in.HRatio)) - } - if in.Exp != 0 { - const prefix string = ",\"exp\":" - out.RawString(prefix) - out.Int(int(in.Exp)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Bid) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson31527abEncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Bid) MarshalEasyJSON(w *jwriter.Writer) { - easyjson31527abEncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Bid) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson31527abDecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Bid) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson31527abDecodeGithubComVungleVungoOpenrtb(l, v) -} diff --git a/openrtb/bidrequest_easyjson.go b/openrtb/bidrequest_easyjson.go index 460b132..793d66c 100644 --- a/openrtb/bidrequest_easyjson.go +++ b/openrtb/bidrequest_easyjson.go @@ -16,3982 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *BidRequest) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "imp": - if in.IsNull() { - in.Skip() - out.Impressions = nil - } else { - in.Delim('[') - if out.Impressions == nil { - if !in.IsDelim(']') { - out.Impressions = make([]*Impression, 0, 8) - } else { - out.Impressions = []*Impression{} - } - } else { - out.Impressions = (out.Impressions)[:0] - } - for !in.IsDelim(']') { - var v1 *Impression - if in.IsNull() { - in.Skip() - v1 = nil - } else { - if v1 == nil { - v1 = new(Impression) - } - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb1(in, v1) - } - out.Impressions = append(out.Impressions, v1) - in.WantComma() - } - in.Delim(']') - } - case "site": - if in.IsNull() { - in.Skip() - out.Site = nil - } else { - if out.Site == nil { - out.Site = new(Site) - } - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb2(in, out.Site) - } - case "app": - if in.IsNull() { - in.Skip() - out.Application = nil - } else { - if out.Application == nil { - out.Application = new(Application) - } - (*out.Application).UnmarshalEasyJSON(in) - } - case "device": - if in.IsNull() { - in.Skip() - out.Device = nil - } else { - if out.Device == nil { - out.Device = new(Device) - } - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb3(in, out.Device) - } - case "user": - if in.IsNull() { - in.Skip() - out.User = nil - } else { - if out.User == nil { - out.User = new(User) - } - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb4(in, out.User) - } - case "test": - if data := in.Raw(); in.Ok() { - in.AddError((out.IsTestMode).UnmarshalJSON(data)) - } - case "at": - out.AuctionType = BidAuctionType(in.Int()) - case "tmax": - out.Timeout = int(in.Int()) - case "wseat": - if in.IsNull() { - in.Skip() - out.WhitelistedSeats = nil - } else { - in.Delim('[') - if out.WhitelistedSeats == nil { - if !in.IsDelim(']') { - out.WhitelistedSeats = make([]string, 0, 4) - } else { - out.WhitelistedSeats = []string{} - } - } else { - out.WhitelistedSeats = (out.WhitelistedSeats)[:0] - } - for !in.IsDelim(']') { - var v2 string - v2 = string(in.String()) - out.WhitelistedSeats = append(out.WhitelistedSeats, v2) - in.WantComma() - } - in.Delim(']') - } - case "bseat": - if in.IsNull() { - in.Skip() - out.BlocklistedSeats = nil - } else { - in.Delim('[') - if out.BlocklistedSeats == nil { - if !in.IsDelim(']') { - out.BlocklistedSeats = make([]string, 0, 4) - } else { - out.BlocklistedSeats = []string{} - } - } else { - out.BlocklistedSeats = (out.BlocklistedSeats)[:0] - } - for !in.IsDelim(']') { - var v3 string - v3 = string(in.String()) - out.BlocklistedSeats = append(out.BlocklistedSeats, v3) - in.WantComma() - } - in.Delim(']') - } - case "allimps": - if data := in.Raw(); in.Ok() { - in.AddError((out.HasAllImpressions).UnmarshalJSON(data)) - } - case "cur": - if in.IsNull() { - in.Skip() - out.Currencies = nil - } else { - in.Delim('[') - if out.Currencies == nil { - if !in.IsDelim(']') { - out.Currencies = make([]Currency, 0, 4) - } else { - out.Currencies = []Currency{} - } - } else { - out.Currencies = (out.Currencies)[:0] - } - for !in.IsDelim(']') { - var v4 Currency - v4 = Currency(in.String()) - out.Currencies = append(out.Currencies, v4) - in.WantComma() - } - in.Delim(']') - } - case "wlang": - if in.IsNull() { - in.Skip() - out.WhitelistLanguages = nil - } else { - in.Delim('[') - if out.WhitelistLanguages == nil { - if !in.IsDelim(']') { - out.WhitelistLanguages = make([]string, 0, 4) - } else { - out.WhitelistLanguages = []string{} - } - } else { - out.WhitelistLanguages = (out.WhitelistLanguages)[:0] - } - for !in.IsDelim(']') { - var v5 string - v5 = string(in.String()) - out.WhitelistLanguages = append(out.WhitelistLanguages, v5) - in.WantComma() - } - in.Delim(']') - } - case "bcat": - if in.IsNull() { - in.Skip() - out.BlockedCategories = nil - } else { - in.Delim('[') - if out.BlockedCategories == nil { - if !in.IsDelim(']') { - out.BlockedCategories = make([]Category, 0, 4) - } else { - out.BlockedCategories = []Category{} - } - } else { - out.BlockedCategories = (out.BlockedCategories)[:0] - } - for !in.IsDelim(']') { - var v6 Category - v6 = Category(in.String()) - out.BlockedCategories = append(out.BlockedCategories, v6) - in.WantComma() - } - in.Delim(']') - } - case "badv": - if in.IsNull() { - in.Skip() - out.BlockedAdvertisers = nil - } else { - in.Delim('[') - if out.BlockedAdvertisers == nil { - if !in.IsDelim(']') { - out.BlockedAdvertisers = make([]string, 0, 4) - } else { - out.BlockedAdvertisers = []string{} - } - } else { - out.BlockedAdvertisers = (out.BlockedAdvertisers)[:0] - } - for !in.IsDelim(']') { - var v7 string - v7 = string(in.String()) - out.BlockedAdvertisers = append(out.BlockedAdvertisers, v7) - in.WantComma() - } - in.Delim(']') - } - case "bapp": - if in.IsNull() { - in.Skip() - out.BlockedAdvertisersByMarketID = nil - } else { - in.Delim('[') - if out.BlockedAdvertisersByMarketID == nil { - if !in.IsDelim(']') { - out.BlockedAdvertisersByMarketID = make([]string, 0, 4) - } else { - out.BlockedAdvertisersByMarketID = []string{} - } - } else { - out.BlockedAdvertisersByMarketID = (out.BlockedAdvertisersByMarketID)[:0] - } - for !in.IsDelim(']') { - var v8 string - v8 = string(in.String()) - out.BlockedAdvertisersByMarketID = append(out.BlockedAdvertisersByMarketID, v8) - in.WantComma() - } - in.Delim(']') - } - case "source": - if in.IsNull() { - in.Skip() - out.Source = nil - } else { - if out.Source == nil { - out.Source = new(Source) - } - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb5(in, out.Source) - } - case "regs": - if in.IsNull() { - in.Skip() - out.Regulation = nil - } else { - if out.Regulation == nil { - out.Regulation = new(Regulation) - } - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb6(in, out.Regulation) - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in BidRequest) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"id\":" - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - { - const prefix string = ",\"imp\":" - out.RawString(prefix) - if in.Impressions == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v9, v10 := range in.Impressions { - if v9 > 0 { - out.RawByte(',') - } - if v10 == nil { - out.RawString("null") - } else { - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb1(out, *v10) - } - } - out.RawByte(']') - } - } - if in.Site != nil { - const prefix string = ",\"site\":" - out.RawString(prefix) - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb2(out, *in.Site) - } - if in.Application != nil { - const prefix string = ",\"app\":" - out.RawString(prefix) - (*in.Application).MarshalEasyJSON(out) - } - if in.Device != nil { - const prefix string = ",\"device\":" - out.RawString(prefix) - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb3(out, *in.Device) - } - if in.User != nil { - const prefix string = ",\"user\":" - out.RawString(prefix) - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb4(out, *in.User) - } - if in.IsTestMode { - const prefix string = ",\"test\":" - out.RawString(prefix) - out.Raw((in.IsTestMode).MarshalJSON()) - } - { - const prefix string = ",\"at\":" - out.RawString(prefix) - out.Int(int(in.AuctionType)) - } - if in.Timeout != 0 { - const prefix string = ",\"tmax\":" - out.RawString(prefix) - out.Int(int(in.Timeout)) - } - if len(in.WhitelistedSeats) != 0 { - const prefix string = ",\"wseat\":" - out.RawString(prefix) - { - out.RawByte('[') - for v11, v12 := range in.WhitelistedSeats { - if v11 > 0 { - out.RawByte(',') - } - out.String(string(v12)) - } - out.RawByte(']') - } - } - if len(in.BlocklistedSeats) != 0 { - const prefix string = ",\"bseat\":" - out.RawString(prefix) - { - out.RawByte('[') - for v13, v14 := range in.BlocklistedSeats { - if v13 > 0 { - out.RawByte(',') - } - out.String(string(v14)) - } - out.RawByte(']') - } - } - if in.HasAllImpressions { - const prefix string = ",\"allimps\":" - out.RawString(prefix) - out.Raw((in.HasAllImpressions).MarshalJSON()) - } - if len(in.Currencies) != 0 { - const prefix string = ",\"cur\":" - out.RawString(prefix) - { - out.RawByte('[') - for v15, v16 := range in.Currencies { - if v15 > 0 { - out.RawByte(',') - } - out.String(string(v16)) - } - out.RawByte(']') - } - } - if len(in.WhitelistLanguages) != 0 { - const prefix string = ",\"wlang\":" - out.RawString(prefix) - { - out.RawByte('[') - for v17, v18 := range in.WhitelistLanguages { - if v17 > 0 { - out.RawByte(',') - } - out.String(string(v18)) - } - out.RawByte(']') - } - } - if len(in.BlockedCategories) != 0 { - const prefix string = ",\"bcat\":" - out.RawString(prefix) - { - out.RawByte('[') - for v19, v20 := range in.BlockedCategories { - if v19 > 0 { - out.RawByte(',') - } - out.String(string(v20)) - } - out.RawByte(']') - } - } - if len(in.BlockedAdvertisers) != 0 { - const prefix string = ",\"badv\":" - out.RawString(prefix) - { - out.RawByte('[') - for v21, v22 := range in.BlockedAdvertisers { - if v21 > 0 { - out.RawByte(',') - } - out.String(string(v22)) - } - out.RawByte(']') - } - } - if len(in.BlockedAdvertisersByMarketID) != 0 { - const prefix string = ",\"bapp\":" - out.RawString(prefix) - { - out.RawByte('[') - for v23, v24 := range in.BlockedAdvertisersByMarketID { - if v23 > 0 { - out.RawByte(',') - } - out.String(string(v24)) - } - out.RawByte(']') - } - } - if in.Source != nil { - const prefix string = ",\"source\":" - out.RawString(prefix) - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb5(out, *in.Source) - } - if in.Regulation != nil { - const prefix string = ",\"regs\":" - out.RawString(prefix) - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb6(out, *in.Regulation) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v BidRequest) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v BidRequest) MarshalEasyJSON(w *jwriter.Writer) { - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *BidRequest) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *BidRequest) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb(l, v) -} -func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb6(in *jlexer.Lexer, out *Regulation) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "coppa": - if in.IsNull() { - in.Skip() - out.IsCoppaCompliant = nil - } else { - if out.IsCoppaCompliant == nil { - out.IsCoppaCompliant = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.IsCoppaCompliant).UnmarshalJSON(data)) - } - } - case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb6(out *jwriter.Writer, in Regulation) { - out.RawByte('{') - first := true - _ = first - if in.IsCoppaCompliant != nil { - const prefix string = ",\"coppa\":" - first = false - out.RawString(prefix[1:]) - out.Raw((*in.IsCoppaCompliant).MarshalJSON()) - } - if in.Extension != nil { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } - } - out.RawByte('}') -} -func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb5(in *jlexer.Lexer, out *Source) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "fd": - out.FD = int8(in.Int8()) - case "tid": - out.TID = string(in.String()) - case "pchain": - out.PChain = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb5(out *jwriter.Writer, in Source) { - out.RawByte('{') - first := true - _ = first - if in.FD != 0 { - const prefix string = ",\"fd\":" - first = false - out.RawString(prefix[1:]) - out.Int8(int8(in.FD)) - } - if in.TID != "" { - const prefix string = ",\"tid\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.TID)) - } - if in.PChain != "" { - const prefix string = ",\"pchain\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.PChain)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb4(in *jlexer.Lexer, out *User) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "buyeruid": - out.BuyerID = string(in.String()) - case "yob": - out.BirthYear = int(in.Int()) - case "gender": - out.Gender = Gender(in.String()) - case "keywords": - out.Keywords = string(in.String()) - case "customdata": - out.CustomData = string(in.String()) - case "geo": - if in.IsNull() { - in.Skip() - out.Geo = nil - } else { - if out.Geo == nil { - out.Geo = new(Geo) - } - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb7(in, out.Geo) - } - case "data": - if in.IsNull() { - in.Skip() - out.Data = nil - } else { - in.Delim('[') - if out.Data == nil { - if !in.IsDelim(']') { - out.Data = make([]Data, 0, 1) - } else { - out.Data = []Data{} - } - } else { - out.Data = (out.Data)[:0] - } - for !in.IsDelim(']') { - var v25 Data - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb8(in, &v25) - out.Data = append(out.Data, v25) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb4(out *jwriter.Writer, in User) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.BuyerID != "" { - const prefix string = ",\"buyeruid\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.BuyerID)) - } - if in.BirthYear != 0 { - const prefix string = ",\"yob\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.BirthYear)) - } - if in.Gender != "" { - const prefix string = ",\"gender\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Gender)) - } - if in.Keywords != "" { - const prefix string = ",\"keywords\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Keywords)) - } - if in.CustomData != "" { - const prefix string = ",\"customdata\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.CustomData)) - } - if in.Geo != nil { - const prefix string = ",\"geo\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb7(out, *in.Geo) - } - if len(in.Data) != 0 { - const prefix string = ",\"data\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v26, v27 := range in.Data { - if v26 > 0 { - out.RawByte(',') - } - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb8(out, v27) - } - out.RawByte(']') - } - } - if in.Extension != nil { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } - } - out.RawByte('}') -} -func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb8(in *jlexer.Lexer, out *Data) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "segment": - if in.IsNull() { - in.Skip() - out.Segment = nil - } else { - in.Delim('[') - if out.Segment == nil { - if !in.IsDelim(']') { - out.Segment = make([]*Segment, 0, 8) - } else { - out.Segment = []*Segment{} - } - } else { - out.Segment = (out.Segment)[:0] - } - for !in.IsDelim(']') { - var v28 *Segment - if in.IsNull() { - in.Skip() - v28 = nil - } else { - if v28 == nil { - v28 = new(Segment) - } - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb9(in, v28) - } - out.Segment = append(out.Segment, v28) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb8(out *jwriter.Writer, in Data) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Name != "" { - const prefix string = ",\"name\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Name)) - } - if len(in.Segment) != 0 { - const prefix string = ",\"segment\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v29, v30 := range in.Segment { - if v29 > 0 { - out.RawByte(',') - } - if v30 == nil { - out.RawString("null") - } else { - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb9(out, *v30) - } - } - out.RawByte(']') - } - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb9(in *jlexer.Lexer, out *Segment) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "value": - out.Value = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb9(out *jwriter.Writer, in Segment) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Name != "" { - const prefix string = ",\"name\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Name)) - } - if in.Value != "" { - const prefix string = ",\"value\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Value)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb7(in *jlexer.Lexer, out *Geo) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "lat": - out.Latitude = float64(in.Float64()) - case "lon": - out.Longitude = float64(in.Float64()) - case "type": - out.Type = LocationType(in.Int()) - case "accuracy": - out.Accuracy = int(in.Int()) - case "lastfix": - out.LastFix = int(in.Int()) - case "ipservice": - out.IPService = IPLocationService(in.Int()) - case "country": - out.Country = string(in.String()) - case "region": - out.Region = string(in.String()) - case "regionfips104": - out.RegionFIPS104 = string(in.String()) - case "metro": - out.Metro = string(in.String()) - case "city": - out.City = string(in.String()) - case "zip": - out.ZipCode = string(in.String()) - case "utcoffset": - out.UTCOffset = int(in.Int()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb7(out *jwriter.Writer, in Geo) { - out.RawByte('{') - first := true - _ = first - if in.Latitude != 0 { - const prefix string = ",\"lat\":" - first = false - out.RawString(prefix[1:]) - out.Float64(float64(in.Latitude)) - } - if in.Longitude != 0 { - const prefix string = ",\"lon\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Float64(float64(in.Longitude)) - } - if in.Type != 0 { - const prefix string = ",\"type\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Type)) - } - if in.Accuracy != 0 { - const prefix string = ",\"accuracy\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Accuracy)) - } - if in.LastFix != 0 { - const prefix string = ",\"lastfix\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.LastFix)) - } - if in.IPService != 0 { - const prefix string = ",\"ipservice\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.IPService)) - } - if in.Country != "" { - const prefix string = ",\"country\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Country)) - } - if in.Region != "" { - const prefix string = ",\"region\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Region)) - } - if in.RegionFIPS104 != "" { - const prefix string = ",\"regionfips104\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.RegionFIPS104)) - } - if in.Metro != "" { - const prefix string = ",\"metro\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Metro)) - } - if in.City != "" { - const prefix string = ",\"city\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.City)) - } - if in.ZipCode != "" { - const prefix string = ",\"zip\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.ZipCode)) - } - if in.UTCOffset != 0 { - const prefix string = ",\"utcoffset\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.UTCOffset)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb3(in *jlexer.Lexer, out *Device) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "ua": - out.BrowserUserAgent = string(in.String()) - case "geo": - if in.IsNull() { - in.Skip() - out.Geo = nil - } else { - if out.Geo == nil { - out.Geo = new(Geo) - } - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb7(in, out.Geo) - } - case "dnt": - if in.IsNull() { - in.Skip() - out.HasDoNotTrack = nil - } else { - if out.HasDoNotTrack == nil { - out.HasDoNotTrack = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.HasDoNotTrack).UnmarshalJSON(data)) - } - } - case "lmt": - if in.IsNull() { - in.Skip() - out.HasLimitedAdTracking = nil - } else { - if out.HasLimitedAdTracking == nil { - out.HasLimitedAdTracking = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.HasLimitedAdTracking).UnmarshalJSON(data)) - } - } - case "ip": - out.IP = string(in.String()) - case "ipv6": - out.IPv6 = string(in.String()) - case "devicetype": - out.Type = DeviceType(in.Int()) - case "make": - out.Make = string(in.String()) - case "model": - out.Model = string(in.String()) - case "os": - if data := in.Raw(); in.Ok() { - in.AddError((out.OS).UnmarshalJSON(data)) - } - case "osv": - out.OSVersion = OSVersion(in.String()) - case "hwv": - out.HardwareVersion = string(in.String()) - case "h": - out.Height = int(in.Int()) - case "w": - out.Width = int(in.Int()) - case "ppi": - out.PPI = int(in.Int()) - case "pxratio": - out.PixelRatio = float64(in.Float64()) - case "js": - if in.IsNull() { - in.Skip() - out.SupportsJavaScript = nil - } else { - if out.SupportsJavaScript == nil { - out.SupportsJavaScript = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.SupportsJavaScript).UnmarshalJSON(data)) - } - } - case "geofetch": - if in.IsNull() { - in.Skip() - out.GeoFetch = nil - } else { - if out.GeoFetch == nil { - out.GeoFetch = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.GeoFetch).UnmarshalJSON(data)) - } - } - case "flashver": - out.FlashVersion = string(in.String()) - case "language": - out.Language = string(in.String()) - case "carrier": - out.Carrier = string(in.String()) - case "mccmnc": - out.MCCMNC = string(in.String()) - case "connectiontype": - out.ConnectionType = ConnectionType(in.Int()) - case "ifa": - out.IFA = string(in.String()) - case "didsha1": - out.HardwareIDSHA1 = string(in.String()) - case "didmd5": - out.HardwareIDMD5 = string(in.String()) - case "dpidsha1": - out.PlatformIDSHA1 = string(in.String()) - case "dpidmd5": - out.PlatformIDMD5 = string(in.String()) - case "macsha1": - out.MACSHA1 = string(in.String()) - case "macmd5": - out.MACMD5 = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb3(out *jwriter.Writer, in Device) { - out.RawByte('{') - first := true - _ = first - if in.BrowserUserAgent != "" { - const prefix string = ",\"ua\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.BrowserUserAgent)) - } - if in.Geo != nil { - const prefix string = ",\"geo\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb7(out, *in.Geo) - } - if in.HasDoNotTrack != nil { - const prefix string = ",\"dnt\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.HasDoNotTrack).MarshalJSON()) - } - if in.HasLimitedAdTracking != nil { - const prefix string = ",\"lmt\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.HasLimitedAdTracking).MarshalJSON()) - } - if in.IP != "" { - const prefix string = ",\"ip\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.IP)) - } - if in.IPv6 != "" { - const prefix string = ",\"ipv6\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.IPv6)) - } - if in.Type != 0 { - const prefix string = ",\"devicetype\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Type)) - } - if in.Make != "" { - const prefix string = ",\"make\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Make)) - } - if in.Model != "" { - const prefix string = ",\"model\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Model)) - } - if in.OS != "" { - const prefix string = ",\"os\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.OS)) - } - if in.OSVersion != "" { - const prefix string = ",\"osv\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.OSVersion)) - } - if in.HardwareVersion != "" { - const prefix string = ",\"hwv\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.HardwareVersion)) - } - if in.Height != 0 { - const prefix string = ",\"h\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Height)) - } - if in.Width != 0 { - const prefix string = ",\"w\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Width)) - } - if in.PPI != 0 { - const prefix string = ",\"ppi\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.PPI)) - } - if in.PixelRatio != 0 { - const prefix string = ",\"pxratio\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Float64(float64(in.PixelRatio)) - } - if in.SupportsJavaScript != nil { - const prefix string = ",\"js\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.SupportsJavaScript).MarshalJSON()) - } - if in.GeoFetch != nil { - const prefix string = ",\"geofetch\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.GeoFetch).MarshalJSON()) - } - if in.FlashVersion != "" { - const prefix string = ",\"flashver\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.FlashVersion)) - } - if in.Language != "" { - const prefix string = ",\"language\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Language)) - } - if in.Carrier != "" { - const prefix string = ",\"carrier\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Carrier)) - } - if in.MCCMNC != "" { - const prefix string = ",\"mccmnc\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.MCCMNC)) - } - if in.ConnectionType != 0 { - const prefix string = ",\"connectiontype\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.ConnectionType)) - } - if in.IFA != "" { - const prefix string = ",\"ifa\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.IFA)) - } - if in.HardwareIDSHA1 != "" { - const prefix string = ",\"didsha1\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.HardwareIDSHA1)) - } - if in.HardwareIDMD5 != "" { - const prefix string = ",\"didmd5\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.HardwareIDMD5)) - } - if in.PlatformIDSHA1 != "" { - const prefix string = ",\"dpidsha1\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.PlatformIDSHA1)) - } - if in.PlatformIDMD5 != "" { - const prefix string = ",\"dpidmd5\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.PlatformIDMD5)) - } - if in.MACSHA1 != "" { - const prefix string = ",\"macsha1\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.MACSHA1)) - } - if in.MACMD5 != "" { - const prefix string = ",\"macmd5\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.MACMD5)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb2(in *jlexer.Lexer, out *Site) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "domain": - out.Domain = string(in.String()) - case "cat": - if in.IsNull() { - in.Skip() - out.Cat = nil - } else { - in.Delim('[') - if out.Cat == nil { - if !in.IsDelim(']') { - out.Cat = make([]string, 0, 4) - } else { - out.Cat = []string{} - } - } else { - out.Cat = (out.Cat)[:0] - } - for !in.IsDelim(']') { - var v31 string - v31 = string(in.String()) - out.Cat = append(out.Cat, v31) - in.WantComma() - } - in.Delim(']') - } - case "sectioncat": - if in.IsNull() { - in.Skip() - out.SectionCat = nil - } else { - in.Delim('[') - if out.SectionCat == nil { - if !in.IsDelim(']') { - out.SectionCat = make([]string, 0, 4) - } else { - out.SectionCat = []string{} - } - } else { - out.SectionCat = (out.SectionCat)[:0] - } - for !in.IsDelim(']') { - var v32 string - v32 = string(in.String()) - out.SectionCat = append(out.SectionCat, v32) - in.WantComma() - } - in.Delim(']') - } - case "pagecat": - if in.IsNull() { - in.Skip() - out.PageCat = nil - } else { - in.Delim('[') - if out.PageCat == nil { - if !in.IsDelim(']') { - out.PageCat = make([]string, 0, 4) - } else { - out.PageCat = []string{} - } - } else { - out.PageCat = (out.PageCat)[:0] - } - for !in.IsDelim(']') { - var v33 string - v33 = string(in.String()) - out.PageCat = append(out.PageCat, v33) - in.WantComma() - } - in.Delim(']') - } - case "page": - out.Page = string(in.String()) - case "ref": - out.Ref = string(in.String()) - case "search": - out.Search = string(in.String()) - case "mobile": - if in.IsNull() { - in.Skip() - out.Mobile = nil - } else { - if out.Mobile == nil { - out.Mobile = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.Mobile).UnmarshalJSON(data)) - } - } - case "privacypolicy": - if in.IsNull() { - in.Skip() - out.PrivacyPolicy = nil - } else { - if out.PrivacyPolicy == nil { - out.PrivacyPolicy = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.PrivacyPolicy).UnmarshalJSON(data)) - } - } - case "publisher": - if in.IsNull() { - in.Skip() - out.Publisher = nil - } else { - if out.Publisher == nil { - out.Publisher = new(Publisher) - } - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb10(in, out.Publisher) - } - case "content": - if in.IsNull() { - in.Skip() - out.Content = nil - } else { - if out.Content == nil { - out.Content = new(Content) - } - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb11(in, out.Content) - } - case "keywords": - out.Keywords = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb2(out *jwriter.Writer, in Site) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Name != "" { - const prefix string = ",\"name\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Name)) - } - if in.Domain != "" { - const prefix string = ",\"domain\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Domain)) - } - if len(in.Cat) != 0 { - const prefix string = ",\"cat\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v34, v35 := range in.Cat { - if v34 > 0 { - out.RawByte(',') - } - out.String(string(v35)) - } - out.RawByte(']') - } - } - if len(in.SectionCat) != 0 { - const prefix string = ",\"sectioncat\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v36, v37 := range in.SectionCat { - if v36 > 0 { - out.RawByte(',') - } - out.String(string(v37)) - } - out.RawByte(']') - } - } - if len(in.PageCat) != 0 { - const prefix string = ",\"pagecat\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v38, v39 := range in.PageCat { - if v38 > 0 { - out.RawByte(',') - } - out.String(string(v39)) - } - out.RawByte(']') - } - } - if in.Page != "" { - const prefix string = ",\"page\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Page)) - } - if in.Ref != "" { - const prefix string = ",\"ref\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Ref)) - } - if in.Search != "" { - const prefix string = ",\"search\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Search)) - } - if in.Mobile != nil { - const prefix string = ",\"mobile\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.Mobile).MarshalJSON()) - } - if in.PrivacyPolicy != nil { - const prefix string = ",\"privacypolicy\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.PrivacyPolicy).MarshalJSON()) - } - if in.Publisher != nil { - const prefix string = ",\"publisher\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb10(out, *in.Publisher) - } - if in.Content != nil { - const prefix string = ",\"content\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb11(out, *in.Content) - } - if in.Keywords != "" { - const prefix string = ",\"keywords\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Keywords)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb11(in *jlexer.Lexer, out *Content) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "episode": - if in.IsNull() { - in.Skip() - out.Episode = nil - } else { - if out.Episode == nil { - out.Episode = new(int) - } - *out.Episode = int(in.Int()) - } - case "title": - out.Title = string(in.String()) - case "series": - out.Series = string(in.String()) - case "season": - out.Season = string(in.String()) - case "artist": - out.Artist = string(in.String()) - case "genre": - out.Genre = string(in.String()) - case "album": - out.Album = string(in.String()) - case "isrc": - out.ISRC = string(in.String()) - case "producer": - if in.IsNull() { - in.Skip() - out.Producer = nil - } else { - if out.Producer == nil { - out.Producer = new(Producer) - } - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb12(in, out.Producer) - } - case "url": - out.URL = string(in.String()) - case "cat": - if in.IsNull() { - in.Skip() - out.Cat = nil - } else { - in.Delim('[') - if out.Cat == nil { - if !in.IsDelim(']') { - out.Cat = make([]string, 0, 4) - } else { - out.Cat = []string{} - } - } else { - out.Cat = (out.Cat)[:0] - } - for !in.IsDelim(']') { - var v40 string - v40 = string(in.String()) - out.Cat = append(out.Cat, v40) - in.WantComma() - } - in.Delim(']') - } - case "prodq": - out.ProdQ = ProductionQuality(in.Int()) - case "videoquality": - out.VideoQuality = ProductionQuality(in.Int()) - case "context": - out.Context = ContentContext(in.Int()) - case "contentrating": - out.ContentRating = string(in.String()) - case "userrating": - out.UserRating = string(in.String()) - case "qagmediarating": - out.QAGMediaRating = IQGMediaRating(in.Int()) - case "keywords": - out.Keywords = string(in.String()) - case "livestream": - if in.IsNull() { - in.Skip() - out.LiveStream = nil - } else { - if out.LiveStream == nil { - out.LiveStream = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.LiveStream).UnmarshalJSON(data)) - } - } - case "sourcerelationship": - if in.IsNull() { - in.Skip() - out.SourceRelationship = nil - } else { - if out.SourceRelationship == nil { - out.SourceRelationship = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.SourceRelationship).UnmarshalJSON(data)) - } - } - case "len": - if in.IsNull() { - in.Skip() - out.Len = nil - } else { - if out.Len == nil { - out.Len = new(int) - } - *out.Len = int(in.Int()) - } - case "language": - out.Language = string(in.String()) - case "embeddable": - if in.IsNull() { - in.Skip() - out.Embeddable = nil - } else { - if out.Embeddable == nil { - out.Embeddable = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.Embeddable).UnmarshalJSON(data)) - } - } - case "data": - if in.IsNull() { - in.Skip() - out.Data = nil - } else { - in.Delim('[') - if out.Data == nil { - if !in.IsDelim(']') { - out.Data = make([]*Data, 0, 8) - } else { - out.Data = []*Data{} - } - } else { - out.Data = (out.Data)[:0] - } - for !in.IsDelim(']') { - var v41 *Data - if in.IsNull() { - in.Skip() - v41 = nil - } else { - if v41 == nil { - v41 = new(Data) - } - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb8(in, v41) - } - out.Data = append(out.Data, v41) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb11(out *jwriter.Writer, in Content) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Episode != nil { - const prefix string = ",\"episode\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(*in.Episode)) - } - if in.Title != "" { - const prefix string = ",\"title\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Title)) - } - if in.Series != "" { - const prefix string = ",\"series\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Series)) - } - if in.Season != "" { - const prefix string = ",\"season\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Season)) - } - if in.Artist != "" { - const prefix string = ",\"artist\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Artist)) - } - if in.Genre != "" { - const prefix string = ",\"genre\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Genre)) - } - if in.Album != "" { - const prefix string = ",\"album\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Album)) - } - if in.ISRC != "" { - const prefix string = ",\"isrc\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.ISRC)) - } - if in.Producer != nil { - const prefix string = ",\"producer\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb12(out, *in.Producer) - } - if in.URL != "" { - const prefix string = ",\"url\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.URL)) - } - if len(in.Cat) != 0 { - const prefix string = ",\"cat\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v42, v43 := range in.Cat { - if v42 > 0 { - out.RawByte(',') - } - out.String(string(v43)) - } - out.RawByte(']') - } - } - if in.ProdQ != 0 { - const prefix string = ",\"prodq\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.ProdQ)) - } - if in.VideoQuality != 0 { - const prefix string = ",\"videoquality\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.VideoQuality)) - } - if in.Context != 0 { - const prefix string = ",\"context\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Context)) - } - if in.ContentRating != "" { - const prefix string = ",\"contentrating\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.ContentRating)) - } - if in.UserRating != "" { - const prefix string = ",\"userrating\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.UserRating)) - } - if in.QAGMediaRating != 0 { - const prefix string = ",\"qagmediarating\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.QAGMediaRating)) - } - if in.Keywords != "" { - const prefix string = ",\"keywords\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Keywords)) - } - if in.LiveStream != nil { - const prefix string = ",\"livestream\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.LiveStream).MarshalJSON()) - } - if in.SourceRelationship != nil { - const prefix string = ",\"sourcerelationship\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.SourceRelationship).MarshalJSON()) - } - if in.Len != nil { - const prefix string = ",\"len\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(*in.Len)) - } - if in.Language != "" { - const prefix string = ",\"language\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Language)) - } - if in.Embeddable != nil { - const prefix string = ",\"embeddable\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.Embeddable).MarshalJSON()) - } - if len(in.Data) != 0 { - const prefix string = ",\"data\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v44, v45 := range in.Data { - if v44 > 0 { - out.RawByte(',') - } - if v45 == nil { - out.RawString("null") - } else { - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb8(out, *v45) - } - } - out.RawByte(']') - } - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb12(in *jlexer.Lexer, out *Producer) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "cat": - if in.IsNull() { - in.Skip() - out.Cat = nil - } else { - in.Delim('[') - if out.Cat == nil { - if !in.IsDelim(']') { - out.Cat = make([]string, 0, 4) - } else { - out.Cat = []string{} - } - } else { - out.Cat = (out.Cat)[:0] - } - for !in.IsDelim(']') { - var v46 string - v46 = string(in.String()) - out.Cat = append(out.Cat, v46) - in.WantComma() - } - in.Delim(']') - } - case "domain": - out.Domain = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb12(out *jwriter.Writer, in Producer) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Name != "" { - const prefix string = ",\"name\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Name)) - } - if len(in.Cat) != 0 { - const prefix string = ",\"cat\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v47, v48 := range in.Cat { - if v47 > 0 { - out.RawByte(',') - } - out.String(string(v48)) - } - out.RawByte(']') - } - } - if in.Domain != "" { - const prefix string = ",\"domain\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Domain)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb10(in *jlexer.Lexer, out *Publisher) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "cat": - if in.IsNull() { - in.Skip() - out.Categories = nil - } else { - in.Delim('[') - if out.Categories == nil { - if !in.IsDelim(']') { - out.Categories = make([]Category, 0, 4) - } else { - out.Categories = []Category{} - } - } else { - out.Categories = (out.Categories)[:0] - } - for !in.IsDelim(']') { - var v49 Category - v49 = Category(in.String()) - out.Categories = append(out.Categories, v49) - in.WantComma() - } - in.Delim(']') - } - case "domain": - out.Domain = string(in.String()) - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb10(out *jwriter.Writer, in Publisher) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"id\":" - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Name != "" { - const prefix string = ",\"name\":" - out.RawString(prefix) - out.String(string(in.Name)) - } - if len(in.Categories) != 0 { - const prefix string = ",\"cat\":" - out.RawString(prefix) - { - out.RawByte('[') - for v50, v51 := range in.Categories { - if v50 > 0 { - out.RawByte(',') - } - out.String(string(v51)) - } - out.RawByte(']') - } - } - if in.Domain != "" { - const prefix string = ",\"domain\":" - out.RawString(prefix) - out.String(string(in.Domain)) - } - out.RawByte('}') -} -func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *Impression) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "metric": - if in.IsNull() { - in.Skip() - out.Metrics = nil - } else { - in.Delim('[') - if out.Metrics == nil { - if !in.IsDelim(']') { - out.Metrics = make([]*Metric, 0, 8) - } else { - out.Metrics = []*Metric{} - } - } else { - out.Metrics = (out.Metrics)[:0] - } - for !in.IsDelim(']') { - var v52 *Metric - if in.IsNull() { - in.Skip() - v52 = nil - } else { - if v52 == nil { - v52 = new(Metric) - } - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb13(in, v52) - } - out.Metrics = append(out.Metrics, v52) - in.WantComma() - } - in.Delim(']') - } - case "banner": - if in.IsNull() { - in.Skip() - out.Banner = nil - } else { - if out.Banner == nil { - out.Banner = new(Banner) - } - (*out.Banner).UnmarshalEasyJSON(in) - } - case "video": - if in.IsNull() { - in.Skip() - out.Video = nil - } else { - if out.Video == nil { - out.Video = new(Video) - } - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb14(in, out.Video) - } - case "audio": - if in.IsNull() { - in.Skip() - out.Audio = nil - } else { - if out.Audio == nil { - out.Audio = new(Audio) - } - (*out.Audio).UnmarshalEasyJSON(in) - } - case "native": - if in.IsNull() { - in.Skip() - out.Native = nil - } else { - if out.Native == nil { - out.Native = new(Native) - } - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb15(in, out.Native) - } - case "pmp": - if in.IsNull() { - in.Skip() - out.PrivateMarketplace = nil - } else { - if out.PrivateMarketplace == nil { - out.PrivateMarketplace = new(PrivateMarketplace) - } - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb16(in, out.PrivateMarketplace) - } - case "displaymanager": - out.DisplayManager = string(in.String()) - case "displaymanagerver": - out.DisplayManagerVersion = string(in.String()) - case "instl": - if data := in.Raw(); in.Ok() { - in.AddError((out.IsInterstitial).UnmarshalJSON(data)) - } - case "tagid": - out.TagID = string(in.String()) - case "bidfloor": - out.BidFloorPrice = float64(in.Float64()) - case "bidfloorcur": - out.BidFloorCurrency = Currency(in.String()) - case "clickbrowser": - if in.IsNull() { - in.Skip() - out.BrowserTypeUponClick = nil - } else { - if out.BrowserTypeUponClick == nil { - out.BrowserTypeUponClick = new(BrowserType) - } - *out.BrowserTypeUponClick = BrowserType(in.Int()) - } - case "secure": - if data := in.Raw(); in.Ok() { - in.AddError((out.IsSecure).UnmarshalJSON(data)) - } - case "iframebuster": - if in.IsNull() { - in.Skip() - out.IframeBuster = nil - } else { - in.Delim('[') - if out.IframeBuster == nil { - if !in.IsDelim(']') { - out.IframeBuster = make([]string, 0, 4) - } else { - out.IframeBuster = []string{} - } - } else { - out.IframeBuster = (out.IframeBuster)[:0] - } - for !in.IsDelim(']') { - var v53 string - v53 = string(in.String()) - out.IframeBuster = append(out.IframeBuster, v53) - in.WantComma() - } - in.Delim(']') - } - case "exp": - out.Exp = int(in.Int()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in Impression) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"id\":" - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if len(in.Metrics) != 0 { - const prefix string = ",\"metric\":" - out.RawString(prefix) - { - out.RawByte('[') - for v54, v55 := range in.Metrics { - if v54 > 0 { - out.RawByte(',') - } - if v55 == nil { - out.RawString("null") - } else { - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb13(out, *v55) - } - } - out.RawByte(']') - } - } - if in.Banner != nil { - const prefix string = ",\"banner\":" - out.RawString(prefix) - (*in.Banner).MarshalEasyJSON(out) - } - if in.Video != nil { - const prefix string = ",\"video\":" - out.RawString(prefix) - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb14(out, *in.Video) - } - if in.Audio != nil { - const prefix string = ",\"audio\":" - out.RawString(prefix) - (*in.Audio).MarshalEasyJSON(out) - } - if in.Native != nil { - const prefix string = ",\"native\":" - out.RawString(prefix) - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb15(out, *in.Native) - } - if in.PrivateMarketplace != nil { - const prefix string = ",\"pmp\":" - out.RawString(prefix) - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb16(out, *in.PrivateMarketplace) - } - if in.DisplayManager != "" { - const prefix string = ",\"displaymanager\":" - out.RawString(prefix) - out.String(string(in.DisplayManager)) - } - if in.DisplayManagerVersion != "" { - const prefix string = ",\"displaymanagerver\":" - out.RawString(prefix) - out.String(string(in.DisplayManagerVersion)) - } - if in.IsInterstitial { - const prefix string = ",\"instl\":" - out.RawString(prefix) - out.Raw((in.IsInterstitial).MarshalJSON()) - } - if in.TagID != "" { - const prefix string = ",\"tagid\":" - out.RawString(prefix) - out.String(string(in.TagID)) - } - { - const prefix string = ",\"bidfloor\":" - out.RawString(prefix) - out.Float64(float64(in.BidFloorPrice)) - } - if in.BidFloorCurrency != "" { - const prefix string = ",\"bidfloorcur\":" - out.RawString(prefix) - out.String(string(in.BidFloorCurrency)) - } - if in.BrowserTypeUponClick != nil { - const prefix string = ",\"clickbrowser\":" - out.RawString(prefix) - out.Int(int(*in.BrowserTypeUponClick)) - } - if in.IsSecure { - const prefix string = ",\"secure\":" - out.RawString(prefix) - out.Raw((in.IsSecure).MarshalJSON()) - } - if len(in.IframeBuster) != 0 { - const prefix string = ",\"iframebuster\":" - out.RawString(prefix) - { - out.RawByte('[') - for v56, v57 := range in.IframeBuster { - if v56 > 0 { - out.RawByte(',') - } - out.String(string(v57)) - } - out.RawByte(']') - } - } - if in.Exp != 0 { - const prefix string = ",\"exp\":" - out.RawString(prefix) - out.Int(int(in.Exp)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb16(in *jlexer.Lexer, out *PrivateMarketplace) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "private_auction": - if data := in.Raw(); in.Ok() { - in.AddError((out.IsPrivateAuction).UnmarshalJSON(data)) - } - case "deals": - if in.IsNull() { - in.Skip() - out.Deals = nil - } else { - in.Delim('[') - if out.Deals == nil { - if !in.IsDelim(']') { - out.Deals = make([]*Deal, 0, 8) - } else { - out.Deals = []*Deal{} - } - } else { - out.Deals = (out.Deals)[:0] - } - for !in.IsDelim(']') { - var v58 *Deal - if in.IsNull() { - in.Skip() - v58 = nil - } else { - if v58 == nil { - v58 = new(Deal) - } - easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb17(in, v58) - } - out.Deals = append(out.Deals, v58) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb16(out *jwriter.Writer, in PrivateMarketplace) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"private_auction\":" - out.RawString(prefix[1:]) - out.Raw((in.IsPrivateAuction).MarshalJSON()) - } - { - const prefix string = ",\"deals\":" - out.RawString(prefix) - if in.Deals == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v59, v60 := range in.Deals { - if v59 > 0 { - out.RawByte(',') - } - if v60 == nil { - out.RawString("null") - } else { - easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb17(out, *v60) - } - } - out.RawByte(']') - } - } - if in.Extension != nil { - const prefix string = ",\"ext\":" - out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } - } - out.RawByte('}') -} -func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb17(in *jlexer.Lexer, out *Deal) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "bidfloor": - out.BidFloorPrice = float64(in.Float64()) - case "bidfloorcur": - out.BidFloorCurrency = Currency(in.String()) - case "at": - out.AuctionType = DealAuctionType(in.Int()) - case "wseat": - if in.IsNull() { - in.Skip() - out.WhitelistedSeats = nil - } else { - in.Delim('[') - if out.WhitelistedSeats == nil { - if !in.IsDelim(']') { - out.WhitelistedSeats = make([]string, 0, 4) - } else { - out.WhitelistedSeats = []string{} - } - } else { - out.WhitelistedSeats = (out.WhitelistedSeats)[:0] - } - for !in.IsDelim(']') { - var v61 string - v61 = string(in.String()) - out.WhitelistedSeats = append(out.WhitelistedSeats, v61) - in.WantComma() - } - in.Delim(']') - } - case "wadomain": - if in.IsNull() { - in.Skip() - out.AdvertiserDomains = nil - } else { - in.Delim('[') - if out.AdvertiserDomains == nil { - if !in.IsDelim(']') { - out.AdvertiserDomains = make([]string, 0, 4) - } else { - out.AdvertiserDomains = []string{} - } - } else { - out.AdvertiserDomains = (out.AdvertiserDomains)[:0] - } - for !in.IsDelim(']') { - var v62 string - v62 = string(in.String()) - out.AdvertiserDomains = append(out.AdvertiserDomains, v62) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb17(out *jwriter.Writer, in Deal) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"id\":" - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - { - const prefix string = ",\"bidfloor\":" - out.RawString(prefix) - out.Float64(float64(in.BidFloorPrice)) - } - if in.BidFloorCurrency != "" { - const prefix string = ",\"bidfloorcur\":" - out.RawString(prefix) - out.String(string(in.BidFloorCurrency)) - } - if in.AuctionType != 0 { - const prefix string = ",\"at\":" - out.RawString(prefix) - out.Int(int(in.AuctionType)) - } - if len(in.WhitelistedSeats) != 0 { - const prefix string = ",\"wseat\":" - out.RawString(prefix) - { - out.RawByte('[') - for v63, v64 := range in.WhitelistedSeats { - if v63 > 0 { - out.RawByte(',') - } - out.String(string(v64)) - } - out.RawByte(']') - } - } - if len(in.AdvertiserDomains) != 0 { - const prefix string = ",\"wadomain\":" - out.RawString(prefix) - { - out.RawByte('[') - for v65, v66 := range in.AdvertiserDomains { - if v65 > 0 { - out.RawByte(',') - } - out.String(string(v66)) - } - out.RawByte(']') - } - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb15(in *jlexer.Lexer, out *Native) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "request": - out.Request = string(in.String()) - case "ver": - out.Version = string(in.String()) - case "api": - if in.IsNull() { - in.Skip() - out.APIFrameworks = nil - } else { - in.Delim('[') - if out.APIFrameworks == nil { - if !in.IsDelim(']') { - out.APIFrameworks = make([]APIFramework, 0, 8) - } else { - out.APIFrameworks = []APIFramework{} - } - } else { - out.APIFrameworks = (out.APIFrameworks)[:0] - } - for !in.IsDelim(']') { - var v67 APIFramework - v67 = APIFramework(in.Int()) - out.APIFrameworks = append(out.APIFrameworks, v67) - in.WantComma() - } - in.Delim(']') - } - case "battr": - if in.IsNull() { - in.Skip() - out.BlockedCreativeAttributes = nil - } else { - in.Delim('[') - if out.BlockedCreativeAttributes == nil { - if !in.IsDelim(']') { - out.BlockedCreativeAttributes = make([]CreativeAttribute, 0, 8) - } else { - out.BlockedCreativeAttributes = []CreativeAttribute{} - } - } else { - out.BlockedCreativeAttributes = (out.BlockedCreativeAttributes)[:0] - } - for !in.IsDelim(']') { - var v68 CreativeAttribute - v68 = CreativeAttribute(in.Int()) - out.BlockedCreativeAttributes = append(out.BlockedCreativeAttributes, v68) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb15(out *jwriter.Writer, in Native) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"request\":" - out.RawString(prefix[1:]) - out.String(string(in.Request)) - } - if in.Version != "" { - const prefix string = ",\"ver\":" - out.RawString(prefix) - out.String(string(in.Version)) - } - if len(in.APIFrameworks) != 0 { - const prefix string = ",\"api\":" - out.RawString(prefix) - { - out.RawByte('[') - for v69, v70 := range in.APIFrameworks { - if v69 > 0 { - out.RawByte(',') - } - out.Int(int(v70)) - } - out.RawByte(']') - } - } - if len(in.BlockedCreativeAttributes) != 0 { - const prefix string = ",\"battr\":" - out.RawString(prefix) - { - out.RawByte('[') - for v71, v72 := range in.BlockedCreativeAttributes { - if v71 > 0 { - out.RawByte(',') - } - out.Int(int(v72)) - } - out.RawByte(']') - } - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb14(in *jlexer.Lexer, out *Video) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "mimes": - if in.IsNull() { - in.Skip() - out.MIMETypes = nil - } else { - in.Delim('[') - if out.MIMETypes == nil { - if !in.IsDelim(']') { - out.MIMETypes = make([]string, 0, 4) - } else { - out.MIMETypes = []string{} - } - } else { - out.MIMETypes = (out.MIMETypes)[:0] - } - for !in.IsDelim(']') { - var v73 string - v73 = string(in.String()) - out.MIMETypes = append(out.MIMETypes, v73) - in.WantComma() - } - in.Delim(']') - } - case "minduration": - if in.IsNull() { - in.Skip() - out.MinDuration = nil - } else { - if out.MinDuration == nil { - out.MinDuration = new(int) - } - *out.MinDuration = int(in.Int()) - } - case "maxduration": - if in.IsNull() { - in.Skip() - out.MaxDuration = nil - } else { - if out.MaxDuration == nil { - out.MaxDuration = new(int) - } - *out.MaxDuration = int(in.Int()) - } - case "protocols": - if in.IsNull() { - in.Skip() - out.Protocols = nil - } else { - in.Delim('[') - if out.Protocols == nil { - if !in.IsDelim(']') { - out.Protocols = make([]Protocol, 0, 8) - } else { - out.Protocols = []Protocol{} - } - } else { - out.Protocols = (out.Protocols)[:0] - } - for !in.IsDelim(']') { - var v74 Protocol - v74 = Protocol(in.Int()) - out.Protocols = append(out.Protocols, v74) - in.WantComma() - } - in.Delim(']') - } - case "protocol": - out.Protocol = Protocol(in.Int()) - case "w": - out.Width = int(in.Int()) - case "h": - out.Height = int(in.Int()) - case "startdelay": - if in.IsNull() { - in.Skip() - out.StartDelay = nil - } else { - if out.StartDelay == nil { - out.StartDelay = new(StartDelay) - } - *out.StartDelay = StartDelay(in.Int()) - } - case "placement": - out.PlacementType = VideoPlacementType(in.Int()) - case "linearity": - out.Linearity = Linearity(in.Int()) - case "skip": - out.Skippable = int(in.Int()) - case "skipmin": - out.SkipMin = int(in.Int()) - case "skipafter": - out.SkipAfter = int(in.Int()) - case "sequence": - out.Sequence = int(in.Int()) - case "battr": - if in.IsNull() { - in.Skip() - out.BlockedCreativeAttributes = nil - } else { - in.Delim('[') - if out.BlockedCreativeAttributes == nil { - if !in.IsDelim(']') { - out.BlockedCreativeAttributes = make([]CreativeAttribute, 0, 8) - } else { - out.BlockedCreativeAttributes = []CreativeAttribute{} - } - } else { - out.BlockedCreativeAttributes = (out.BlockedCreativeAttributes)[:0] - } - for !in.IsDelim(']') { - var v75 CreativeAttribute - v75 = CreativeAttribute(in.Int()) - out.BlockedCreativeAttributes = append(out.BlockedCreativeAttributes, v75) - in.WantComma() - } - in.Delim(']') - } - case "maxextended": - out.MaxExtendedDuration = int(in.Int()) - case "minbitrate": - out.MinBitRate = int(in.Int()) - case "maxbitrate": - out.MaxBitRate = int(in.Int()) - case "boxingallowed": - if data := in.Raw(); in.Ok() { - in.AddError((out.IsBoxingAllowed).UnmarshalJSON(data)) - } - case "playbackmethod": - if in.IsNull() { - in.Skip() - out.PlaybackMethods = nil - } else { - in.Delim('[') - if out.PlaybackMethods == nil { - if !in.IsDelim(']') { - out.PlaybackMethods = make([]PlaybackMethod, 0, 8) - } else { - out.PlaybackMethods = []PlaybackMethod{} - } - } else { - out.PlaybackMethods = (out.PlaybackMethods)[:0] - } - for !in.IsDelim(']') { - var v76 PlaybackMethod - v76 = PlaybackMethod(in.Int()) - out.PlaybackMethods = append(out.PlaybackMethods, v76) - in.WantComma() - } - in.Delim(']') - } - case "playbackend": - out.PlaybackEndEvent = PlaybackCessationMode(in.Int()) - case "delivery": - if in.IsNull() { - in.Skip() - out.DeliveryMethods = nil - } else { - in.Delim('[') - if out.DeliveryMethods == nil { - if !in.IsDelim(']') { - out.DeliveryMethods = make([]DeliveryMethod, 0, 8) - } else { - out.DeliveryMethods = []DeliveryMethod{} - } - } else { - out.DeliveryMethods = (out.DeliveryMethods)[:0] - } - for !in.IsDelim(']') { - var v77 DeliveryMethod - v77 = DeliveryMethod(in.Int()) - out.DeliveryMethods = append(out.DeliveryMethods, v77) - in.WantComma() - } - in.Delim(']') - } - case "pos": - out.Position = AdPosition(in.Int()) - case "companionad": - if in.IsNull() { - in.Skip() - out.CompanionAds = nil - } else { - in.Delim('[') - if out.CompanionAds == nil { - if !in.IsDelim(']') { - out.CompanionAds = make([]Banner, 0, 1) - } else { - out.CompanionAds = []Banner{} - } - } else { - out.CompanionAds = (out.CompanionAds)[:0] - } - for !in.IsDelim(']') { - var v78 Banner - (v78).UnmarshalEasyJSON(in) - out.CompanionAds = append(out.CompanionAds, v78) - in.WantComma() - } - in.Delim(']') - } - case "api": - if in.IsNull() { - in.Skip() - out.APIFrameworks = nil - } else { - in.Delim('[') - if out.APIFrameworks == nil { - if !in.IsDelim(']') { - out.APIFrameworks = make([]APIFramework, 0, 8) - } else { - out.APIFrameworks = []APIFramework{} - } - } else { - out.APIFrameworks = (out.APIFrameworks)[:0] - } - for !in.IsDelim(']') { - var v79 APIFramework - v79 = APIFramework(in.Int()) - out.APIFrameworks = append(out.APIFrameworks, v79) - in.WantComma() - } - in.Delim(']') - } - case "companiontype": - if in.IsNull() { - in.Skip() - out.CompanionTypes = nil - } else { - in.Delim('[') - if out.CompanionTypes == nil { - if !in.IsDelim(']') { - out.CompanionTypes = make([]CompanionType, 0, 8) - } else { - out.CompanionTypes = []CompanionType{} - } - } else { - out.CompanionTypes = (out.CompanionTypes)[:0] - } - for !in.IsDelim(']') { - var v80 CompanionType - v80 = CompanionType(in.Int()) - out.CompanionTypes = append(out.CompanionTypes, v80) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb14(out *jwriter.Writer, in Video) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"mimes\":" - out.RawString(prefix[1:]) - if in.MIMETypes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v81, v82 := range in.MIMETypes { - if v81 > 0 { - out.RawByte(',') - } - out.String(string(v82)) - } - out.RawByte(']') - } - } - if in.MinDuration != nil { - const prefix string = ",\"minduration\":" - out.RawString(prefix) - out.Int(int(*in.MinDuration)) - } - if in.MaxDuration != nil { - const prefix string = ",\"maxduration\":" - out.RawString(prefix) - out.Int(int(*in.MaxDuration)) - } - if len(in.Protocols) != 0 { - const prefix string = ",\"protocols\":" - out.RawString(prefix) - { - out.RawByte('[') - for v83, v84 := range in.Protocols { - if v83 > 0 { - out.RawByte(',') - } - out.Int(int(v84)) - } - out.RawByte(']') - } - } - if in.Protocol != 0 { - const prefix string = ",\"protocol\":" - out.RawString(prefix) - out.Int(int(in.Protocol)) - } - if in.Width != 0 { - const prefix string = ",\"w\":" - out.RawString(prefix) - out.Int(int(in.Width)) - } - if in.Height != 0 { - const prefix string = ",\"h\":" - out.RawString(prefix) - out.Int(int(in.Height)) - } - if in.StartDelay != nil { - const prefix string = ",\"startdelay\":" - out.RawString(prefix) - out.Int(int(*in.StartDelay)) - } - if in.PlacementType != 0 { - const prefix string = ",\"placement\":" - out.RawString(prefix) - out.Int(int(in.PlacementType)) - } - if in.Linearity != 0 { - const prefix string = ",\"linearity\":" - out.RawString(prefix) - out.Int(int(in.Linearity)) - } - if in.Skippable != 0 { - const prefix string = ",\"skip\":" - out.RawString(prefix) - out.Int(int(in.Skippable)) - } - if in.SkipMin != 0 { - const prefix string = ",\"skipmin\":" - out.RawString(prefix) - out.Int(int(in.SkipMin)) - } - if in.SkipAfter != 0 { - const prefix string = ",\"skipafter\":" - out.RawString(prefix) - out.Int(int(in.SkipAfter)) - } - if in.Sequence != 0 { - const prefix string = ",\"sequence\":" - out.RawString(prefix) - out.Int(int(in.Sequence)) - } - if len(in.BlockedCreativeAttributes) != 0 { - const prefix string = ",\"battr\":" - out.RawString(prefix) - { - out.RawByte('[') - for v85, v86 := range in.BlockedCreativeAttributes { - if v85 > 0 { - out.RawByte(',') - } - out.Int(int(v86)) - } - out.RawByte(']') - } - } - if in.MaxExtendedDuration != 0 { - const prefix string = ",\"maxextended\":" - out.RawString(prefix) - out.Int(int(in.MaxExtendedDuration)) - } - if in.MinBitRate != 0 { - const prefix string = ",\"minbitrate\":" - out.RawString(prefix) - out.Int(int(in.MinBitRate)) - } - if in.MaxBitRate != 0 { - const prefix string = ",\"maxbitrate\":" - out.RawString(prefix) - out.Int(int(in.MaxBitRate)) - } - if in.IsBoxingAllowed { - const prefix string = ",\"boxingallowed\":" - out.RawString(prefix) - out.Raw((in.IsBoxingAllowed).MarshalJSON()) - } - if len(in.PlaybackMethods) != 0 { - const prefix string = ",\"playbackmethod\":" - out.RawString(prefix) - { - out.RawByte('[') - for v87, v88 := range in.PlaybackMethods { - if v87 > 0 { - out.RawByte(',') - } - out.Int(int(v88)) - } - out.RawByte(']') - } - } - if in.PlaybackEndEvent != 0 { - const prefix string = ",\"playbackend\":" - out.RawString(prefix) - out.Int(int(in.PlaybackEndEvent)) - } - if len(in.DeliveryMethods) != 0 { - const prefix string = ",\"delivery\":" - out.RawString(prefix) - { - out.RawByte('[') - for v89, v90 := range in.DeliveryMethods { - if v89 > 0 { - out.RawByte(',') - } - out.Int(int(v90)) - } - out.RawByte(']') - } - } - if in.Position != 0 { - const prefix string = ",\"pos\":" - out.RawString(prefix) - out.Int(int(in.Position)) - } - if len(in.CompanionAds) != 0 { - const prefix string = ",\"companionad\":" - out.RawString(prefix) - { - out.RawByte('[') - for v91, v92 := range in.CompanionAds { - if v91 > 0 { - out.RawByte(',') - } - (v92).MarshalEasyJSON(out) - } - out.RawByte(']') - } - } - if len(in.APIFrameworks) != 0 { - const prefix string = ",\"api\":" - out.RawString(prefix) - { - out.RawByte('[') - for v93, v94 := range in.APIFrameworks { - if v93 > 0 { - out.RawByte(',') - } - out.Int(int(v94)) - } - out.RawByte(']') - } - } - if len(in.CompanionTypes) != 0 { - const prefix string = ",\"companiontype\":" - out.RawString(prefix) - { - out.RawByte('[') - for v95, v96 := range in.CompanionTypes { - if v95 > 0 { - out.RawByte(',') - } - out.Int(int(v96)) - } - out.RawByte(']') - } - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb13(in *jlexer.Lexer, out *Metric) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "type": - out.Type = string(in.String()) - case "value": - out.Value = float64(in.Float64()) - case "vendor": - out.Vendor = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb13(out *jwriter.Writer, in Metric) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"type\":" - out.RawString(prefix[1:]) - out.String(string(in.Type)) - } - if in.Value != 0 { - const prefix string = ",\"value\":" - out.RawString(prefix) - out.Float64(float64(in.Value)) - } - if in.Vendor != "" { - const prefix string = ",\"vendor\":" - out.RawString(prefix) - out.String(string(in.Vendor)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} diff --git a/openrtb/bidresponse.go b/openrtb/bidresponse.go index 0e00fac..96d3b31 100644 --- a/openrtb/bidresponse.go +++ b/openrtb/bidresponse.go @@ -16,15 +16,13 @@ var emptyBid BidResponse //go:generate easyjson $GOFILE //easyjson:json type BidResponse struct { - ID string `json:"id"` - SeatBids []*SeatBid `json:"seatbid,omitempty"` - BidID string `json:"bidid,omitempty"` - Currency Currency `json:"cur,omitempty"` - CustomData string `json:"customdata,omitempty"` - NoBidReason NoBidReason `json:"nbr,omitempty"` - - RawExtension json.RawMessage `json:"ext,omitempty"` - Extension interface{} `json:"-"` // Opaque value that can be used to store unmarshaled value in ext field. + ID string `json:"id"` + SeatBids []*SeatBid `json:"seatbid,omitempty"` + BidID string `json:"bidid,omitempty"` + Currency Currency `json:"cur,omitempty"` + CustomData string `json:"customdata,omitempty"` + NoBidReason NoBidReason `json:"nbr,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } // Validate method validates whether the BidResponse object contains valid data, or returns an @@ -80,7 +78,7 @@ func (r *BidResponse) Copy() *BidResponse { } if r.Extension != nil { - brCopy.RawExtension = util.DeepCopyJSONRawMsg(r.RawExtension) + brCopy.Extension = util.DeepCopyJSONRawMsg(r.Extension) } return &brCopy diff --git a/openrtb/bidresponse_easyjson.go b/openrtb/bidresponse_easyjson.go index 70c8d60..793d66c 100644 --- a/openrtb/bidresponse_easyjson.go +++ b/openrtb/bidresponse_easyjson.go @@ -16,265 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson10eb023eDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *BidResponse) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "seatbid": - if in.IsNull() { - in.Skip() - out.SeatBids = nil - } else { - in.Delim('[') - if out.SeatBids == nil { - if !in.IsDelim(']') { - out.SeatBids = make([]*SeatBid, 0, 8) - } else { - out.SeatBids = []*SeatBid{} - } - } else { - out.SeatBids = (out.SeatBids)[:0] - } - for !in.IsDelim(']') { - var v1 *SeatBid - if in.IsNull() { - in.Skip() - v1 = nil - } else { - if v1 == nil { - v1 = new(SeatBid) - } - easyjson10eb023eDecodeGithubComVungleVungoOpenrtb1(in, v1) - } - out.SeatBids = append(out.SeatBids, v1) - in.WantComma() - } - in.Delim(']') - } - case "bidid": - out.BidID = string(in.String()) - case "cur": - out.Currency = Currency(in.String()) - case "customdata": - out.CustomData = string(in.String()) - case "nbr": - out.NoBidReason = NoBidReason(in.Int()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.RawExtension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson10eb023eEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in BidResponse) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"id\":" - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if len(in.SeatBids) != 0 { - const prefix string = ",\"seatbid\":" - out.RawString(prefix) - { - out.RawByte('[') - for v2, v3 := range in.SeatBids { - if v2 > 0 { - out.RawByte(',') - } - if v3 == nil { - out.RawString("null") - } else { - easyjson10eb023eEncodeGithubComVungleVungoOpenrtb1(out, *v3) - } - } - out.RawByte(']') - } - } - if in.BidID != "" { - const prefix string = ",\"bidid\":" - out.RawString(prefix) - out.String(string(in.BidID)) - } - if in.Currency != "" { - const prefix string = ",\"cur\":" - out.RawString(prefix) - out.String(string(in.Currency)) - } - if in.CustomData != "" { - const prefix string = ",\"customdata\":" - out.RawString(prefix) - out.String(string(in.CustomData)) - } - if in.NoBidReason != 0 { - const prefix string = ",\"nbr\":" - out.RawString(prefix) - out.Int(int(in.NoBidReason)) - } - if len(in.RawExtension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.RawExtension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v BidResponse) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson10eb023eEncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v BidResponse) MarshalEasyJSON(w *jwriter.Writer) { - easyjson10eb023eEncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *BidResponse) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson10eb023eDecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *BidResponse) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson10eb023eDecodeGithubComVungleVungoOpenrtb(l, v) -} -func easyjson10eb023eDecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *SeatBid) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "bid": - if in.IsNull() { - in.Skip() - out.Bids = nil - } else { - in.Delim('[') - if out.Bids == nil { - if !in.IsDelim(']') { - out.Bids = make([]*Bid, 0, 8) - } else { - out.Bids = []*Bid{} - } - } else { - out.Bids = (out.Bids)[:0] - } - for !in.IsDelim(']') { - var v4 *Bid - if in.IsNull() { - in.Skip() - v4 = nil - } else { - if v4 == nil { - v4 = new(Bid) - } - (*v4).UnmarshalEasyJSON(in) - } - out.Bids = append(out.Bids, v4) - in.WantComma() - } - in.Delim(']') - } - case "seat": - out.Seat = string(in.String()) - case "group": - out.Group = int(in.Int()) - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson10eb023eEncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in SeatBid) { - out.RawByte('{') - first := true - _ = first - if len(in.Bids) != 0 { - const prefix string = ",\"bid\":" - first = false - out.RawString(prefix[1:]) - { - out.RawByte('[') - for v5, v6 := range in.Bids { - if v5 > 0 { - out.RawByte(',') - } - if v6 == nil { - out.RawString("null") - } else { - (*v6).MarshalEasyJSON(out) - } - } - out.RawByte(']') - } - } - if in.Seat != "" { - const prefix string = ",\"seat\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Seat)) - } - if in.Group != 0 { - const prefix string = ",\"group\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Group)) - } - out.RawByte('}') -} diff --git a/openrtb/bidresponse_test.go b/openrtb/bidresponse_test.go index 4173852..72cfd90 100644 --- a/openrtb/bidresponse_test.go +++ b/openrtb/bidresponse_test.go @@ -111,9 +111,7 @@ func TestBidResponse_Copy(t *testing.T) { } openrtbtest.FillWithNonNilValue(&bidResponse) - bidResponse.Extension = true // hack to workaround BidResponse specific Copy implementation about RawExtension respCopy := bidResponse.Copy() - respCopy.Extension = true if err := openrtbtest.VerifyDeepCopy( &bidResponse, respCopy); err != nil { t.Errorf("Copy() should be deep copy\n%v\n", err) diff --git a/openrtb/content_easyjson.go b/openrtb/content_easyjson.go index fee277e..793d66c 100644 --- a/openrtb/content_easyjson.go +++ b/openrtb/content_easyjson.go @@ -16,826 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson344736e9DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Content) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "episode": - if in.IsNull() { - in.Skip() - out.Episode = nil - } else { - if out.Episode == nil { - out.Episode = new(int) - } - *out.Episode = int(in.Int()) - } - case "title": - out.Title = string(in.String()) - case "series": - out.Series = string(in.String()) - case "season": - out.Season = string(in.String()) - case "artist": - out.Artist = string(in.String()) - case "genre": - out.Genre = string(in.String()) - case "album": - out.Album = string(in.String()) - case "isrc": - out.ISRC = string(in.String()) - case "producer": - if in.IsNull() { - in.Skip() - out.Producer = nil - } else { - if out.Producer == nil { - out.Producer = new(Producer) - } - easyjson344736e9DecodeGithubComVungleVungoOpenrtb1(in, out.Producer) - } - case "url": - out.URL = string(in.String()) - case "cat": - if in.IsNull() { - in.Skip() - out.Cat = nil - } else { - in.Delim('[') - if out.Cat == nil { - if !in.IsDelim(']') { - out.Cat = make([]string, 0, 4) - } else { - out.Cat = []string{} - } - } else { - out.Cat = (out.Cat)[:0] - } - for !in.IsDelim(']') { - var v1 string - v1 = string(in.String()) - out.Cat = append(out.Cat, v1) - in.WantComma() - } - in.Delim(']') - } - case "prodq": - out.ProdQ = ProductionQuality(in.Int()) - case "videoquality": - out.VideoQuality = ProductionQuality(in.Int()) - case "context": - out.Context = ContentContext(in.Int()) - case "contentrating": - out.ContentRating = string(in.String()) - case "userrating": - out.UserRating = string(in.String()) - case "qagmediarating": - out.QAGMediaRating = IQGMediaRating(in.Int()) - case "keywords": - out.Keywords = string(in.String()) - case "livestream": - if in.IsNull() { - in.Skip() - out.LiveStream = nil - } else { - if out.LiveStream == nil { - out.LiveStream = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.LiveStream).UnmarshalJSON(data)) - } - } - case "sourcerelationship": - if in.IsNull() { - in.Skip() - out.SourceRelationship = nil - } else { - if out.SourceRelationship == nil { - out.SourceRelationship = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.SourceRelationship).UnmarshalJSON(data)) - } - } - case "len": - if in.IsNull() { - in.Skip() - out.Len = nil - } else { - if out.Len == nil { - out.Len = new(int) - } - *out.Len = int(in.Int()) - } - case "language": - out.Language = string(in.String()) - case "embeddable": - if in.IsNull() { - in.Skip() - out.Embeddable = nil - } else { - if out.Embeddable == nil { - out.Embeddable = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.Embeddable).UnmarshalJSON(data)) - } - } - case "data": - if in.IsNull() { - in.Skip() - out.Data = nil - } else { - in.Delim('[') - if out.Data == nil { - if !in.IsDelim(']') { - out.Data = make([]*Data, 0, 8) - } else { - out.Data = []*Data{} - } - } else { - out.Data = (out.Data)[:0] - } - for !in.IsDelim(']') { - var v2 *Data - if in.IsNull() { - in.Skip() - v2 = nil - } else { - if v2 == nil { - v2 = new(Data) - } - easyjson344736e9DecodeGithubComVungleVungoOpenrtb2(in, v2) - } - out.Data = append(out.Data, v2) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson344736e9EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Content) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Episode != nil { - const prefix string = ",\"episode\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(*in.Episode)) - } - if in.Title != "" { - const prefix string = ",\"title\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Title)) - } - if in.Series != "" { - const prefix string = ",\"series\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Series)) - } - if in.Season != "" { - const prefix string = ",\"season\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Season)) - } - if in.Artist != "" { - const prefix string = ",\"artist\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Artist)) - } - if in.Genre != "" { - const prefix string = ",\"genre\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Genre)) - } - if in.Album != "" { - const prefix string = ",\"album\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Album)) - } - if in.ISRC != "" { - const prefix string = ",\"isrc\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.ISRC)) - } - if in.Producer != nil { - const prefix string = ",\"producer\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - easyjson344736e9EncodeGithubComVungleVungoOpenrtb1(out, *in.Producer) - } - if in.URL != "" { - const prefix string = ",\"url\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.URL)) - } - if len(in.Cat) != 0 { - const prefix string = ",\"cat\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v3, v4 := range in.Cat { - if v3 > 0 { - out.RawByte(',') - } - out.String(string(v4)) - } - out.RawByte(']') - } - } - if in.ProdQ != 0 { - const prefix string = ",\"prodq\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.ProdQ)) - } - if in.VideoQuality != 0 { - const prefix string = ",\"videoquality\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.VideoQuality)) - } - if in.Context != 0 { - const prefix string = ",\"context\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Context)) - } - if in.ContentRating != "" { - const prefix string = ",\"contentrating\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.ContentRating)) - } - if in.UserRating != "" { - const prefix string = ",\"userrating\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.UserRating)) - } - if in.QAGMediaRating != 0 { - const prefix string = ",\"qagmediarating\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.QAGMediaRating)) - } - if in.Keywords != "" { - const prefix string = ",\"keywords\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Keywords)) - } - if in.LiveStream != nil { - const prefix string = ",\"livestream\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.LiveStream).MarshalJSON()) - } - if in.SourceRelationship != nil { - const prefix string = ",\"sourcerelationship\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.SourceRelationship).MarshalJSON()) - } - if in.Len != nil { - const prefix string = ",\"len\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(*in.Len)) - } - if in.Language != "" { - const prefix string = ",\"language\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Language)) - } - if in.Embeddable != nil { - const prefix string = ",\"embeddable\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.Embeddable).MarshalJSON()) - } - if len(in.Data) != 0 { - const prefix string = ",\"data\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v5, v6 := range in.Data { - if v5 > 0 { - out.RawByte(',') - } - if v6 == nil { - out.RawString("null") - } else { - easyjson344736e9EncodeGithubComVungleVungoOpenrtb2(out, *v6) - } - } - out.RawByte(']') - } - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Content) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson344736e9EncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Content) MarshalEasyJSON(w *jwriter.Writer) { - easyjson344736e9EncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Content) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson344736e9DecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Content) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson344736e9DecodeGithubComVungleVungoOpenrtb(l, v) -} -func easyjson344736e9DecodeGithubComVungleVungoOpenrtb2(in *jlexer.Lexer, out *Data) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "segment": - if in.IsNull() { - in.Skip() - out.Segment = nil - } else { - in.Delim('[') - if out.Segment == nil { - if !in.IsDelim(']') { - out.Segment = make([]*Segment, 0, 8) - } else { - out.Segment = []*Segment{} - } - } else { - out.Segment = (out.Segment)[:0] - } - for !in.IsDelim(']') { - var v7 *Segment - if in.IsNull() { - in.Skip() - v7 = nil - } else { - if v7 == nil { - v7 = new(Segment) - } - easyjson344736e9DecodeGithubComVungleVungoOpenrtb3(in, v7) - } - out.Segment = append(out.Segment, v7) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson344736e9EncodeGithubComVungleVungoOpenrtb2(out *jwriter.Writer, in Data) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Name != "" { - const prefix string = ",\"name\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Name)) - } - if len(in.Segment) != 0 { - const prefix string = ",\"segment\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v8, v9 := range in.Segment { - if v8 > 0 { - out.RawByte(',') - } - if v9 == nil { - out.RawString("null") - } else { - easyjson344736e9EncodeGithubComVungleVungoOpenrtb3(out, *v9) - } - } - out.RawByte(']') - } - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson344736e9DecodeGithubComVungleVungoOpenrtb3(in *jlexer.Lexer, out *Segment) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "value": - out.Value = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson344736e9EncodeGithubComVungleVungoOpenrtb3(out *jwriter.Writer, in Segment) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Name != "" { - const prefix string = ",\"name\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Name)) - } - if in.Value != "" { - const prefix string = ",\"value\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Value)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson344736e9DecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *Producer) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "cat": - if in.IsNull() { - in.Skip() - out.Cat = nil - } else { - in.Delim('[') - if out.Cat == nil { - if !in.IsDelim(']') { - out.Cat = make([]string, 0, 4) - } else { - out.Cat = []string{} - } - } else { - out.Cat = (out.Cat)[:0] - } - for !in.IsDelim(']') { - var v10 string - v10 = string(in.String()) - out.Cat = append(out.Cat, v10) - in.WantComma() - } - in.Delim(']') - } - case "domain": - out.Domain = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson344736e9EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in Producer) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Name != "" { - const prefix string = ",\"name\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Name)) - } - if len(in.Cat) != 0 { - const prefix string = ",\"cat\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v11, v12 := range in.Cat { - if v11 > 0 { - out.RawByte(',') - } - out.String(string(v12)) - } - out.RawByte(']') - } - } - if in.Domain != "" { - const prefix string = ",\"domain\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Domain)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} diff --git a/openrtb/data_easyjson.go b/openrtb/data_easyjson.go index 55f90e4..793d66c 100644 --- a/openrtb/data_easyjson.go +++ b/openrtb/data_easyjson.go @@ -16,232 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson794297d0DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Data) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "segment": - if in.IsNull() { - in.Skip() - out.Segment = nil - } else { - in.Delim('[') - if out.Segment == nil { - if !in.IsDelim(']') { - out.Segment = make([]*Segment, 0, 8) - } else { - out.Segment = []*Segment{} - } - } else { - out.Segment = (out.Segment)[:0] - } - for !in.IsDelim(']') { - var v1 *Segment - if in.IsNull() { - in.Skip() - v1 = nil - } else { - if v1 == nil { - v1 = new(Segment) - } - easyjson794297d0DecodeGithubComVungleVungoOpenrtb1(in, v1) - } - out.Segment = append(out.Segment, v1) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson794297d0EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Data) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Name != "" { - const prefix string = ",\"name\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Name)) - } - if len(in.Segment) != 0 { - const prefix string = ",\"segment\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v2, v3 := range in.Segment { - if v2 > 0 { - out.RawByte(',') - } - if v3 == nil { - out.RawString("null") - } else { - easyjson794297d0EncodeGithubComVungleVungoOpenrtb1(out, *v3) - } - } - out.RawByte(']') - } - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Data) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson794297d0EncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Data) MarshalEasyJSON(w *jwriter.Writer) { - easyjson794297d0EncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Data) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson794297d0DecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Data) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson794297d0DecodeGithubComVungleVungoOpenrtb(l, v) -} -func easyjson794297d0DecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *Segment) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "value": - out.Value = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson794297d0EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in Segment) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Name != "" { - const prefix string = ",\"name\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Name)) - } - if in.Value != "" { - const prefix string = ",\"value\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Value)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} diff --git a/openrtb/deal_easyjson.go b/openrtb/deal_easyjson.go index 4265e08..793d66c 100644 --- a/openrtb/deal_easyjson.go +++ b/openrtb/deal_easyjson.go @@ -16,174 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson8a221a72DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Deal) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "bidfloor": - out.BidFloorPrice = float64(in.Float64()) - case "bidfloorcur": - out.BidFloorCurrency = Currency(in.String()) - case "at": - out.AuctionType = DealAuctionType(in.Int()) - case "wseat": - if in.IsNull() { - in.Skip() - out.WhitelistedSeats = nil - } else { - in.Delim('[') - if out.WhitelistedSeats == nil { - if !in.IsDelim(']') { - out.WhitelistedSeats = make([]string, 0, 4) - } else { - out.WhitelistedSeats = []string{} - } - } else { - out.WhitelistedSeats = (out.WhitelistedSeats)[:0] - } - for !in.IsDelim(']') { - var v1 string - v1 = string(in.String()) - out.WhitelistedSeats = append(out.WhitelistedSeats, v1) - in.WantComma() - } - in.Delim(']') - } - case "wadomain": - if in.IsNull() { - in.Skip() - out.AdvertiserDomains = nil - } else { - in.Delim('[') - if out.AdvertiserDomains == nil { - if !in.IsDelim(']') { - out.AdvertiserDomains = make([]string, 0, 4) - } else { - out.AdvertiserDomains = []string{} - } - } else { - out.AdvertiserDomains = (out.AdvertiserDomains)[:0] - } - for !in.IsDelim(']') { - var v2 string - v2 = string(in.String()) - out.AdvertiserDomains = append(out.AdvertiserDomains, v2) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson8a221a72EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Deal) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"id\":" - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - { - const prefix string = ",\"bidfloor\":" - out.RawString(prefix) - out.Float64(float64(in.BidFloorPrice)) - } - if in.BidFloorCurrency != "" { - const prefix string = ",\"bidfloorcur\":" - out.RawString(prefix) - out.String(string(in.BidFloorCurrency)) - } - if in.AuctionType != 0 { - const prefix string = ",\"at\":" - out.RawString(prefix) - out.Int(int(in.AuctionType)) - } - if len(in.WhitelistedSeats) != 0 { - const prefix string = ",\"wseat\":" - out.RawString(prefix) - { - out.RawByte('[') - for v3, v4 := range in.WhitelistedSeats { - if v3 > 0 { - out.RawByte(',') - } - out.String(string(v4)) - } - out.RawByte(']') - } - } - if len(in.AdvertiserDomains) != 0 { - const prefix string = ",\"wadomain\":" - out.RawString(prefix) - { - out.RawByte('[') - for v5, v6 := range in.AdvertiserDomains { - if v5 > 0 { - out.RawByte(',') - } - out.String(string(v6)) - } - out.RawByte(']') - } - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Deal) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson8a221a72EncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Deal) MarshalEasyJSON(w *jwriter.Writer) { - easyjson8a221a72EncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Deal) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson8a221a72DecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Deal) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson8a221a72DecodeGithubComVungleVungoOpenrtb(l, v) -} diff --git a/openrtb/device_easyjson.go b/openrtb/device_easyjson.go index cf1b833..793d66c 100644 --- a/openrtb/device_easyjson.go +++ b/openrtb/device_easyjson.go @@ -16,684 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson3073ac56DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Device) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "ua": - out.BrowserUserAgent = string(in.String()) - case "geo": - if in.IsNull() { - in.Skip() - out.Geo = nil - } else { - if out.Geo == nil { - out.Geo = new(Geo) - } - easyjson3073ac56DecodeGithubComVungleVungoOpenrtb1(in, out.Geo) - } - case "dnt": - if in.IsNull() { - in.Skip() - out.HasDoNotTrack = nil - } else { - if out.HasDoNotTrack == nil { - out.HasDoNotTrack = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.HasDoNotTrack).UnmarshalJSON(data)) - } - } - case "lmt": - if in.IsNull() { - in.Skip() - out.HasLimitedAdTracking = nil - } else { - if out.HasLimitedAdTracking == nil { - out.HasLimitedAdTracking = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.HasLimitedAdTracking).UnmarshalJSON(data)) - } - } - case "ip": - out.IP = string(in.String()) - case "ipv6": - out.IPv6 = string(in.String()) - case "devicetype": - out.Type = DeviceType(in.Int()) - case "make": - out.Make = string(in.String()) - case "model": - out.Model = string(in.String()) - case "os": - if data := in.Raw(); in.Ok() { - in.AddError((out.OS).UnmarshalJSON(data)) - } - case "osv": - out.OSVersion = OSVersion(in.String()) - case "hwv": - out.HardwareVersion = string(in.String()) - case "h": - out.Height = int(in.Int()) - case "w": - out.Width = int(in.Int()) - case "ppi": - out.PPI = int(in.Int()) - case "pxratio": - out.PixelRatio = float64(in.Float64()) - case "js": - if in.IsNull() { - in.Skip() - out.SupportsJavaScript = nil - } else { - if out.SupportsJavaScript == nil { - out.SupportsJavaScript = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.SupportsJavaScript).UnmarshalJSON(data)) - } - } - case "geofetch": - if in.IsNull() { - in.Skip() - out.GeoFetch = nil - } else { - if out.GeoFetch == nil { - out.GeoFetch = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.GeoFetch).UnmarshalJSON(data)) - } - } - case "flashver": - out.FlashVersion = string(in.String()) - case "language": - out.Language = string(in.String()) - case "carrier": - out.Carrier = string(in.String()) - case "mccmnc": - out.MCCMNC = string(in.String()) - case "connectiontype": - out.ConnectionType = ConnectionType(in.Int()) - case "ifa": - out.IFA = string(in.String()) - case "didsha1": - out.HardwareIDSHA1 = string(in.String()) - case "didmd5": - out.HardwareIDMD5 = string(in.String()) - case "dpidsha1": - out.PlatformIDSHA1 = string(in.String()) - case "dpidmd5": - out.PlatformIDMD5 = string(in.String()) - case "macsha1": - out.MACSHA1 = string(in.String()) - case "macmd5": - out.MACMD5 = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson3073ac56EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Device) { - out.RawByte('{') - first := true - _ = first - if in.BrowserUserAgent != "" { - const prefix string = ",\"ua\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.BrowserUserAgent)) - } - if in.Geo != nil { - const prefix string = ",\"geo\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - easyjson3073ac56EncodeGithubComVungleVungoOpenrtb1(out, *in.Geo) - } - if in.HasDoNotTrack != nil { - const prefix string = ",\"dnt\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.HasDoNotTrack).MarshalJSON()) - } - if in.HasLimitedAdTracking != nil { - const prefix string = ",\"lmt\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.HasLimitedAdTracking).MarshalJSON()) - } - if in.IP != "" { - const prefix string = ",\"ip\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.IP)) - } - if in.IPv6 != "" { - const prefix string = ",\"ipv6\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.IPv6)) - } - if in.Type != 0 { - const prefix string = ",\"devicetype\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Type)) - } - if in.Make != "" { - const prefix string = ",\"make\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Make)) - } - if in.Model != "" { - const prefix string = ",\"model\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Model)) - } - if in.OS != "" { - const prefix string = ",\"os\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.OS)) - } - if in.OSVersion != "" { - const prefix string = ",\"osv\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.OSVersion)) - } - if in.HardwareVersion != "" { - const prefix string = ",\"hwv\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.HardwareVersion)) - } - if in.Height != 0 { - const prefix string = ",\"h\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Height)) - } - if in.Width != 0 { - const prefix string = ",\"w\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Width)) - } - if in.PPI != 0 { - const prefix string = ",\"ppi\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.PPI)) - } - if in.PixelRatio != 0 { - const prefix string = ",\"pxratio\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Float64(float64(in.PixelRatio)) - } - if in.SupportsJavaScript != nil { - const prefix string = ",\"js\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.SupportsJavaScript).MarshalJSON()) - } - if in.GeoFetch != nil { - const prefix string = ",\"geofetch\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.GeoFetch).MarshalJSON()) - } - if in.FlashVersion != "" { - const prefix string = ",\"flashver\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.FlashVersion)) - } - if in.Language != "" { - const prefix string = ",\"language\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Language)) - } - if in.Carrier != "" { - const prefix string = ",\"carrier\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Carrier)) - } - if in.MCCMNC != "" { - const prefix string = ",\"mccmnc\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.MCCMNC)) - } - if in.ConnectionType != 0 { - const prefix string = ",\"connectiontype\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.ConnectionType)) - } - if in.IFA != "" { - const prefix string = ",\"ifa\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.IFA)) - } - if in.HardwareIDSHA1 != "" { - const prefix string = ",\"didsha1\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.HardwareIDSHA1)) - } - if in.HardwareIDMD5 != "" { - const prefix string = ",\"didmd5\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.HardwareIDMD5)) - } - if in.PlatformIDSHA1 != "" { - const prefix string = ",\"dpidsha1\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.PlatformIDSHA1)) - } - if in.PlatformIDMD5 != "" { - const prefix string = ",\"dpidmd5\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.PlatformIDMD5)) - } - if in.MACSHA1 != "" { - const prefix string = ",\"macsha1\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.MACSHA1)) - } - if in.MACMD5 != "" { - const prefix string = ",\"macmd5\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.MACMD5)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Device) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson3073ac56EncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Device) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3073ac56EncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Device) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson3073ac56DecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Device) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3073ac56DecodeGithubComVungleVungoOpenrtb(l, v) -} -func easyjson3073ac56DecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *Geo) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "lat": - out.Latitude = float64(in.Float64()) - case "lon": - out.Longitude = float64(in.Float64()) - case "type": - out.Type = LocationType(in.Int()) - case "accuracy": - out.Accuracy = int(in.Int()) - case "lastfix": - out.LastFix = int(in.Int()) - case "ipservice": - out.IPService = IPLocationService(in.Int()) - case "country": - out.Country = string(in.String()) - case "region": - out.Region = string(in.String()) - case "regionfips104": - out.RegionFIPS104 = string(in.String()) - case "metro": - out.Metro = string(in.String()) - case "city": - out.City = string(in.String()) - case "zip": - out.ZipCode = string(in.String()) - case "utcoffset": - out.UTCOffset = int(in.Int()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson3073ac56EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in Geo) { - out.RawByte('{') - first := true - _ = first - if in.Latitude != 0 { - const prefix string = ",\"lat\":" - first = false - out.RawString(prefix[1:]) - out.Float64(float64(in.Latitude)) - } - if in.Longitude != 0 { - const prefix string = ",\"lon\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Float64(float64(in.Longitude)) - } - if in.Type != 0 { - const prefix string = ",\"type\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Type)) - } - if in.Accuracy != 0 { - const prefix string = ",\"accuracy\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Accuracy)) - } - if in.LastFix != 0 { - const prefix string = ",\"lastfix\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.LastFix)) - } - if in.IPService != 0 { - const prefix string = ",\"ipservice\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.IPService)) - } - if in.Country != "" { - const prefix string = ",\"country\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Country)) - } - if in.Region != "" { - const prefix string = ",\"region\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Region)) - } - if in.RegionFIPS104 != "" { - const prefix string = ",\"regionfips104\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.RegionFIPS104)) - } - if in.Metro != "" { - const prefix string = ",\"metro\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Metro)) - } - if in.City != "" { - const prefix string = ",\"city\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.City)) - } - if in.ZipCode != "" { - const prefix string = ",\"zip\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.ZipCode)) - } - if in.UTCOffset != 0 { - const prefix string = ",\"utcoffset\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.UTCOffset)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} diff --git a/openrtb/format_easyjson.go b/openrtb/format_easyjson.go index 377c08c..793d66c 100644 --- a/openrtb/format_easyjson.go +++ b/openrtb/format_easyjson.go @@ -16,133 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson72863a49DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Format) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "w": - out.W = uint64(in.Uint64()) - case "h": - out.H = uint64(in.Uint64()) - case "wratio": - out.WRatio = uint64(in.Uint64()) - case "hratio": - out.HRatio = uint64(in.Uint64()) - case "wmin": - out.WMin = uint64(in.Uint64()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson72863a49EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Format) { - out.RawByte('{') - first := true - _ = first - if in.W != 0 { - const prefix string = ",\"w\":" - first = false - out.RawString(prefix[1:]) - out.Uint64(uint64(in.W)) - } - if in.H != 0 { - const prefix string = ",\"h\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Uint64(uint64(in.H)) - } - if in.WRatio != 0 { - const prefix string = ",\"wratio\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Uint64(uint64(in.WRatio)) - } - if in.HRatio != 0 { - const prefix string = ",\"hratio\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Uint64(uint64(in.HRatio)) - } - if in.WMin != 0 { - const prefix string = ",\"wmin\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Uint64(uint64(in.WMin)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Format) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson72863a49EncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Format) MarshalEasyJSON(w *jwriter.Writer) { - easyjson72863a49EncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Format) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson72863a49DecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Format) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson72863a49DecodeGithubComVungleVungoOpenrtb(l, v) -} diff --git a/openrtb/geo_easyjson.go b/openrtb/geo_easyjson.go index 824c668..793d66c 100644 --- a/openrtb/geo_easyjson.go +++ b/openrtb/geo_easyjson.go @@ -16,229 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjsonA0535929DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Geo) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "lat": - out.Latitude = float64(in.Float64()) - case "lon": - out.Longitude = float64(in.Float64()) - case "type": - out.Type = LocationType(in.Int()) - case "accuracy": - out.Accuracy = int(in.Int()) - case "lastfix": - out.LastFix = int(in.Int()) - case "ipservice": - out.IPService = IPLocationService(in.Int()) - case "country": - out.Country = string(in.String()) - case "region": - out.Region = string(in.String()) - case "regionfips104": - out.RegionFIPS104 = string(in.String()) - case "metro": - out.Metro = string(in.String()) - case "city": - out.City = string(in.String()) - case "zip": - out.ZipCode = string(in.String()) - case "utcoffset": - out.UTCOffset = int(in.Int()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonA0535929EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Geo) { - out.RawByte('{') - first := true - _ = first - if in.Latitude != 0 { - const prefix string = ",\"lat\":" - first = false - out.RawString(prefix[1:]) - out.Float64(float64(in.Latitude)) - } - if in.Longitude != 0 { - const prefix string = ",\"lon\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Float64(float64(in.Longitude)) - } - if in.Type != 0 { - const prefix string = ",\"type\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Type)) - } - if in.Accuracy != 0 { - const prefix string = ",\"accuracy\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Accuracy)) - } - if in.LastFix != 0 { - const prefix string = ",\"lastfix\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.LastFix)) - } - if in.IPService != 0 { - const prefix string = ",\"ipservice\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.IPService)) - } - if in.Country != "" { - const prefix string = ",\"country\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Country)) - } - if in.Region != "" { - const prefix string = ",\"region\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Region)) - } - if in.RegionFIPS104 != "" { - const prefix string = ",\"regionfips104\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.RegionFIPS104)) - } - if in.Metro != "" { - const prefix string = ",\"metro\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Metro)) - } - if in.City != "" { - const prefix string = ",\"city\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.City)) - } - if in.ZipCode != "" { - const prefix string = ",\"zip\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.ZipCode)) - } - if in.UTCOffset != 0 { - const prefix string = ",\"utcoffset\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.UTCOffset)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Geo) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonA0535929EncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Geo) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonA0535929EncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Geo) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonA0535929DecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Geo) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonA0535929DecodeGithubComVungleVungoOpenrtb(l, v) -} diff --git a/openrtb/impression_easyjson.go b/openrtb/impression_easyjson.go index bce52ba..793d66c 100644 --- a/openrtb/impression_easyjson.go +++ b/openrtb/impression_easyjson.go @@ -16,1120 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Impression) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "metric": - if in.IsNull() { - in.Skip() - out.Metrics = nil - } else { - in.Delim('[') - if out.Metrics == nil { - if !in.IsDelim(']') { - out.Metrics = make([]*Metric, 0, 8) - } else { - out.Metrics = []*Metric{} - } - } else { - out.Metrics = (out.Metrics)[:0] - } - for !in.IsDelim(']') { - var v1 *Metric - if in.IsNull() { - in.Skip() - v1 = nil - } else { - if v1 == nil { - v1 = new(Metric) - } - easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb1(in, v1) - } - out.Metrics = append(out.Metrics, v1) - in.WantComma() - } - in.Delim(']') - } - case "banner": - if in.IsNull() { - in.Skip() - out.Banner = nil - } else { - if out.Banner == nil { - out.Banner = new(Banner) - } - (*out.Banner).UnmarshalEasyJSON(in) - } - case "video": - if in.IsNull() { - in.Skip() - out.Video = nil - } else { - if out.Video == nil { - out.Video = new(Video) - } - easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb2(in, out.Video) - } - case "audio": - if in.IsNull() { - in.Skip() - out.Audio = nil - } else { - if out.Audio == nil { - out.Audio = new(Audio) - } - (*out.Audio).UnmarshalEasyJSON(in) - } - case "native": - if in.IsNull() { - in.Skip() - out.Native = nil - } else { - if out.Native == nil { - out.Native = new(Native) - } - easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb3(in, out.Native) - } - case "pmp": - if in.IsNull() { - in.Skip() - out.PrivateMarketplace = nil - } else { - if out.PrivateMarketplace == nil { - out.PrivateMarketplace = new(PrivateMarketplace) - } - easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb4(in, out.PrivateMarketplace) - } - case "displaymanager": - out.DisplayManager = string(in.String()) - case "displaymanagerver": - out.DisplayManagerVersion = string(in.String()) - case "instl": - if data := in.Raw(); in.Ok() { - in.AddError((out.IsInterstitial).UnmarshalJSON(data)) - } - case "tagid": - out.TagID = string(in.String()) - case "bidfloor": - out.BidFloorPrice = float64(in.Float64()) - case "bidfloorcur": - out.BidFloorCurrency = Currency(in.String()) - case "clickbrowser": - if in.IsNull() { - in.Skip() - out.BrowserTypeUponClick = nil - } else { - if out.BrowserTypeUponClick == nil { - out.BrowserTypeUponClick = new(BrowserType) - } - *out.BrowserTypeUponClick = BrowserType(in.Int()) - } - case "secure": - if data := in.Raw(); in.Ok() { - in.AddError((out.IsSecure).UnmarshalJSON(data)) - } - case "iframebuster": - if in.IsNull() { - in.Skip() - out.IframeBuster = nil - } else { - in.Delim('[') - if out.IframeBuster == nil { - if !in.IsDelim(']') { - out.IframeBuster = make([]string, 0, 4) - } else { - out.IframeBuster = []string{} - } - } else { - out.IframeBuster = (out.IframeBuster)[:0] - } - for !in.IsDelim(']') { - var v2 string - v2 = string(in.String()) - out.IframeBuster = append(out.IframeBuster, v2) - in.WantComma() - } - in.Delim(']') - } - case "exp": - out.Exp = int(in.Int()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Impression) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"id\":" - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if len(in.Metrics) != 0 { - const prefix string = ",\"metric\":" - out.RawString(prefix) - { - out.RawByte('[') - for v3, v4 := range in.Metrics { - if v3 > 0 { - out.RawByte(',') - } - if v4 == nil { - out.RawString("null") - } else { - easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb1(out, *v4) - } - } - out.RawByte(']') - } - } - if in.Banner != nil { - const prefix string = ",\"banner\":" - out.RawString(prefix) - (*in.Banner).MarshalEasyJSON(out) - } - if in.Video != nil { - const prefix string = ",\"video\":" - out.RawString(prefix) - easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb2(out, *in.Video) - } - if in.Audio != nil { - const prefix string = ",\"audio\":" - out.RawString(prefix) - (*in.Audio).MarshalEasyJSON(out) - } - if in.Native != nil { - const prefix string = ",\"native\":" - out.RawString(prefix) - easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb3(out, *in.Native) - } - if in.PrivateMarketplace != nil { - const prefix string = ",\"pmp\":" - out.RawString(prefix) - easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb4(out, *in.PrivateMarketplace) - } - if in.DisplayManager != "" { - const prefix string = ",\"displaymanager\":" - out.RawString(prefix) - out.String(string(in.DisplayManager)) - } - if in.DisplayManagerVersion != "" { - const prefix string = ",\"displaymanagerver\":" - out.RawString(prefix) - out.String(string(in.DisplayManagerVersion)) - } - if in.IsInterstitial { - const prefix string = ",\"instl\":" - out.RawString(prefix) - out.Raw((in.IsInterstitial).MarshalJSON()) - } - if in.TagID != "" { - const prefix string = ",\"tagid\":" - out.RawString(prefix) - out.String(string(in.TagID)) - } - { - const prefix string = ",\"bidfloor\":" - out.RawString(prefix) - out.Float64(float64(in.BidFloorPrice)) - } - if in.BidFloorCurrency != "" { - const prefix string = ",\"bidfloorcur\":" - out.RawString(prefix) - out.String(string(in.BidFloorCurrency)) - } - if in.BrowserTypeUponClick != nil { - const prefix string = ",\"clickbrowser\":" - out.RawString(prefix) - out.Int(int(*in.BrowserTypeUponClick)) - } - if in.IsSecure { - const prefix string = ",\"secure\":" - out.RawString(prefix) - out.Raw((in.IsSecure).MarshalJSON()) - } - if len(in.IframeBuster) != 0 { - const prefix string = ",\"iframebuster\":" - out.RawString(prefix) - { - out.RawByte('[') - for v5, v6 := range in.IframeBuster { - if v5 > 0 { - out.RawByte(',') - } - out.String(string(v6)) - } - out.RawByte(']') - } - } - if in.Exp != 0 { - const prefix string = ",\"exp\":" - out.RawString(prefix) - out.Int(int(in.Exp)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Impression) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Impression) MarshalEasyJSON(w *jwriter.Writer) { - easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Impression) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Impression) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb(l, v) -} -func easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb4(in *jlexer.Lexer, out *PrivateMarketplace) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "private_auction": - if data := in.Raw(); in.Ok() { - in.AddError((out.IsPrivateAuction).UnmarshalJSON(data)) - } - case "deals": - if in.IsNull() { - in.Skip() - out.Deals = nil - } else { - in.Delim('[') - if out.Deals == nil { - if !in.IsDelim(']') { - out.Deals = make([]*Deal, 0, 8) - } else { - out.Deals = []*Deal{} - } - } else { - out.Deals = (out.Deals)[:0] - } - for !in.IsDelim(']') { - var v7 *Deal - if in.IsNull() { - in.Skip() - v7 = nil - } else { - if v7 == nil { - v7 = new(Deal) - } - (*v7).UnmarshalEasyJSON(in) - } - out.Deals = append(out.Deals, v7) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb4(out *jwriter.Writer, in PrivateMarketplace) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"private_auction\":" - out.RawString(prefix[1:]) - out.Raw((in.IsPrivateAuction).MarshalJSON()) - } - { - const prefix string = ",\"deals\":" - out.RawString(prefix) - if in.Deals == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v8, v9 := range in.Deals { - if v8 > 0 { - out.RawByte(',') - } - if v9 == nil { - out.RawString("null") - } else { - (*v9).MarshalEasyJSON(out) - } - } - out.RawByte(']') - } - } - if in.Extension != nil { - const prefix string = ",\"ext\":" - out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } - } - out.RawByte('}') -} -func easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb3(in *jlexer.Lexer, out *Native) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "request": - out.Request = string(in.String()) - case "ver": - out.Version = string(in.String()) - case "api": - if in.IsNull() { - in.Skip() - out.APIFrameworks = nil - } else { - in.Delim('[') - if out.APIFrameworks == nil { - if !in.IsDelim(']') { - out.APIFrameworks = make([]APIFramework, 0, 8) - } else { - out.APIFrameworks = []APIFramework{} - } - } else { - out.APIFrameworks = (out.APIFrameworks)[:0] - } - for !in.IsDelim(']') { - var v10 APIFramework - v10 = APIFramework(in.Int()) - out.APIFrameworks = append(out.APIFrameworks, v10) - in.WantComma() - } - in.Delim(']') - } - case "battr": - if in.IsNull() { - in.Skip() - out.BlockedCreativeAttributes = nil - } else { - in.Delim('[') - if out.BlockedCreativeAttributes == nil { - if !in.IsDelim(']') { - out.BlockedCreativeAttributes = make([]CreativeAttribute, 0, 8) - } else { - out.BlockedCreativeAttributes = []CreativeAttribute{} - } - } else { - out.BlockedCreativeAttributes = (out.BlockedCreativeAttributes)[:0] - } - for !in.IsDelim(']') { - var v11 CreativeAttribute - v11 = CreativeAttribute(in.Int()) - out.BlockedCreativeAttributes = append(out.BlockedCreativeAttributes, v11) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb3(out *jwriter.Writer, in Native) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"request\":" - out.RawString(prefix[1:]) - out.String(string(in.Request)) - } - if in.Version != "" { - const prefix string = ",\"ver\":" - out.RawString(prefix) - out.String(string(in.Version)) - } - if len(in.APIFrameworks) != 0 { - const prefix string = ",\"api\":" - out.RawString(prefix) - { - out.RawByte('[') - for v12, v13 := range in.APIFrameworks { - if v12 > 0 { - out.RawByte(',') - } - out.Int(int(v13)) - } - out.RawByte(']') - } - } - if len(in.BlockedCreativeAttributes) != 0 { - const prefix string = ",\"battr\":" - out.RawString(prefix) - { - out.RawByte('[') - for v14, v15 := range in.BlockedCreativeAttributes { - if v14 > 0 { - out.RawByte(',') - } - out.Int(int(v15)) - } - out.RawByte(']') - } - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb2(in *jlexer.Lexer, out *Video) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "mimes": - if in.IsNull() { - in.Skip() - out.MIMETypes = nil - } else { - in.Delim('[') - if out.MIMETypes == nil { - if !in.IsDelim(']') { - out.MIMETypes = make([]string, 0, 4) - } else { - out.MIMETypes = []string{} - } - } else { - out.MIMETypes = (out.MIMETypes)[:0] - } - for !in.IsDelim(']') { - var v16 string - v16 = string(in.String()) - out.MIMETypes = append(out.MIMETypes, v16) - in.WantComma() - } - in.Delim(']') - } - case "minduration": - if in.IsNull() { - in.Skip() - out.MinDuration = nil - } else { - if out.MinDuration == nil { - out.MinDuration = new(int) - } - *out.MinDuration = int(in.Int()) - } - case "maxduration": - if in.IsNull() { - in.Skip() - out.MaxDuration = nil - } else { - if out.MaxDuration == nil { - out.MaxDuration = new(int) - } - *out.MaxDuration = int(in.Int()) - } - case "protocols": - if in.IsNull() { - in.Skip() - out.Protocols = nil - } else { - in.Delim('[') - if out.Protocols == nil { - if !in.IsDelim(']') { - out.Protocols = make([]Protocol, 0, 8) - } else { - out.Protocols = []Protocol{} - } - } else { - out.Protocols = (out.Protocols)[:0] - } - for !in.IsDelim(']') { - var v17 Protocol - v17 = Protocol(in.Int()) - out.Protocols = append(out.Protocols, v17) - in.WantComma() - } - in.Delim(']') - } - case "protocol": - out.Protocol = Protocol(in.Int()) - case "w": - out.Width = int(in.Int()) - case "h": - out.Height = int(in.Int()) - case "startdelay": - if in.IsNull() { - in.Skip() - out.StartDelay = nil - } else { - if out.StartDelay == nil { - out.StartDelay = new(StartDelay) - } - *out.StartDelay = StartDelay(in.Int()) - } - case "placement": - out.PlacementType = VideoPlacementType(in.Int()) - case "linearity": - out.Linearity = Linearity(in.Int()) - case "skip": - out.Skippable = int(in.Int()) - case "skipmin": - out.SkipMin = int(in.Int()) - case "skipafter": - out.SkipAfter = int(in.Int()) - case "sequence": - out.Sequence = int(in.Int()) - case "battr": - if in.IsNull() { - in.Skip() - out.BlockedCreativeAttributes = nil - } else { - in.Delim('[') - if out.BlockedCreativeAttributes == nil { - if !in.IsDelim(']') { - out.BlockedCreativeAttributes = make([]CreativeAttribute, 0, 8) - } else { - out.BlockedCreativeAttributes = []CreativeAttribute{} - } - } else { - out.BlockedCreativeAttributes = (out.BlockedCreativeAttributes)[:0] - } - for !in.IsDelim(']') { - var v18 CreativeAttribute - v18 = CreativeAttribute(in.Int()) - out.BlockedCreativeAttributes = append(out.BlockedCreativeAttributes, v18) - in.WantComma() - } - in.Delim(']') - } - case "maxextended": - out.MaxExtendedDuration = int(in.Int()) - case "minbitrate": - out.MinBitRate = int(in.Int()) - case "maxbitrate": - out.MaxBitRate = int(in.Int()) - case "boxingallowed": - if data := in.Raw(); in.Ok() { - in.AddError((out.IsBoxingAllowed).UnmarshalJSON(data)) - } - case "playbackmethod": - if in.IsNull() { - in.Skip() - out.PlaybackMethods = nil - } else { - in.Delim('[') - if out.PlaybackMethods == nil { - if !in.IsDelim(']') { - out.PlaybackMethods = make([]PlaybackMethod, 0, 8) - } else { - out.PlaybackMethods = []PlaybackMethod{} - } - } else { - out.PlaybackMethods = (out.PlaybackMethods)[:0] - } - for !in.IsDelim(']') { - var v19 PlaybackMethod - v19 = PlaybackMethod(in.Int()) - out.PlaybackMethods = append(out.PlaybackMethods, v19) - in.WantComma() - } - in.Delim(']') - } - case "playbackend": - out.PlaybackEndEvent = PlaybackCessationMode(in.Int()) - case "delivery": - if in.IsNull() { - in.Skip() - out.DeliveryMethods = nil - } else { - in.Delim('[') - if out.DeliveryMethods == nil { - if !in.IsDelim(']') { - out.DeliveryMethods = make([]DeliveryMethod, 0, 8) - } else { - out.DeliveryMethods = []DeliveryMethod{} - } - } else { - out.DeliveryMethods = (out.DeliveryMethods)[:0] - } - for !in.IsDelim(']') { - var v20 DeliveryMethod - v20 = DeliveryMethod(in.Int()) - out.DeliveryMethods = append(out.DeliveryMethods, v20) - in.WantComma() - } - in.Delim(']') - } - case "pos": - out.Position = AdPosition(in.Int()) - case "companionad": - if in.IsNull() { - in.Skip() - out.CompanionAds = nil - } else { - in.Delim('[') - if out.CompanionAds == nil { - if !in.IsDelim(']') { - out.CompanionAds = make([]Banner, 0, 1) - } else { - out.CompanionAds = []Banner{} - } - } else { - out.CompanionAds = (out.CompanionAds)[:0] - } - for !in.IsDelim(']') { - var v21 Banner - (v21).UnmarshalEasyJSON(in) - out.CompanionAds = append(out.CompanionAds, v21) - in.WantComma() - } - in.Delim(']') - } - case "api": - if in.IsNull() { - in.Skip() - out.APIFrameworks = nil - } else { - in.Delim('[') - if out.APIFrameworks == nil { - if !in.IsDelim(']') { - out.APIFrameworks = make([]APIFramework, 0, 8) - } else { - out.APIFrameworks = []APIFramework{} - } - } else { - out.APIFrameworks = (out.APIFrameworks)[:0] - } - for !in.IsDelim(']') { - var v22 APIFramework - v22 = APIFramework(in.Int()) - out.APIFrameworks = append(out.APIFrameworks, v22) - in.WantComma() - } - in.Delim(']') - } - case "companiontype": - if in.IsNull() { - in.Skip() - out.CompanionTypes = nil - } else { - in.Delim('[') - if out.CompanionTypes == nil { - if !in.IsDelim(']') { - out.CompanionTypes = make([]CompanionType, 0, 8) - } else { - out.CompanionTypes = []CompanionType{} - } - } else { - out.CompanionTypes = (out.CompanionTypes)[:0] - } - for !in.IsDelim(']') { - var v23 CompanionType - v23 = CompanionType(in.Int()) - out.CompanionTypes = append(out.CompanionTypes, v23) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb2(out *jwriter.Writer, in Video) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"mimes\":" - out.RawString(prefix[1:]) - if in.MIMETypes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v24, v25 := range in.MIMETypes { - if v24 > 0 { - out.RawByte(',') - } - out.String(string(v25)) - } - out.RawByte(']') - } - } - if in.MinDuration != nil { - const prefix string = ",\"minduration\":" - out.RawString(prefix) - out.Int(int(*in.MinDuration)) - } - if in.MaxDuration != nil { - const prefix string = ",\"maxduration\":" - out.RawString(prefix) - out.Int(int(*in.MaxDuration)) - } - if len(in.Protocols) != 0 { - const prefix string = ",\"protocols\":" - out.RawString(prefix) - { - out.RawByte('[') - for v26, v27 := range in.Protocols { - if v26 > 0 { - out.RawByte(',') - } - out.Int(int(v27)) - } - out.RawByte(']') - } - } - if in.Protocol != 0 { - const prefix string = ",\"protocol\":" - out.RawString(prefix) - out.Int(int(in.Protocol)) - } - if in.Width != 0 { - const prefix string = ",\"w\":" - out.RawString(prefix) - out.Int(int(in.Width)) - } - if in.Height != 0 { - const prefix string = ",\"h\":" - out.RawString(prefix) - out.Int(int(in.Height)) - } - if in.StartDelay != nil { - const prefix string = ",\"startdelay\":" - out.RawString(prefix) - out.Int(int(*in.StartDelay)) - } - if in.PlacementType != 0 { - const prefix string = ",\"placement\":" - out.RawString(prefix) - out.Int(int(in.PlacementType)) - } - if in.Linearity != 0 { - const prefix string = ",\"linearity\":" - out.RawString(prefix) - out.Int(int(in.Linearity)) - } - if in.Skippable != 0 { - const prefix string = ",\"skip\":" - out.RawString(prefix) - out.Int(int(in.Skippable)) - } - if in.SkipMin != 0 { - const prefix string = ",\"skipmin\":" - out.RawString(prefix) - out.Int(int(in.SkipMin)) - } - if in.SkipAfter != 0 { - const prefix string = ",\"skipafter\":" - out.RawString(prefix) - out.Int(int(in.SkipAfter)) - } - if in.Sequence != 0 { - const prefix string = ",\"sequence\":" - out.RawString(prefix) - out.Int(int(in.Sequence)) - } - if len(in.BlockedCreativeAttributes) != 0 { - const prefix string = ",\"battr\":" - out.RawString(prefix) - { - out.RawByte('[') - for v28, v29 := range in.BlockedCreativeAttributes { - if v28 > 0 { - out.RawByte(',') - } - out.Int(int(v29)) - } - out.RawByte(']') - } - } - if in.MaxExtendedDuration != 0 { - const prefix string = ",\"maxextended\":" - out.RawString(prefix) - out.Int(int(in.MaxExtendedDuration)) - } - if in.MinBitRate != 0 { - const prefix string = ",\"minbitrate\":" - out.RawString(prefix) - out.Int(int(in.MinBitRate)) - } - if in.MaxBitRate != 0 { - const prefix string = ",\"maxbitrate\":" - out.RawString(prefix) - out.Int(int(in.MaxBitRate)) - } - if in.IsBoxingAllowed { - const prefix string = ",\"boxingallowed\":" - out.RawString(prefix) - out.Raw((in.IsBoxingAllowed).MarshalJSON()) - } - if len(in.PlaybackMethods) != 0 { - const prefix string = ",\"playbackmethod\":" - out.RawString(prefix) - { - out.RawByte('[') - for v30, v31 := range in.PlaybackMethods { - if v30 > 0 { - out.RawByte(',') - } - out.Int(int(v31)) - } - out.RawByte(']') - } - } - if in.PlaybackEndEvent != 0 { - const prefix string = ",\"playbackend\":" - out.RawString(prefix) - out.Int(int(in.PlaybackEndEvent)) - } - if len(in.DeliveryMethods) != 0 { - const prefix string = ",\"delivery\":" - out.RawString(prefix) - { - out.RawByte('[') - for v32, v33 := range in.DeliveryMethods { - if v32 > 0 { - out.RawByte(',') - } - out.Int(int(v33)) - } - out.RawByte(']') - } - } - if in.Position != 0 { - const prefix string = ",\"pos\":" - out.RawString(prefix) - out.Int(int(in.Position)) - } - if len(in.CompanionAds) != 0 { - const prefix string = ",\"companionad\":" - out.RawString(prefix) - { - out.RawByte('[') - for v34, v35 := range in.CompanionAds { - if v34 > 0 { - out.RawByte(',') - } - (v35).MarshalEasyJSON(out) - } - out.RawByte(']') - } - } - if len(in.APIFrameworks) != 0 { - const prefix string = ",\"api\":" - out.RawString(prefix) - { - out.RawByte('[') - for v36, v37 := range in.APIFrameworks { - if v36 > 0 { - out.RawByte(',') - } - out.Int(int(v37)) - } - out.RawByte(']') - } - } - if len(in.CompanionTypes) != 0 { - const prefix string = ",\"companiontype\":" - out.RawString(prefix) - { - out.RawByte('[') - for v38, v39 := range in.CompanionTypes { - if v38 > 0 { - out.RawByte(',') - } - out.Int(int(v39)) - } - out.RawByte(']') - } - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *Metric) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "type": - out.Type = string(in.String()) - case "value": - out.Value = float64(in.Float64()) - case "vendor": - out.Vendor = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in Metric) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"type\":" - out.RawString(prefix[1:]) - out.String(string(in.Type)) - } - if in.Value != 0 { - const prefix string = ",\"value\":" - out.RawString(prefix) - out.Float64(float64(in.Value)) - } - if in.Vendor != "" { - const prefix string = ",\"vendor\":" - out.RawString(prefix) - out.String(string(in.Vendor)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} diff --git a/openrtb/metric_easyjson.go b/openrtb/metric_easyjson.go index f6cd82f..793d66c 100644 --- a/openrtb/metric_easyjson.go +++ b/openrtb/metric_easyjson.go @@ -16,93 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson9478868cDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Metric) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "type": - out.Type = string(in.String()) - case "value": - out.Value = float64(in.Float64()) - case "vendor": - out.Vendor = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson9478868cEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Metric) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"type\":" - out.RawString(prefix[1:]) - out.String(string(in.Type)) - } - if in.Value != 0 { - const prefix string = ",\"value\":" - out.RawString(prefix) - out.Float64(float64(in.Value)) - } - if in.Vendor != "" { - const prefix string = ",\"vendor\":" - out.RawString(prefix) - out.String(string(in.Vendor)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Metric) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson9478868cEncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Metric) MarshalEasyJSON(w *jwriter.Writer) { - easyjson9478868cEncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Metric) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson9478868cDecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Metric) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson9478868cDecodeGithubComVungleVungoOpenrtb(l, v) -} diff --git a/openrtb/native/request/asset_easyjson.go b/openrtb/native/request/asset_easyjson.go index 714a8d7..e244b7c 100644 --- a/openrtb/native/request/asset_easyjson.go +++ b/openrtb/native/request/asset_easyjson.go @@ -4,8 +4,6 @@ package request import ( json "encoding/json" - openrtb "github.com/Vungle/vungo/openrtb" - native "github.com/Vungle/vungo/openrtb/native" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -18,538 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.Lexer, out *Asset) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = int64(in.Int64()) - case "required": - out.Required = int8(in.Int8()) - case "title": - if in.IsNull() { - in.Skip() - out.Title = nil - } else { - if out.Title == nil { - out.Title = new(Title) - } - easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest1(in, out.Title) - } - case "img": - if in.IsNull() { - in.Skip() - out.Img = nil - } else { - if out.Img == nil { - out.Img = new(Image) - } - easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest2(in, out.Img) - } - case "video": - if in.IsNull() { - in.Skip() - out.Video = nil - } else { - if out.Video == nil { - out.Video = new(Video) - } - easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest3(in, out.Video) - } - case "data": - if in.IsNull() { - in.Skip() - out.Data = nil - } else { - if out.Data == nil { - out.Data = new(Data) - } - easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest4(in, out.Data) - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter.Writer, in Asset) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"id\":" - out.RawString(prefix[1:]) - out.Int64(int64(in.ID)) - } - if in.Required != 0 { - const prefix string = ",\"required\":" - out.RawString(prefix) - out.Int8(int8(in.Required)) - } - if in.Title != nil { - const prefix string = ",\"title\":" - out.RawString(prefix) - easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest1(out, *in.Title) - } - if in.Img != nil { - const prefix string = ",\"img\":" - out.RawString(prefix) - easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest2(out, *in.Img) - } - if in.Video != nil { - const prefix string = ",\"video\":" - out.RawString(prefix) - easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest3(out, *in.Video) - } - if in.Data != nil { - const prefix string = ",\"data\":" - out.RawString(prefix) - easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest4(out, *in.Data) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Asset) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Asset) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Asset) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Asset) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest(l, v) -} -func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest4(in *jlexer.Lexer, out *Data) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "type": - out.Type = native.DataAssetType(in.Int64()) - case "len": - out.Len = int64(in.Int64()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest4(out *jwriter.Writer, in Data) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"type\":" - out.RawString(prefix[1:]) - out.Int64(int64(in.Type)) - } - if in.Len != 0 { - const prefix string = ",\"len\":" - out.RawString(prefix) - out.Int64(int64(in.Len)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest3(in *jlexer.Lexer, out *Video) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "mimes": - if in.IsNull() { - in.Skip() - out.MIMEs = nil - } else { - in.Delim('[') - if out.MIMEs == nil { - if !in.IsDelim(']') { - out.MIMEs = make([]string, 0, 4) - } else { - out.MIMEs = []string{} - } - } else { - out.MIMEs = (out.MIMEs)[:0] - } - for !in.IsDelim(']') { - var v1 string - v1 = string(in.String()) - out.MIMEs = append(out.MIMEs, v1) - in.WantComma() - } - in.Delim(']') - } - case "minduration": - out.MinDuration = int64(in.Int64()) - case "maxduration": - out.MaxDuration = int64(in.Int64()) - case "protocols": - if in.IsNull() { - in.Skip() - out.Protocols = nil - } else { - in.Delim('[') - if out.Protocols == nil { - if !in.IsDelim(']') { - out.Protocols = make([]openrtb.Protocol, 0, 8) - } else { - out.Protocols = []openrtb.Protocol{} - } - } else { - out.Protocols = (out.Protocols)[:0] - } - for !in.IsDelim(']') { - var v2 openrtb.Protocol - v2 = openrtb.Protocol(in.Int()) - out.Protocols = append(out.Protocols, v2) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest3(out *jwriter.Writer, in Video) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"mimes\":" - out.RawString(prefix[1:]) - if in.MIMEs == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v3, v4 := range in.MIMEs { - if v3 > 0 { - out.RawByte(',') - } - out.String(string(v4)) - } - out.RawByte(']') - } - } - { - const prefix string = ",\"minduration\":" - out.RawString(prefix) - out.Int64(int64(in.MinDuration)) - } - { - const prefix string = ",\"maxduration\":" - out.RawString(prefix) - out.Int64(int64(in.MaxDuration)) - } - { - const prefix string = ",\"protocols\":" - out.RawString(prefix) - if in.Protocols == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v5, v6 := range in.Protocols { - if v5 > 0 { - out.RawByte(',') - } - out.Int(int(v6)) - } - out.RawByte(']') - } - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest2(in *jlexer.Lexer, out *Image) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "type": - out.Type = native.ImageAssetType(in.Int64()) - case "w": - out.W = int64(in.Int64()) - case "wmin": - out.WMin = int64(in.Int64()) - case "h": - out.H = int64(in.Int64()) - case "hmin": - out.HMin = int64(in.Int64()) - case "mimes": - if in.IsNull() { - in.Skip() - out.MIMEs = nil - } else { - in.Delim('[') - if out.MIMEs == nil { - if !in.IsDelim(']') { - out.MIMEs = make([]string, 0, 4) - } else { - out.MIMEs = []string{} - } - } else { - out.MIMEs = (out.MIMEs)[:0] - } - for !in.IsDelim(']') { - var v7 string - v7 = string(in.String()) - out.MIMEs = append(out.MIMEs, v7) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest2(out *jwriter.Writer, in Image) { - out.RawByte('{') - first := true - _ = first - if in.Type != 0 { - const prefix string = ",\"type\":" - first = false - out.RawString(prefix[1:]) - out.Int64(int64(in.Type)) - } - if in.W != 0 { - const prefix string = ",\"w\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int64(int64(in.W)) - } - if in.WMin != 0 { - const prefix string = ",\"wmin\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int64(int64(in.WMin)) - } - if in.H != 0 { - const prefix string = ",\"h\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int64(int64(in.H)) - } - if in.HMin != 0 { - const prefix string = ",\"hmin\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int64(int64(in.HMin)) - } - if len(in.MIMEs) != 0 { - const prefix string = ",\"mimes\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v8, v9 := range in.MIMEs { - if v8 > 0 { - out.RawByte(',') - } - out.String(string(v9)) - } - out.RawByte(']') - } - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest1(in *jlexer.Lexer, out *Title) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "len": - out.Len = int64(in.Int64()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest1(out *jwriter.Writer, in Title) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"len\":" - out.RawString(prefix[1:]) - out.Int64(int64(in.Len)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} diff --git a/openrtb/native/request/data_easyjson.go b/openrtb/native/request/data_easyjson.go index 035a36f..e244b7c 100644 --- a/openrtb/native/request/data_easyjson.go +++ b/openrtb/native/request/data_easyjson.go @@ -4,7 +4,6 @@ package request import ( json "encoding/json" - native "github.com/Vungle/vungo/openrtb/native" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -17,86 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson794297d0DecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.Lexer, out *Data) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "type": - out.Type = native.DataAssetType(in.Int64()) - case "len": - out.Len = int64(in.Int64()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson794297d0EncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter.Writer, in Data) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"type\":" - out.RawString(prefix[1:]) - out.Int64(int64(in.Type)) - } - if in.Len != 0 { - const prefix string = ",\"len\":" - out.RawString(prefix) - out.Int64(int64(in.Len)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Data) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson794297d0EncodeGithubComVungleVungoOpenrtbNativeRequest(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Data) MarshalEasyJSON(w *jwriter.Writer) { - easyjson794297d0EncodeGithubComVungleVungoOpenrtbNativeRequest(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Data) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson794297d0DecodeGithubComVungleVungoOpenrtbNativeRequest(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Data) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson794297d0DecodeGithubComVungleVungoOpenrtbNativeRequest(l, v) -} diff --git a/openrtb/native/request/eventtracker_easyjson.go b/openrtb/native/request/eventtracker_easyjson.go index 3cff83d..e244b7c 100644 --- a/openrtb/native/request/eventtracker_easyjson.go +++ b/openrtb/native/request/eventtracker_easyjson.go @@ -4,7 +4,6 @@ package request import ( json "encoding/json" - native "github.com/Vungle/vungo/openrtb/native" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -17,118 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson88abeb4cDecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.Lexer, out *EventTracker) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "event": - out.Event = native.EventType(in.Int64()) - case "methods": - if in.IsNull() { - in.Skip() - out.Methods = nil - } else { - in.Delim('[') - if out.Methods == nil { - if !in.IsDelim(']') { - out.Methods = make([]native.EventTrackingMethod, 0, 8) - } else { - out.Methods = []native.EventTrackingMethod{} - } - } else { - out.Methods = (out.Methods)[:0] - } - for !in.IsDelim(']') { - var v1 native.EventTrackingMethod - v1 = native.EventTrackingMethod(in.Int64()) - out.Methods = append(out.Methods, v1) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson88abeb4cEncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter.Writer, in EventTracker) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"event\":" - out.RawString(prefix[1:]) - out.Int64(int64(in.Event)) - } - { - const prefix string = ",\"methods\":" - out.RawString(prefix) - if in.Methods == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v2, v3 := range in.Methods { - if v2 > 0 { - out.RawByte(',') - } - out.Int64(int64(v3)) - } - out.RawByte(']') - } - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v EventTracker) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson88abeb4cEncodeGithubComVungleVungoOpenrtbNativeRequest(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v EventTracker) MarshalEasyJSON(w *jwriter.Writer) { - easyjson88abeb4cEncodeGithubComVungleVungoOpenrtbNativeRequest(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *EventTracker) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson88abeb4cDecodeGithubComVungleVungoOpenrtbNativeRequest(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *EventTracker) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson88abeb4cDecodeGithubComVungleVungoOpenrtbNativeRequest(l, v) -} diff --git a/openrtb/native/request/image_easyjson.go b/openrtb/native/request/image_easyjson.go index 93c56ba..e244b7c 100644 --- a/openrtb/native/request/image_easyjson.go +++ b/openrtb/native/request/image_easyjson.go @@ -4,7 +4,6 @@ package request import ( json "encoding/json" - native "github.com/Vungle/vungo/openrtb/native" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -17,175 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson220accf5DecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.Lexer, out *Image) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "type": - out.Type = native.ImageAssetType(in.Int64()) - case "w": - out.W = int64(in.Int64()) - case "wmin": - out.WMin = int64(in.Int64()) - case "h": - out.H = int64(in.Int64()) - case "hmin": - out.HMin = int64(in.Int64()) - case "mimes": - if in.IsNull() { - in.Skip() - out.MIMEs = nil - } else { - in.Delim('[') - if out.MIMEs == nil { - if !in.IsDelim(']') { - out.MIMEs = make([]string, 0, 4) - } else { - out.MIMEs = []string{} - } - } else { - out.MIMEs = (out.MIMEs)[:0] - } - for !in.IsDelim(']') { - var v1 string - v1 = string(in.String()) - out.MIMEs = append(out.MIMEs, v1) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson220accf5EncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter.Writer, in Image) { - out.RawByte('{') - first := true - _ = first - if in.Type != 0 { - const prefix string = ",\"type\":" - first = false - out.RawString(prefix[1:]) - out.Int64(int64(in.Type)) - } - if in.W != 0 { - const prefix string = ",\"w\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int64(int64(in.W)) - } - if in.WMin != 0 { - const prefix string = ",\"wmin\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int64(int64(in.WMin)) - } - if in.H != 0 { - const prefix string = ",\"h\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int64(int64(in.H)) - } - if in.HMin != 0 { - const prefix string = ",\"hmin\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int64(int64(in.HMin)) - } - if len(in.MIMEs) != 0 { - const prefix string = ",\"mimes\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v2, v3 := range in.MIMEs { - if v2 > 0 { - out.RawByte(',') - } - out.String(string(v3)) - } - out.RawByte(']') - } - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Image) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson220accf5EncodeGithubComVungleVungoOpenrtbNativeRequest(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Image) MarshalEasyJSON(w *jwriter.Writer) { - easyjson220accf5EncodeGithubComVungleVungoOpenrtbNativeRequest(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Image) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson220accf5DecodeGithubComVungleVungoOpenrtbNativeRequest(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Image) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson220accf5DecodeGithubComVungleVungoOpenrtbNativeRequest(l, v) -} diff --git a/openrtb/native/request/request_easyjson.go b/openrtb/native/request/request_easyjson.go index 2cec868..e244b7c 100644 --- a/openrtb/native/request/request_easyjson.go +++ b/openrtb/native/request/request_easyjson.go @@ -4,7 +4,6 @@ package request import ( json "encoding/json" - native "github.com/Vungle/vungo/openrtb/native" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -17,242 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson3c9d2b01DecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.Lexer, out *Request) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "ver": - out.Ver = string(in.String()) - case "context": - out.Context = native.ContextType(in.Int64()) - case "contextsubtype": - out.ContextSubType = native.ContextSubType(in.Int64()) - case "plcmttype": - out.PlacementType = native.PlacementType(in.Int64()) - case "plcmtcnt": - out.PlacementCnt = int64(in.Int64()) - case "seq": - out.Seq = int64(in.Int64()) - case "assets": - if in.IsNull() { - in.Skip() - out.Assets = nil - } else { - in.Delim('[') - if out.Assets == nil { - if !in.IsDelim(']') { - out.Assets = make([]Asset, 0, 1) - } else { - out.Assets = []Asset{} - } - } else { - out.Assets = (out.Assets)[:0] - } - for !in.IsDelim(']') { - var v1 Asset - (v1).UnmarshalEasyJSON(in) - out.Assets = append(out.Assets, v1) - in.WantComma() - } - in.Delim(']') - } - case "aurlsupport": - out.AURLSupport = int8(in.Int8()) - case "durlsupport": - out.DURLSupport = int8(in.Int8()) - case "eventtrackers": - if in.IsNull() { - in.Skip() - out.EventTrackers = nil - } else { - in.Delim('[') - if out.EventTrackers == nil { - if !in.IsDelim(']') { - out.EventTrackers = make([]EventTracker, 0, 1) - } else { - out.EventTrackers = []EventTracker{} - } - } else { - out.EventTrackers = (out.EventTrackers)[:0] - } - for !in.IsDelim(']') { - var v2 EventTracker - (v2).UnmarshalEasyJSON(in) - out.EventTrackers = append(out.EventTrackers, v2) - in.WantComma() - } - in.Delim(']') - } - case "privacy": - out.Privacy = int8(in.Int8()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson3c9d2b01EncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter.Writer, in Request) { - out.RawByte('{') - first := true - _ = first - if in.Ver != "" { - const prefix string = ",\"ver\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.Ver)) - } - if in.Context != 0 { - const prefix string = ",\"context\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int64(int64(in.Context)) - } - if in.ContextSubType != 0 { - const prefix string = ",\"contextsubtype\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int64(int64(in.ContextSubType)) - } - if in.PlacementType != 0 { - const prefix string = ",\"plcmttype\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int64(int64(in.PlacementType)) - } - if in.PlacementCnt != 0 { - const prefix string = ",\"plcmtcnt\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int64(int64(in.PlacementCnt)) - } - if in.Seq != 0 { - const prefix string = ",\"seq\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int64(int64(in.Seq)) - } - { - const prefix string = ",\"assets\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - if in.Assets == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v3, v4 := range in.Assets { - if v3 > 0 { - out.RawByte(',') - } - (v4).MarshalEasyJSON(out) - } - out.RawByte(']') - } - } - if in.AURLSupport != 0 { - const prefix string = ",\"aurlsupport\":" - out.RawString(prefix) - out.Int8(int8(in.AURLSupport)) - } - if in.DURLSupport != 0 { - const prefix string = ",\"durlsupport\":" - out.RawString(prefix) - out.Int8(int8(in.DURLSupport)) - } - if len(in.EventTrackers) != 0 { - const prefix string = ",\"eventtrackers\":" - out.RawString(prefix) - { - out.RawByte('[') - for v5, v6 := range in.EventTrackers { - if v5 > 0 { - out.RawByte(',') - } - (v6).MarshalEasyJSON(out) - } - out.RawByte(']') - } - } - if in.Privacy != 0 { - const prefix string = ",\"privacy\":" - out.RawString(prefix) - out.Int8(int8(in.Privacy)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Request) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson3c9d2b01EncodeGithubComVungleVungoOpenrtbNativeRequest(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Request) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3c9d2b01EncodeGithubComVungleVungoOpenrtbNativeRequest(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Request) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson3c9d2b01DecodeGithubComVungleVungoOpenrtbNativeRequest(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Request) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3c9d2b01DecodeGithubComVungleVungoOpenrtbNativeRequest(l, v) -} diff --git a/openrtb/native/request/title_easyjson.go b/openrtb/native/request/title_easyjson.go index 4993dde..e244b7c 100644 --- a/openrtb/native/request/title_easyjson.go +++ b/openrtb/native/request/title_easyjson.go @@ -16,79 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjsonE7952480DecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.Lexer, out *Title) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "len": - out.Len = int64(in.Int64()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonE7952480EncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter.Writer, in Title) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"len\":" - out.RawString(prefix[1:]) - out.Int64(int64(in.Len)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Title) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonE7952480EncodeGithubComVungleVungoOpenrtbNativeRequest(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Title) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonE7952480EncodeGithubComVungleVungoOpenrtbNativeRequest(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Title) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonE7952480DecodeGithubComVungleVungoOpenrtbNativeRequest(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Title) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonE7952480DecodeGithubComVungleVungoOpenrtbNativeRequest(l, v) -} diff --git a/openrtb/native/request/video_easyjson.go b/openrtb/native/request/video_easyjson.go index b36b8fa..e244b7c 100644 --- a/openrtb/native/request/video_easyjson.go +++ b/openrtb/native/request/video_easyjson.go @@ -4,7 +4,6 @@ package request import ( json "encoding/json" - openrtb "github.com/Vungle/vungo/openrtb" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -17,164 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.Lexer, out *Video) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "mimes": - if in.IsNull() { - in.Skip() - out.MIMEs = nil - } else { - in.Delim('[') - if out.MIMEs == nil { - if !in.IsDelim(']') { - out.MIMEs = make([]string, 0, 4) - } else { - out.MIMEs = []string{} - } - } else { - out.MIMEs = (out.MIMEs)[:0] - } - for !in.IsDelim(']') { - var v1 string - v1 = string(in.String()) - out.MIMEs = append(out.MIMEs, v1) - in.WantComma() - } - in.Delim(']') - } - case "minduration": - out.MinDuration = int64(in.Int64()) - case "maxduration": - out.MaxDuration = int64(in.Int64()) - case "protocols": - if in.IsNull() { - in.Skip() - out.Protocols = nil - } else { - in.Delim('[') - if out.Protocols == nil { - if !in.IsDelim(']') { - out.Protocols = make([]openrtb.Protocol, 0, 8) - } else { - out.Protocols = []openrtb.Protocol{} - } - } else { - out.Protocols = (out.Protocols)[:0] - } - for !in.IsDelim(']') { - var v2 openrtb.Protocol - v2 = openrtb.Protocol(in.Int()) - out.Protocols = append(out.Protocols, v2) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter.Writer, in Video) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"mimes\":" - out.RawString(prefix[1:]) - if in.MIMEs == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v3, v4 := range in.MIMEs { - if v3 > 0 { - out.RawByte(',') - } - out.String(string(v4)) - } - out.RawByte(']') - } - } - { - const prefix string = ",\"minduration\":" - out.RawString(prefix) - out.Int64(int64(in.MinDuration)) - } - { - const prefix string = ",\"maxduration\":" - out.RawString(prefix) - out.Int64(int64(in.MaxDuration)) - } - { - const prefix string = ",\"protocols\":" - out.RawString(prefix) - if in.Protocols == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v5, v6 := range in.Protocols { - if v5 > 0 { - out.RawByte(',') - } - out.Int(int(v6)) - } - out.RawByte(']') - } - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Video) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtbNativeRequest(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Video) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtbNativeRequest(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Video) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtbNativeRequest(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Video) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtbNativeRequest(l, v) -} diff --git a/openrtb/native/response/asset_easyjson.go b/openrtb/native/response/asset_easyjson.go index cedcf7b..813a70c 100644 --- a/openrtb/native/response/asset_easyjson.go +++ b/openrtb/native/response/asset_easyjson.go @@ -4,7 +4,6 @@ package response import ( json "encoding/json" - native "github.com/Vungle/vungo/openrtb/native" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -17,546 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer.Lexer, out *Asset) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = int64(in.Int64()) - case "required": - out.Required = int8(in.Int8()) - case "title": - if in.IsNull() { - in.Skip() - out.Title = nil - } else { - if out.Title == nil { - out.Title = new(Title) - } - easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse1(in, out.Title) - } - case "img": - if in.IsNull() { - in.Skip() - out.Img = nil - } else { - if out.Img == nil { - out.Img = new(Image) - } - easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse2(in, out.Img) - } - case "video": - if in.IsNull() { - in.Skip() - out.Video = nil - } else { - if out.Video == nil { - out.Video = new(Video) - } - easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse3(in, out.Video) - } - case "data": - if in.IsNull() { - in.Skip() - out.Data = nil - } else { - if out.Data == nil { - out.Data = new(Data) - } - easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse4(in, out.Data) - } - case "link": - if in.IsNull() { - in.Skip() - out.Link = nil - } else { - if out.Link == nil { - out.Link = new(Link) - } - easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse5(in, out.Link) - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwriter.Writer, in Asset) { - out.RawByte('{') - first := true - _ = first - if in.ID != 0 { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.Int64(int64(in.ID)) - } - if in.Required != 0 { - const prefix string = ",\"required\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int8(int8(in.Required)) - } - if in.Title != nil { - const prefix string = ",\"title\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse1(out, *in.Title) - } - if in.Img != nil { - const prefix string = ",\"img\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse2(out, *in.Img) - } - if in.Video != nil { - const prefix string = ",\"video\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse3(out, *in.Video) - } - if in.Data != nil { - const prefix string = ",\"data\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse4(out, *in.Data) - } - if in.Link != nil { - const prefix string = ",\"link\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse5(out, *in.Link) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Asset) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Asset) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Asset) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Asset) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse(l, v) -} -func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse5(in *jlexer.Lexer, out *Link) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "url": - out.URL = string(in.String()) - case "clicktrackers": - if in.IsNull() { - in.Skip() - out.ClickTrackers = nil - } else { - in.Delim('[') - if out.ClickTrackers == nil { - if !in.IsDelim(']') { - out.ClickTrackers = make([]string, 0, 4) - } else { - out.ClickTrackers = []string{} - } - } else { - out.ClickTrackers = (out.ClickTrackers)[:0] - } - for !in.IsDelim(']') { - var v1 string - v1 = string(in.String()) - out.ClickTrackers = append(out.ClickTrackers, v1) - in.WantComma() - } - in.Delim(']') - } - case "fallback": - out.Fallback = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse5(out *jwriter.Writer, in Link) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"url\":" - out.RawString(prefix[1:]) - out.String(string(in.URL)) - } - if len(in.ClickTrackers) != 0 { - const prefix string = ",\"clicktrackers\":" - out.RawString(prefix) - { - out.RawByte('[') - for v2, v3 := range in.ClickTrackers { - if v2 > 0 { - out.RawByte(',') - } - out.String(string(v3)) - } - out.RawByte(']') - } - } - if in.Fallback != "" { - const prefix string = ",\"fallback\":" - out.RawString(prefix) - out.String(string(in.Fallback)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse4(in *jlexer.Lexer, out *Data) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "type": - out.Type = native.DataAssetType(in.Int64()) - case "len": - out.Len = int64(in.Int64()) - case "value": - out.Value = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse4(out *jwriter.Writer, in Data) { - out.RawByte('{') - first := true - _ = first - if in.Type != 0 { - const prefix string = ",\"type\":" - first = false - out.RawString(prefix[1:]) - out.Int64(int64(in.Type)) - } - if in.Len != 0 { - const prefix string = ",\"len\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int64(int64(in.Len)) - } - { - const prefix string = ",\"value\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Value)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse3(in *jlexer.Lexer, out *Video) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "vasttag": - out.VASTTag = string(in.String()) - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse3(out *jwriter.Writer, in Video) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"vasttag\":" - out.RawString(prefix[1:]) - out.String(string(in.VASTTag)) - } - out.RawByte('}') -} -func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse2(in *jlexer.Lexer, out *Image) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "type": - out.Type = native.ImageAssetType(in.Int64()) - case "url": - out.URL = string(in.String()) - case "w": - out.W = int64(in.Int64()) - case "h": - out.H = int64(in.Int64()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse2(out *jwriter.Writer, in Image) { - out.RawByte('{') - first := true - _ = first - if in.Type != 0 { - const prefix string = ",\"type\":" - first = false - out.RawString(prefix[1:]) - out.Int64(int64(in.Type)) - } - { - const prefix string = ",\"url\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.URL)) - } - if in.W != 0 { - const prefix string = ",\"w\":" - out.RawString(prefix) - out.Int64(int64(in.W)) - } - if in.H != 0 { - const prefix string = ",\"h\":" - out.RawString(prefix) - out.Int64(int64(in.H)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} -func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse1(in *jlexer.Lexer, out *Title) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "text": - out.Text = string(in.String()) - case "len": - out.Len = int64(in.Int64()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse1(out *jwriter.Writer, in Title) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"text\":" - out.RawString(prefix[1:]) - out.String(string(in.Text)) - } - if in.Len != 0 { - const prefix string = ",\"len\":" - out.RawString(prefix) - out.Int64(int64(in.Len)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} diff --git a/openrtb/native/response/data_easyjson.go b/openrtb/native/response/data_easyjson.go index 1344a0e..813a70c 100644 --- a/openrtb/native/response/data_easyjson.go +++ b/openrtb/native/response/data_easyjson.go @@ -4,7 +4,6 @@ package response import ( json "encoding/json" - native "github.com/Vungle/vungo/openrtb/native" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -17,104 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson794297d0DecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer.Lexer, out *Data) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "type": - out.Type = native.DataAssetType(in.Int64()) - case "len": - out.Len = int64(in.Int64()) - case "value": - out.Value = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson794297d0EncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwriter.Writer, in Data) { - out.RawByte('{') - first := true - _ = first - if in.Type != 0 { - const prefix string = ",\"type\":" - first = false - out.RawString(prefix[1:]) - out.Int64(int64(in.Type)) - } - if in.Len != 0 { - const prefix string = ",\"len\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int64(int64(in.Len)) - } - { - const prefix string = ",\"value\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Value)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Data) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson794297d0EncodeGithubComVungleVungoOpenrtbNativeResponse(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Data) MarshalEasyJSON(w *jwriter.Writer) { - easyjson794297d0EncodeGithubComVungleVungoOpenrtbNativeResponse(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Data) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson794297d0DecodeGithubComVungleVungoOpenrtbNativeResponse(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Data) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson794297d0DecodeGithubComVungleVungoOpenrtbNativeResponse(l, v) -} diff --git a/openrtb/native/response/eventtracker_easyjson.go b/openrtb/native/response/eventtracker_easyjson.go index 82cb6c9..813a70c 100644 --- a/openrtb/native/response/eventtracker_easyjson.go +++ b/openrtb/native/response/eventtracker_easyjson.go @@ -4,7 +4,6 @@ package response import ( json "encoding/json" - native "github.com/Vungle/vungo/openrtb/native" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -17,102 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson88abeb4cDecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer.Lexer, out *EventTracker) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "event": - out.Event = native.EventType(in.Int64()) - case "method": - out.Method = native.EventTrackingMethod(in.Int64()) - case "url": - out.URL = string(in.String()) - case "customdata": - if data := in.Raw(); in.Ok() { - in.AddError((out.CustomData).UnmarshalJSON(data)) - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson88abeb4cEncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwriter.Writer, in EventTracker) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"event\":" - out.RawString(prefix[1:]) - out.Int64(int64(in.Event)) - } - { - const prefix string = ",\"method\":" - out.RawString(prefix) - out.Int64(int64(in.Method)) - } - if in.URL != "" { - const prefix string = ",\"url\":" - out.RawString(prefix) - out.String(string(in.URL)) - } - if len(in.CustomData) != 0 { - const prefix string = ",\"customdata\":" - out.RawString(prefix) - out.Raw((in.CustomData).MarshalJSON()) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v EventTracker) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson88abeb4cEncodeGithubComVungleVungoOpenrtbNativeResponse(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v EventTracker) MarshalEasyJSON(w *jwriter.Writer) { - easyjson88abeb4cEncodeGithubComVungleVungoOpenrtbNativeResponse(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *EventTracker) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson88abeb4cDecodeGithubComVungleVungoOpenrtbNativeResponse(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *EventTracker) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson88abeb4cDecodeGithubComVungleVungoOpenrtbNativeResponse(l, v) -} diff --git a/openrtb/native/response/image_easyjson.go b/openrtb/native/response/image_easyjson.go index 8850ce1..813a70c 100644 --- a/openrtb/native/response/image_easyjson.go +++ b/openrtb/native/response/image_easyjson.go @@ -4,7 +4,6 @@ package response import ( json "encoding/json" - native "github.com/Vungle/vungo/openrtb/native" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -17,106 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson220accf5DecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer.Lexer, out *Image) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "type": - out.Type = native.ImageAssetType(in.Int64()) - case "url": - out.URL = string(in.String()) - case "w": - out.W = int64(in.Int64()) - case "h": - out.H = int64(in.Int64()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson220accf5EncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwriter.Writer, in Image) { - out.RawByte('{') - first := true - _ = first - if in.Type != 0 { - const prefix string = ",\"type\":" - first = false - out.RawString(prefix[1:]) - out.Int64(int64(in.Type)) - } - { - const prefix string = ",\"url\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.URL)) - } - if in.W != 0 { - const prefix string = ",\"w\":" - out.RawString(prefix) - out.Int64(int64(in.W)) - } - if in.H != 0 { - const prefix string = ",\"h\":" - out.RawString(prefix) - out.Int64(int64(in.H)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Image) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson220accf5EncodeGithubComVungleVungoOpenrtbNativeResponse(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Image) MarshalEasyJSON(w *jwriter.Writer) { - easyjson220accf5EncodeGithubComVungleVungoOpenrtbNativeResponse(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Image) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson220accf5DecodeGithubComVungleVungoOpenrtbNativeResponse(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Image) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson220accf5DecodeGithubComVungleVungoOpenrtbNativeResponse(l, v) -} diff --git a/openrtb/native/response/link_easyjson.go b/openrtb/native/response/link_easyjson.go index d612b96..813a70c 100644 --- a/openrtb/native/response/link_easyjson.go +++ b/openrtb/native/response/link_easyjson.go @@ -16,123 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson16eb09bcDecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer.Lexer, out *Link) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "url": - out.URL = string(in.String()) - case "clicktrackers": - if in.IsNull() { - in.Skip() - out.ClickTrackers = nil - } else { - in.Delim('[') - if out.ClickTrackers == nil { - if !in.IsDelim(']') { - out.ClickTrackers = make([]string, 0, 4) - } else { - out.ClickTrackers = []string{} - } - } else { - out.ClickTrackers = (out.ClickTrackers)[:0] - } - for !in.IsDelim(']') { - var v1 string - v1 = string(in.String()) - out.ClickTrackers = append(out.ClickTrackers, v1) - in.WantComma() - } - in.Delim(']') - } - case "fallback": - out.Fallback = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson16eb09bcEncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwriter.Writer, in Link) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"url\":" - out.RawString(prefix[1:]) - out.String(string(in.URL)) - } - if len(in.ClickTrackers) != 0 { - const prefix string = ",\"clicktrackers\":" - out.RawString(prefix) - { - out.RawByte('[') - for v2, v3 := range in.ClickTrackers { - if v2 > 0 { - out.RawByte(',') - } - out.String(string(v3)) - } - out.RawByte(']') - } - } - if in.Fallback != "" { - const prefix string = ",\"fallback\":" - out.RawString(prefix) - out.String(string(in.Fallback)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Link) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson16eb09bcEncodeGithubComVungleVungoOpenrtbNativeResponse(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Link) MarshalEasyJSON(w *jwriter.Writer) { - easyjson16eb09bcEncodeGithubComVungleVungoOpenrtbNativeResponse(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Link) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson16eb09bcDecodeGithubComVungleVungoOpenrtbNativeResponse(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Link) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson16eb09bcDecodeGithubComVungleVungoOpenrtbNativeResponse(l, v) -} diff --git a/openrtb/native/response/response_easyjson.go b/openrtb/native/response/response_easyjson.go index 721d796..813a70c 100644 --- a/openrtb/native/response/response_easyjson.go +++ b/openrtb/native/response/response_easyjson.go @@ -16,246 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson6ff3ac1dDecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer.Lexer, out *Response) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "ver": - out.Ver = string(in.String()) - case "assets": - if in.IsNull() { - in.Skip() - out.Assets = nil - } else { - in.Delim('[') - if out.Assets == nil { - if !in.IsDelim(']') { - out.Assets = make([]Asset, 0, 1) - } else { - out.Assets = []Asset{} - } - } else { - out.Assets = (out.Assets)[:0] - } - for !in.IsDelim(']') { - var v1 Asset - (v1).UnmarshalEasyJSON(in) - out.Assets = append(out.Assets, v1) - in.WantComma() - } - in.Delim(']') - } - case "assetsurl": - out.AssetsURL = string(in.String()) - case "dcourl": - out.DCOURL = string(in.String()) - case "link": - (out.Link).UnmarshalEasyJSON(in) - case "imptrackers": - if in.IsNull() { - in.Skip() - out.ImpTrackers = nil - } else { - in.Delim('[') - if out.ImpTrackers == nil { - if !in.IsDelim(']') { - out.ImpTrackers = make([]string, 0, 4) - } else { - out.ImpTrackers = []string{} - } - } else { - out.ImpTrackers = (out.ImpTrackers)[:0] - } - for !in.IsDelim(']') { - var v2 string - v2 = string(in.String()) - out.ImpTrackers = append(out.ImpTrackers, v2) - in.WantComma() - } - in.Delim(']') - } - case "jstracker": - out.JSTracker = string(in.String()) - case "eventtrackers": - if in.IsNull() { - in.Skip() - out.EventTrackers = nil - } else { - in.Delim('[') - if out.EventTrackers == nil { - if !in.IsDelim(']') { - out.EventTrackers = make([]EventTracker, 0, 1) - } else { - out.EventTrackers = []EventTracker{} - } - } else { - out.EventTrackers = (out.EventTrackers)[:0] - } - for !in.IsDelim(']') { - var v3 EventTracker - (v3).UnmarshalEasyJSON(in) - out.EventTrackers = append(out.EventTrackers, v3) - in.WantComma() - } - in.Delim(']') - } - case "privacy": - out.Privacy = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson6ff3ac1dEncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwriter.Writer, in Response) { - out.RawByte('{') - first := true - _ = first - if in.Ver != "" { - const prefix string = ",\"ver\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.Ver)) - } - if len(in.Assets) != 0 { - const prefix string = ",\"assets\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v4, v5 := range in.Assets { - if v4 > 0 { - out.RawByte(',') - } - (v5).MarshalEasyJSON(out) - } - out.RawByte(']') - } - } - if in.AssetsURL != "" { - const prefix string = ",\"assetsurl\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.AssetsURL)) - } - if in.DCOURL != "" { - const prefix string = ",\"dcourl\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.DCOURL)) - } - { - const prefix string = ",\"link\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - (in.Link).MarshalEasyJSON(out) - } - if len(in.ImpTrackers) != 0 { - const prefix string = ",\"imptrackers\":" - out.RawString(prefix) - { - out.RawByte('[') - for v6, v7 := range in.ImpTrackers { - if v6 > 0 { - out.RawByte(',') - } - out.String(string(v7)) - } - out.RawByte(']') - } - } - if in.JSTracker != "" { - const prefix string = ",\"jstracker\":" - out.RawString(prefix) - out.String(string(in.JSTracker)) - } - if len(in.EventTrackers) != 0 { - const prefix string = ",\"eventtrackers\":" - out.RawString(prefix) - { - out.RawByte('[') - for v8, v9 := range in.EventTrackers { - if v8 > 0 { - out.RawByte(',') - } - (v9).MarshalEasyJSON(out) - } - out.RawByte(']') - } - } - if in.Privacy != "" { - const prefix string = ",\"privacy\":" - out.RawString(prefix) - out.String(string(in.Privacy)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Response) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson6ff3ac1dEncodeGithubComVungleVungoOpenrtbNativeResponse(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Response) MarshalEasyJSON(w *jwriter.Writer) { - easyjson6ff3ac1dEncodeGithubComVungleVungoOpenrtbNativeResponse(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Response) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson6ff3ac1dDecodeGithubComVungleVungoOpenrtbNativeResponse(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Response) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson6ff3ac1dDecodeGithubComVungleVungoOpenrtbNativeResponse(l, v) -} diff --git a/openrtb/native/response/title_easyjson.go b/openrtb/native/response/title_easyjson.go index 1ce79d9..813a70c 100644 --- a/openrtb/native/response/title_easyjson.go +++ b/openrtb/native/response/title_easyjson.go @@ -16,86 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjsonE7952480DecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer.Lexer, out *Title) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "text": - out.Text = string(in.String()) - case "len": - out.Len = int64(in.Int64()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonE7952480EncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwriter.Writer, in Title) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"text\":" - out.RawString(prefix[1:]) - out.String(string(in.Text)) - } - if in.Len != 0 { - const prefix string = ",\"len\":" - out.RawString(prefix) - out.Int64(int64(in.Len)) - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Title) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonE7952480EncodeGithubComVungleVungoOpenrtbNativeResponse(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Title) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonE7952480EncodeGithubComVungleVungoOpenrtbNativeResponse(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Title) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonE7952480DecodeGithubComVungleVungoOpenrtbNativeResponse(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Title) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonE7952480DecodeGithubComVungleVungoOpenrtbNativeResponse(l, v) -} diff --git a/openrtb/native/response/video_easyjson.go b/openrtb/native/response/video_easyjson.go index 2385e0b..813a70c 100644 --- a/openrtb/native/response/video_easyjson.go +++ b/openrtb/native/response/video_easyjson.go @@ -16,70 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer.Lexer, out *Video) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "vasttag": - out.VASTTag = string(in.String()) - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwriter.Writer, in Video) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"vasttag\":" - out.RawString(prefix[1:]) - out.String(string(in.VASTTag)) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Video) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtbNativeResponse(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Video) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtbNativeResponse(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Video) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtbNativeResponse(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Video) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtbNativeResponse(l, v) -} diff --git a/openrtb/native_easyjson.go b/openrtb/native_easyjson.go index a9c1fb8..793d66c 100644 --- a/openrtb/native_easyjson.go +++ b/openrtb/native_easyjson.go @@ -16,160 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson3eeb1cddDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Native) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "request": - out.Request = string(in.String()) - case "ver": - out.Version = string(in.String()) - case "api": - if in.IsNull() { - in.Skip() - out.APIFrameworks = nil - } else { - in.Delim('[') - if out.APIFrameworks == nil { - if !in.IsDelim(']') { - out.APIFrameworks = make([]APIFramework, 0, 8) - } else { - out.APIFrameworks = []APIFramework{} - } - } else { - out.APIFrameworks = (out.APIFrameworks)[:0] - } - for !in.IsDelim(']') { - var v1 APIFramework - v1 = APIFramework(in.Int()) - out.APIFrameworks = append(out.APIFrameworks, v1) - in.WantComma() - } - in.Delim(']') - } - case "battr": - if in.IsNull() { - in.Skip() - out.BlockedCreativeAttributes = nil - } else { - in.Delim('[') - if out.BlockedCreativeAttributes == nil { - if !in.IsDelim(']') { - out.BlockedCreativeAttributes = make([]CreativeAttribute, 0, 8) - } else { - out.BlockedCreativeAttributes = []CreativeAttribute{} - } - } else { - out.BlockedCreativeAttributes = (out.BlockedCreativeAttributes)[:0] - } - for !in.IsDelim(']') { - var v2 CreativeAttribute - v2 = CreativeAttribute(in.Int()) - out.BlockedCreativeAttributes = append(out.BlockedCreativeAttributes, v2) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson3eeb1cddEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Native) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"request\":" - out.RawString(prefix[1:]) - out.String(string(in.Request)) - } - if in.Version != "" { - const prefix string = ",\"ver\":" - out.RawString(prefix) - out.String(string(in.Version)) - } - if len(in.APIFrameworks) != 0 { - const prefix string = ",\"api\":" - out.RawString(prefix) - { - out.RawByte('[') - for v3, v4 := range in.APIFrameworks { - if v3 > 0 { - out.RawByte(',') - } - out.Int(int(v4)) - } - out.RawByte(']') - } - } - if len(in.BlockedCreativeAttributes) != 0 { - const prefix string = ",\"battr\":" - out.RawString(prefix) - { - out.RawByte('[') - for v5, v6 := range in.BlockedCreativeAttributes { - if v5 > 0 { - out.RawByte(',') - } - out.Int(int(v6)) - } - out.RawByte(']') - } - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Native) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson3eeb1cddEncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Native) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3eeb1cddEncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Native) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson3eeb1cddDecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Native) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3eeb1cddDecodeGithubComVungleVungoOpenrtb(l, v) -} diff --git a/openrtb/openrtbtest/testutil.go b/openrtb/openrtbtest/testutil.go index 0c0928f..eed15d9 100644 --- a/openrtb/openrtbtest/testutil.go +++ b/openrtb/openrtbtest/testutil.go @@ -65,13 +65,6 @@ func VerifyModelAgainstFile(t Testing, file string, modelType reflect.Type) { t.Errorf("Reduce() mismatch (-got +want):\n%s", d) } - //if !reflect.DeepEqual(model1, model2) { - // m1JSON, _ := json.MarshalIndent(model1, "", " ") - // m2JSON, _ := json.MarshalIndent(model2, "", " ") - // t.Logf("Unmarshaled: %s\nRe-marshaled: %s.", m1JSON, m2JSON) - // t.Error("Unmarshaled model should be the same as re-marshaled model.") - //} - verifyModelNonEmptyFields(t, jsonBytes, modelType) } @@ -84,7 +77,7 @@ func verifyModelNonEmptyFields(t Testing, jsonBytes []byte, modelType reflect.Ty // TODO(@garukun): Consider encapsulate pretty-printing JSON into a common library call for // testing. buf := bytes.NewBuffer(make([]byte, 0, len(jsonBytes))) - json.Indent(buf, jsonBytes, "", " ") + _ = json.Indent(buf, jsonBytes, "", " ") t.Log(buf.String()) t.Fatalf("Cannot unmarshal json onto %v.\n%v", modelType, err) @@ -202,7 +195,7 @@ func NewBidRequestForTesting(id string, impressionID string) *openrtb.BidRequest return &openrtb.BidRequest{ ID: id, Impressions: []*openrtb.Impression{ - &openrtb.Impression{ + { ID: impressionID, BidFloorCurrency: openrtb.CurrencyUSD, }, diff --git a/openrtb/privatemarketplace.go b/openrtb/privatemarketplace.go index ae7cfe4..6a9b2a1 100644 --- a/openrtb/privatemarketplace.go +++ b/openrtb/privatemarketplace.go @@ -1,6 +1,10 @@ package openrtb -import "github.com/Vungle/vungo/internal/util" +import ( + "encoding/json" + + "github.com/Vungle/vungo/internal/util" +) // PrivateMarketplace type contains additional metadata about an impression such that individual // buyers are encouraged to buy the impressions via a different channel. @@ -8,9 +12,9 @@ import "github.com/Vungle/vungo/internal/util" //go:generate easyjson $GOFILE //easyjson:json type PrivateMarketplace struct { - IsPrivateAuction NumericBool `json:"private_auction"` - Deals []*Deal `json:"deals"` - Extension interface{} `json:"ext,omitempty"` + IsPrivateAuction NumericBool `json:"private_auction"` + Deals []*Deal `json:"deals"` + Extension json.RawMessage `json:"ext,omitempty"` } // Copy returns a pointer to a copy of the Impression object. @@ -27,6 +31,6 @@ func (pmp *PrivateMarketplace) Copy() *PrivateMarketplace { } } - pmpCopy.Extension = util.DeepCopyCopiable(pmp.Extension) + pmpCopy.Extension = util.DeepCopyJSONRawMsg(pmp.Extension) return &pmpCopy } diff --git a/openrtb/privatemarketplace_easyjson.go b/openrtb/privatemarketplace_easyjson.go index a400b58..793d66c 100644 --- a/openrtb/privatemarketplace_easyjson.go +++ b/openrtb/privatemarketplace_easyjson.go @@ -16,142 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjsonE1675e4eDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *PrivateMarketplace) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "private_auction": - if data := in.Raw(); in.Ok() { - in.AddError((out.IsPrivateAuction).UnmarshalJSON(data)) - } - case "deals": - if in.IsNull() { - in.Skip() - out.Deals = nil - } else { - in.Delim('[') - if out.Deals == nil { - if !in.IsDelim(']') { - out.Deals = make([]*Deal, 0, 8) - } else { - out.Deals = []*Deal{} - } - } else { - out.Deals = (out.Deals)[:0] - } - for !in.IsDelim(']') { - var v1 *Deal - if in.IsNull() { - in.Skip() - v1 = nil - } else { - if v1 == nil { - v1 = new(Deal) - } - (*v1).UnmarshalEasyJSON(in) - } - out.Deals = append(out.Deals, v1) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonE1675e4eEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in PrivateMarketplace) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"private_auction\":" - out.RawString(prefix[1:]) - out.Raw((in.IsPrivateAuction).MarshalJSON()) - } - { - const prefix string = ",\"deals\":" - out.RawString(prefix) - if in.Deals == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v2, v3 := range in.Deals { - if v2 > 0 { - out.RawByte(',') - } - if v3 == nil { - out.RawString("null") - } else { - (*v3).MarshalEasyJSON(out) - } - } - out.RawByte(']') - } - } - if in.Extension != nil { - const prefix string = ",\"ext\":" - out.RawString(prefix) - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v PrivateMarketplace) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonE1675e4eEncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v PrivateMarketplace) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonE1675e4eEncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *PrivateMarketplace) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonE1675e4eDecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *PrivateMarketplace) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonE1675e4eDecodeGithubComVungleVungoOpenrtb(l, v) -} diff --git a/openrtb/producer_easyjson.go b/openrtb/producer_easyjson.go index cd6ceef..793d66c 100644 --- a/openrtb/producer_easyjson.go +++ b/openrtb/producer_easyjson.go @@ -16,151 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson92a4b12aDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Producer) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "cat": - if in.IsNull() { - in.Skip() - out.Cat = nil - } else { - in.Delim('[') - if out.Cat == nil { - if !in.IsDelim(']') { - out.Cat = make([]string, 0, 4) - } else { - out.Cat = []string{} - } - } else { - out.Cat = (out.Cat)[:0] - } - for !in.IsDelim(']') { - var v1 string - v1 = string(in.String()) - out.Cat = append(out.Cat, v1) - in.WantComma() - } - in.Delim(']') - } - case "domain": - out.Domain = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson92a4b12aEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Producer) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Name != "" { - const prefix string = ",\"name\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Name)) - } - if len(in.Cat) != 0 { - const prefix string = ",\"cat\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v2, v3 := range in.Cat { - if v2 > 0 { - out.RawByte(',') - } - out.String(string(v3)) - } - out.RawByte(']') - } - } - if in.Domain != "" { - const prefix string = ",\"domain\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Domain)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Producer) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson92a4b12aEncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Producer) MarshalEasyJSON(w *jwriter.Writer) { - easyjson92a4b12aEncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Producer) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson92a4b12aDecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Producer) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson92a4b12aDecodeGithubComVungleVungoOpenrtb(l, v) -} diff --git a/openrtb/publisher_easyjson.go b/openrtb/publisher_easyjson.go index 48119db..793d66c 100644 --- a/openrtb/publisher_easyjson.go +++ b/openrtb/publisher_easyjson.go @@ -16,121 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjsonE9046362DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Publisher) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "cat": - if in.IsNull() { - in.Skip() - out.Categories = nil - } else { - in.Delim('[') - if out.Categories == nil { - if !in.IsDelim(']') { - out.Categories = make([]Category, 0, 4) - } else { - out.Categories = []Category{} - } - } else { - out.Categories = (out.Categories)[:0] - } - for !in.IsDelim(']') { - var v1 Category - v1 = Category(in.String()) - out.Categories = append(out.Categories, v1) - in.WantComma() - } - in.Delim(']') - } - case "domain": - out.Domain = string(in.String()) - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonE9046362EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Publisher) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"id\":" - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Name != "" { - const prefix string = ",\"name\":" - out.RawString(prefix) - out.String(string(in.Name)) - } - if len(in.Categories) != 0 { - const prefix string = ",\"cat\":" - out.RawString(prefix) - { - out.RawByte('[') - for v2, v3 := range in.Categories { - if v2 > 0 { - out.RawByte(',') - } - out.String(string(v3)) - } - out.RawByte(']') - } - } - if in.Domain != "" { - const prefix string = ",\"domain\":" - out.RawString(prefix) - out.String(string(in.Domain)) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Publisher) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonE9046362EncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Publisher) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonE9046362EncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Publisher) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonE9046362DecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Publisher) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonE9046362DecodeGithubComVungleVungoOpenrtb(l, v) -} diff --git a/openrtb/regulation.go b/openrtb/regulation.go index 3cbe342..c9c062f 100644 --- a/openrtb/regulation.go +++ b/openrtb/regulation.go @@ -1,6 +1,10 @@ package openrtb -import "github.com/Vungle/vungo/internal/util" +import ( + "encoding/json" + + "github.com/Vungle/vungo/internal/util" +) // Regulation types denotes any industry, legal, or governmental regulations with respect to the // parent bid request object. @@ -8,8 +12,8 @@ import "github.com/Vungle/vungo/internal/util" //go:generate easyjson $GOFILE //easyjson:json type Regulation struct { - IsCoppaCompliant *NumericBool `json:"coppa,omitempty"` - Extension interface{} `json:"ext,omitempty"` + IsCoppaCompliant *NumericBool `json:"coppa,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } // Copy returns a pointer to a copy of the Regulation object. @@ -22,7 +26,7 @@ func (r *Regulation) Copy() *Regulation { coppaCopy := *r.IsCoppaCompliant regulationCopy.IsCoppaCompliant = &coppaCopy } - regulationCopy.Extension = util.DeepCopyCopiable(r.Extension) + regulationCopy.Extension = util.DeepCopyJSONRawMsg(r.Extension) return ®ulationCopy } diff --git a/openrtb/regulation_easyjson.go b/openrtb/regulation_easyjson.go index f47c3f8..793d66c 100644 --- a/openrtb/regulation_easyjson.go +++ b/openrtb/regulation_easyjson.go @@ -16,105 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson1db63384DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Regulation) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "coppa": - if in.IsNull() { - in.Skip() - out.IsCoppaCompliant = nil - } else { - if out.IsCoppaCompliant == nil { - out.IsCoppaCompliant = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.IsCoppaCompliant).UnmarshalJSON(data)) - } - } - case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson1db63384EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Regulation) { - out.RawByte('{') - first := true - _ = first - if in.IsCoppaCompliant != nil { - const prefix string = ",\"coppa\":" - first = false - out.RawString(prefix[1:]) - out.Raw((*in.IsCoppaCompliant).MarshalJSON()) - } - if in.Extension != nil { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Regulation) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson1db63384EncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Regulation) MarshalEasyJSON(w *jwriter.Writer) { - easyjson1db63384EncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Regulation) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson1db63384DecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Regulation) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson1db63384DecodeGithubComVungleVungoOpenrtb(l, v) -} diff --git a/openrtb/seatbid_easyjson.go b/openrtb/seatbid_easyjson.go index 4cc658a..793d66c 100644 --- a/openrtb/seatbid_easyjson.go +++ b/openrtb/seatbid_easyjson.go @@ -16,137 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson526ccff2DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *SeatBid) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "bid": - if in.IsNull() { - in.Skip() - out.Bids = nil - } else { - in.Delim('[') - if out.Bids == nil { - if !in.IsDelim(']') { - out.Bids = make([]*Bid, 0, 8) - } else { - out.Bids = []*Bid{} - } - } else { - out.Bids = (out.Bids)[:0] - } - for !in.IsDelim(']') { - var v1 *Bid - if in.IsNull() { - in.Skip() - v1 = nil - } else { - if v1 == nil { - v1 = new(Bid) - } - (*v1).UnmarshalEasyJSON(in) - } - out.Bids = append(out.Bids, v1) - in.WantComma() - } - in.Delim(']') - } - case "seat": - out.Seat = string(in.String()) - case "group": - out.Group = int(in.Int()) - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson526ccff2EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in SeatBid) { - out.RawByte('{') - first := true - _ = first - if len(in.Bids) != 0 { - const prefix string = ",\"bid\":" - first = false - out.RawString(prefix[1:]) - { - out.RawByte('[') - for v2, v3 := range in.Bids { - if v2 > 0 { - out.RawByte(',') - } - if v3 == nil { - out.RawString("null") - } else { - (*v3).MarshalEasyJSON(out) - } - } - out.RawByte(']') - } - } - if in.Seat != "" { - const prefix string = ",\"seat\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Seat)) - } - if in.Group != 0 { - const prefix string = ",\"group\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.Group)) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v SeatBid) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson526ccff2EncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v SeatBid) MarshalEasyJSON(w *jwriter.Writer) { - easyjson526ccff2EncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *SeatBid) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson526ccff2DecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *SeatBid) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson526ccff2DecodeGithubComVungleVungoOpenrtb(l, v) -} diff --git a/openrtb/segment_easyjson.go b/openrtb/segment_easyjson.go index a926c4a..793d66c 100644 --- a/openrtb/segment_easyjson.go +++ b/openrtb/segment_easyjson.go @@ -16,109 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson88ee421DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Segment) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "value": - out.Value = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson88ee421EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Segment) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Name != "" { - const prefix string = ",\"name\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Name)) - } - if in.Value != "" { - const prefix string = ",\"value\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Value)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Segment) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson88ee421EncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Segment) MarshalEasyJSON(w *jwriter.Writer) { - easyjson88ee421EncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Segment) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson88ee421DecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Segment) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson88ee421DecodeGithubComVungleVungoOpenrtb(l, v) -} diff --git a/openrtb/site_easyjson.go b/openrtb/site_easyjson.go index 3fa33ad..793d66c 100644 --- a/openrtb/site_easyjson.go +++ b/openrtb/site_easyjson.go @@ -16,367 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjsonD9064c5DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Site) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "name": - out.Name = string(in.String()) - case "domain": - out.Domain = string(in.String()) - case "cat": - if in.IsNull() { - in.Skip() - out.Cat = nil - } else { - in.Delim('[') - if out.Cat == nil { - if !in.IsDelim(']') { - out.Cat = make([]string, 0, 4) - } else { - out.Cat = []string{} - } - } else { - out.Cat = (out.Cat)[:0] - } - for !in.IsDelim(']') { - var v1 string - v1 = string(in.String()) - out.Cat = append(out.Cat, v1) - in.WantComma() - } - in.Delim(']') - } - case "sectioncat": - if in.IsNull() { - in.Skip() - out.SectionCat = nil - } else { - in.Delim('[') - if out.SectionCat == nil { - if !in.IsDelim(']') { - out.SectionCat = make([]string, 0, 4) - } else { - out.SectionCat = []string{} - } - } else { - out.SectionCat = (out.SectionCat)[:0] - } - for !in.IsDelim(']') { - var v2 string - v2 = string(in.String()) - out.SectionCat = append(out.SectionCat, v2) - in.WantComma() - } - in.Delim(']') - } - case "pagecat": - if in.IsNull() { - in.Skip() - out.PageCat = nil - } else { - in.Delim('[') - if out.PageCat == nil { - if !in.IsDelim(']') { - out.PageCat = make([]string, 0, 4) - } else { - out.PageCat = []string{} - } - } else { - out.PageCat = (out.PageCat)[:0] - } - for !in.IsDelim(']') { - var v3 string - v3 = string(in.String()) - out.PageCat = append(out.PageCat, v3) - in.WantComma() - } - in.Delim(']') - } - case "page": - out.Page = string(in.String()) - case "ref": - out.Ref = string(in.String()) - case "search": - out.Search = string(in.String()) - case "mobile": - if in.IsNull() { - in.Skip() - out.Mobile = nil - } else { - if out.Mobile == nil { - out.Mobile = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.Mobile).UnmarshalJSON(data)) - } - } - case "privacypolicy": - if in.IsNull() { - in.Skip() - out.PrivacyPolicy = nil - } else { - if out.PrivacyPolicy == nil { - out.PrivacyPolicy = new(NumericBool) - } - if data := in.Raw(); in.Ok() { - in.AddError((*out.PrivacyPolicy).UnmarshalJSON(data)) - } - } - case "publisher": - if in.IsNull() { - in.Skip() - out.Publisher = nil - } else { - if out.Publisher == nil { - out.Publisher = new(Publisher) - } - (*out.Publisher).UnmarshalEasyJSON(in) - } - case "content": - if in.IsNull() { - in.Skip() - out.Content = nil - } else { - if out.Content == nil { - out.Content = new(Content) - } - (*out.Content).UnmarshalEasyJSON(in) - } - case "keywords": - out.Keywords = string(in.String()) - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Ext).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjsonD9064c5EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Site) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.Name != "" { - const prefix string = ",\"name\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Name)) - } - if in.Domain != "" { - const prefix string = ",\"domain\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Domain)) - } - if len(in.Cat) != 0 { - const prefix string = ",\"cat\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v4, v5 := range in.Cat { - if v4 > 0 { - out.RawByte(',') - } - out.String(string(v5)) - } - out.RawByte(']') - } - } - if len(in.SectionCat) != 0 { - const prefix string = ",\"sectioncat\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v6, v7 := range in.SectionCat { - if v6 > 0 { - out.RawByte(',') - } - out.String(string(v7)) - } - out.RawByte(']') - } - } - if len(in.PageCat) != 0 { - const prefix string = ",\"pagecat\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v8, v9 := range in.PageCat { - if v8 > 0 { - out.RawByte(',') - } - out.String(string(v9)) - } - out.RawByte(']') - } - } - if in.Page != "" { - const prefix string = ",\"page\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Page)) - } - if in.Ref != "" { - const prefix string = ",\"ref\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Ref)) - } - if in.Search != "" { - const prefix string = ",\"search\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Search)) - } - if in.Mobile != nil { - const prefix string = ",\"mobile\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.Mobile).MarshalJSON()) - } - if in.PrivacyPolicy != nil { - const prefix string = ",\"privacypolicy\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((*in.PrivacyPolicy).MarshalJSON()) - } - if in.Publisher != nil { - const prefix string = ",\"publisher\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - (*in.Publisher).MarshalEasyJSON(out) - } - if in.Content != nil { - const prefix string = ",\"content\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - (*in.Content).MarshalEasyJSON(out) - } - if in.Keywords != "" { - const prefix string = ",\"keywords\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Keywords)) - } - if len(in.Ext) != 0 { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Raw((in.Ext).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Site) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjsonD9064c5EncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Site) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonD9064c5EncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Site) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjsonD9064c5DecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Site) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonD9064c5DecodeGithubComVungleVungoOpenrtb(l, v) -} diff --git a/openrtb/testdata/regulation.json b/openrtb/testdata/regulation.json index bd5bbca..bfa8414 100644 --- a/openrtb/testdata/regulation.json +++ b/openrtb/testdata/regulation.json @@ -1,6 +1 @@ -{ - "coppa": 1, - "ext": { - "gdpr": 1 - } -} +{"coppa":1,"ext":{"gdpr":1}} diff --git a/openrtb/user.go b/openrtb/user.go index 59be8c6..56cfbdf 100644 --- a/openrtb/user.go +++ b/openrtb/user.go @@ -1,6 +1,10 @@ package openrtb -import "github.com/Vungle/vungo/internal/util" +import ( + "encoding/json" + + "github.com/Vungle/vungo/internal/util" +) // User type contains known or derived information about the human user of the device; i.e., the // audience of the audience for advertising. @@ -9,15 +13,15 @@ import "github.com/Vungle/vungo/internal/util" //go:generate easyjson $GOFILE //easyjson:json type User struct { - ID string `json:"id,omitempty"` - BuyerID string `json:"buyeruid,omitempty"` - BirthYear int `json:"yob,omitempty"` - Gender Gender `json:"gender,omitempty"` - Keywords string `json:"keywords,omitempty"` - CustomData string `json:"customdata,omitempty"` - Geo *Geo `json:"geo,omitempty"` - Data []Data `json:"data,omitempty"` - Extension interface{} `json:"ext,omitempty"` + ID string `json:"id,omitempty"` + BuyerID string `json:"buyeruid,omitempty"` + BirthYear int `json:"yob,omitempty"` + Gender Gender `json:"gender,omitempty"` + Keywords string `json:"keywords,omitempty"` + CustomData string `json:"customdata,omitempty"` + Geo *Geo `json:"geo,omitempty"` + Data []Data `json:"data,omitempty"` + Extension json.RawMessage `json:"ext,omitempty"` } // Copy returns a pointer to a copy of the User object. @@ -37,7 +41,7 @@ func (u *User) Copy() *User { copy(userCopy.Data, u.Data) } - userCopy.Extension = util.DeepCopyCopiable(u.Extension) + userCopy.Extension = util.DeepCopyJSONRawMsg(u.Extension) return &userCopy } diff --git a/openrtb/user_easyjson.go b/openrtb/user_easyjson.go index 2a84c19..793d66c 100644 --- a/openrtb/user_easyjson.go +++ b/openrtb/user_easyjson.go @@ -16,217 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson9e1087fdDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *User) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "id": - out.ID = string(in.String()) - case "buyeruid": - out.BuyerID = string(in.String()) - case "yob": - out.BirthYear = int(in.Int()) - case "gender": - out.Gender = Gender(in.String()) - case "keywords": - out.Keywords = string(in.String()) - case "customdata": - out.CustomData = string(in.String()) - case "geo": - if in.IsNull() { - in.Skip() - out.Geo = nil - } else { - if out.Geo == nil { - out.Geo = new(Geo) - } - (*out.Geo).UnmarshalEasyJSON(in) - } - case "data": - if in.IsNull() { - in.Skip() - out.Data = nil - } else { - in.Delim('[') - if out.Data == nil { - if !in.IsDelim(']') { - out.Data = make([]Data, 0, 1) - } else { - out.Data = []Data{} - } - } else { - out.Data = (out.Data)[:0] - } - for !in.IsDelim(']') { - var v1 Data - (v1).UnmarshalEasyJSON(in) - out.Data = append(out.Data, v1) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if m, ok := out.Extension.(easyjson.Unmarshaler); ok { - m.UnmarshalEasyJSON(in) - } else if m, ok := out.Extension.(json.Unmarshaler); ok { - _ = m.UnmarshalJSON(in.Raw()) - } else { - out.Extension = in.Interface() - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson9e1087fdEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in User) { - out.RawByte('{') - first := true - _ = first - if in.ID != "" { - const prefix string = ",\"id\":" - first = false - out.RawString(prefix[1:]) - out.String(string(in.ID)) - } - if in.BuyerID != "" { - const prefix string = ",\"buyeruid\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.BuyerID)) - } - if in.BirthYear != 0 { - const prefix string = ",\"yob\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.Int(int(in.BirthYear)) - } - if in.Gender != "" { - const prefix string = ",\"gender\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Gender)) - } - if in.Keywords != "" { - const prefix string = ",\"keywords\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.Keywords)) - } - if in.CustomData != "" { - const prefix string = ",\"customdata\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - out.String(string(in.CustomData)) - } - if in.Geo != nil { - const prefix string = ",\"geo\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - (*in.Geo).MarshalEasyJSON(out) - } - if len(in.Data) != 0 { - const prefix string = ",\"data\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - { - out.RawByte('[') - for v2, v3 := range in.Data { - if v2 > 0 { - out.RawByte(',') - } - (v3).MarshalEasyJSON(out) - } - out.RawByte(']') - } - } - if in.Extension != nil { - const prefix string = ",\"ext\":" - if first { - first = false - out.RawString(prefix[1:]) - } else { - out.RawString(prefix) - } - if m, ok := in.Extension.(easyjson.Marshaler); ok { - m.MarshalEasyJSON(out) - } else if m, ok := in.Extension.(json.Marshaler); ok { - out.Raw(m.MarshalJSON()) - } else { - out.Raw(json.Marshal(in.Extension)) - } - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v User) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson9e1087fdEncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v User) MarshalEasyJSON(w *jwriter.Writer) { - easyjson9e1087fdEncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *User) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson9e1087fdDecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *User) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson9e1087fdDecodeGithubComVungleVungoOpenrtb(l, v) -} diff --git a/openrtb/video_easyjson.go b/openrtb/video_easyjson.go index 195e0c5..793d66c 100644 --- a/openrtb/video_easyjson.go +++ b/openrtb/video_easyjson.go @@ -16,522 +16,3 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) - -func easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Video) { - isTopLevel := in.IsStart() - if in.IsNull() { - if isTopLevel { - in.Consumed() - } - in.Skip() - return - } - in.Delim('{') - for !in.IsDelim('}') { - key := in.UnsafeString() - in.WantColon() - if in.IsNull() { - in.Skip() - in.WantComma() - continue - } - switch key { - case "mimes": - if in.IsNull() { - in.Skip() - out.MIMETypes = nil - } else { - in.Delim('[') - if out.MIMETypes == nil { - if !in.IsDelim(']') { - out.MIMETypes = make([]string, 0, 4) - } else { - out.MIMETypes = []string{} - } - } else { - out.MIMETypes = (out.MIMETypes)[:0] - } - for !in.IsDelim(']') { - var v1 string - v1 = string(in.String()) - out.MIMETypes = append(out.MIMETypes, v1) - in.WantComma() - } - in.Delim(']') - } - case "minduration": - if in.IsNull() { - in.Skip() - out.MinDuration = nil - } else { - if out.MinDuration == nil { - out.MinDuration = new(int) - } - *out.MinDuration = int(in.Int()) - } - case "maxduration": - if in.IsNull() { - in.Skip() - out.MaxDuration = nil - } else { - if out.MaxDuration == nil { - out.MaxDuration = new(int) - } - *out.MaxDuration = int(in.Int()) - } - case "protocols": - if in.IsNull() { - in.Skip() - out.Protocols = nil - } else { - in.Delim('[') - if out.Protocols == nil { - if !in.IsDelim(']') { - out.Protocols = make([]Protocol, 0, 8) - } else { - out.Protocols = []Protocol{} - } - } else { - out.Protocols = (out.Protocols)[:0] - } - for !in.IsDelim(']') { - var v2 Protocol - v2 = Protocol(in.Int()) - out.Protocols = append(out.Protocols, v2) - in.WantComma() - } - in.Delim(']') - } - case "protocol": - out.Protocol = Protocol(in.Int()) - case "w": - out.Width = int(in.Int()) - case "h": - out.Height = int(in.Int()) - case "startdelay": - if in.IsNull() { - in.Skip() - out.StartDelay = nil - } else { - if out.StartDelay == nil { - out.StartDelay = new(StartDelay) - } - *out.StartDelay = StartDelay(in.Int()) - } - case "placement": - out.PlacementType = VideoPlacementType(in.Int()) - case "linearity": - out.Linearity = Linearity(in.Int()) - case "skip": - out.Skippable = int(in.Int()) - case "skipmin": - out.SkipMin = int(in.Int()) - case "skipafter": - out.SkipAfter = int(in.Int()) - case "sequence": - out.Sequence = int(in.Int()) - case "battr": - if in.IsNull() { - in.Skip() - out.BlockedCreativeAttributes = nil - } else { - in.Delim('[') - if out.BlockedCreativeAttributes == nil { - if !in.IsDelim(']') { - out.BlockedCreativeAttributes = make([]CreativeAttribute, 0, 8) - } else { - out.BlockedCreativeAttributes = []CreativeAttribute{} - } - } else { - out.BlockedCreativeAttributes = (out.BlockedCreativeAttributes)[:0] - } - for !in.IsDelim(']') { - var v3 CreativeAttribute - v3 = CreativeAttribute(in.Int()) - out.BlockedCreativeAttributes = append(out.BlockedCreativeAttributes, v3) - in.WantComma() - } - in.Delim(']') - } - case "maxextended": - out.MaxExtendedDuration = int(in.Int()) - case "minbitrate": - out.MinBitRate = int(in.Int()) - case "maxbitrate": - out.MaxBitRate = int(in.Int()) - case "boxingallowed": - if data := in.Raw(); in.Ok() { - in.AddError((out.IsBoxingAllowed).UnmarshalJSON(data)) - } - case "playbackmethod": - if in.IsNull() { - in.Skip() - out.PlaybackMethods = nil - } else { - in.Delim('[') - if out.PlaybackMethods == nil { - if !in.IsDelim(']') { - out.PlaybackMethods = make([]PlaybackMethod, 0, 8) - } else { - out.PlaybackMethods = []PlaybackMethod{} - } - } else { - out.PlaybackMethods = (out.PlaybackMethods)[:0] - } - for !in.IsDelim(']') { - var v4 PlaybackMethod - v4 = PlaybackMethod(in.Int()) - out.PlaybackMethods = append(out.PlaybackMethods, v4) - in.WantComma() - } - in.Delim(']') - } - case "playbackend": - out.PlaybackEndEvent = PlaybackCessationMode(in.Int()) - case "delivery": - if in.IsNull() { - in.Skip() - out.DeliveryMethods = nil - } else { - in.Delim('[') - if out.DeliveryMethods == nil { - if !in.IsDelim(']') { - out.DeliveryMethods = make([]DeliveryMethod, 0, 8) - } else { - out.DeliveryMethods = []DeliveryMethod{} - } - } else { - out.DeliveryMethods = (out.DeliveryMethods)[:0] - } - for !in.IsDelim(']') { - var v5 DeliveryMethod - v5 = DeliveryMethod(in.Int()) - out.DeliveryMethods = append(out.DeliveryMethods, v5) - in.WantComma() - } - in.Delim(']') - } - case "pos": - out.Position = AdPosition(in.Int()) - case "companionad": - if in.IsNull() { - in.Skip() - out.CompanionAds = nil - } else { - in.Delim('[') - if out.CompanionAds == nil { - if !in.IsDelim(']') { - out.CompanionAds = make([]Banner, 0, 1) - } else { - out.CompanionAds = []Banner{} - } - } else { - out.CompanionAds = (out.CompanionAds)[:0] - } - for !in.IsDelim(']') { - var v6 Banner - (v6).UnmarshalEasyJSON(in) - out.CompanionAds = append(out.CompanionAds, v6) - in.WantComma() - } - in.Delim(']') - } - case "api": - if in.IsNull() { - in.Skip() - out.APIFrameworks = nil - } else { - in.Delim('[') - if out.APIFrameworks == nil { - if !in.IsDelim(']') { - out.APIFrameworks = make([]APIFramework, 0, 8) - } else { - out.APIFrameworks = []APIFramework{} - } - } else { - out.APIFrameworks = (out.APIFrameworks)[:0] - } - for !in.IsDelim(']') { - var v7 APIFramework - v7 = APIFramework(in.Int()) - out.APIFrameworks = append(out.APIFrameworks, v7) - in.WantComma() - } - in.Delim(']') - } - case "companiontype": - if in.IsNull() { - in.Skip() - out.CompanionTypes = nil - } else { - in.Delim('[') - if out.CompanionTypes == nil { - if !in.IsDelim(']') { - out.CompanionTypes = make([]CompanionType, 0, 8) - } else { - out.CompanionTypes = []CompanionType{} - } - } else { - out.CompanionTypes = (out.CompanionTypes)[:0] - } - for !in.IsDelim(']') { - var v8 CompanionType - v8 = CompanionType(in.Int()) - out.CompanionTypes = append(out.CompanionTypes, v8) - in.WantComma() - } - in.Delim(']') - } - case "ext": - if data := in.Raw(); in.Ok() { - in.AddError((out.Extension).UnmarshalJSON(data)) - } - default: - in.SkipRecursive() - } - in.WantComma() - } - in.Delim('}') - if isTopLevel { - in.Consumed() - } -} -func easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Video) { - out.RawByte('{') - first := true - _ = first - { - const prefix string = ",\"mimes\":" - out.RawString(prefix[1:]) - if in.MIMETypes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { - out.RawString("null") - } else { - out.RawByte('[') - for v9, v10 := range in.MIMETypes { - if v9 > 0 { - out.RawByte(',') - } - out.String(string(v10)) - } - out.RawByte(']') - } - } - if in.MinDuration != nil { - const prefix string = ",\"minduration\":" - out.RawString(prefix) - out.Int(int(*in.MinDuration)) - } - if in.MaxDuration != nil { - const prefix string = ",\"maxduration\":" - out.RawString(prefix) - out.Int(int(*in.MaxDuration)) - } - if len(in.Protocols) != 0 { - const prefix string = ",\"protocols\":" - out.RawString(prefix) - { - out.RawByte('[') - for v11, v12 := range in.Protocols { - if v11 > 0 { - out.RawByte(',') - } - out.Int(int(v12)) - } - out.RawByte(']') - } - } - if in.Protocol != 0 { - const prefix string = ",\"protocol\":" - out.RawString(prefix) - out.Int(int(in.Protocol)) - } - if in.Width != 0 { - const prefix string = ",\"w\":" - out.RawString(prefix) - out.Int(int(in.Width)) - } - if in.Height != 0 { - const prefix string = ",\"h\":" - out.RawString(prefix) - out.Int(int(in.Height)) - } - if in.StartDelay != nil { - const prefix string = ",\"startdelay\":" - out.RawString(prefix) - out.Int(int(*in.StartDelay)) - } - if in.PlacementType != 0 { - const prefix string = ",\"placement\":" - out.RawString(prefix) - out.Int(int(in.PlacementType)) - } - if in.Linearity != 0 { - const prefix string = ",\"linearity\":" - out.RawString(prefix) - out.Int(int(in.Linearity)) - } - if in.Skippable != 0 { - const prefix string = ",\"skip\":" - out.RawString(prefix) - out.Int(int(in.Skippable)) - } - if in.SkipMin != 0 { - const prefix string = ",\"skipmin\":" - out.RawString(prefix) - out.Int(int(in.SkipMin)) - } - if in.SkipAfter != 0 { - const prefix string = ",\"skipafter\":" - out.RawString(prefix) - out.Int(int(in.SkipAfter)) - } - if in.Sequence != 0 { - const prefix string = ",\"sequence\":" - out.RawString(prefix) - out.Int(int(in.Sequence)) - } - if len(in.BlockedCreativeAttributes) != 0 { - const prefix string = ",\"battr\":" - out.RawString(prefix) - { - out.RawByte('[') - for v13, v14 := range in.BlockedCreativeAttributes { - if v13 > 0 { - out.RawByte(',') - } - out.Int(int(v14)) - } - out.RawByte(']') - } - } - if in.MaxExtendedDuration != 0 { - const prefix string = ",\"maxextended\":" - out.RawString(prefix) - out.Int(int(in.MaxExtendedDuration)) - } - if in.MinBitRate != 0 { - const prefix string = ",\"minbitrate\":" - out.RawString(prefix) - out.Int(int(in.MinBitRate)) - } - if in.MaxBitRate != 0 { - const prefix string = ",\"maxbitrate\":" - out.RawString(prefix) - out.Int(int(in.MaxBitRate)) - } - if in.IsBoxingAllowed { - const prefix string = ",\"boxingallowed\":" - out.RawString(prefix) - out.Raw((in.IsBoxingAllowed).MarshalJSON()) - } - if len(in.PlaybackMethods) != 0 { - const prefix string = ",\"playbackmethod\":" - out.RawString(prefix) - { - out.RawByte('[') - for v15, v16 := range in.PlaybackMethods { - if v15 > 0 { - out.RawByte(',') - } - out.Int(int(v16)) - } - out.RawByte(']') - } - } - if in.PlaybackEndEvent != 0 { - const prefix string = ",\"playbackend\":" - out.RawString(prefix) - out.Int(int(in.PlaybackEndEvent)) - } - if len(in.DeliveryMethods) != 0 { - const prefix string = ",\"delivery\":" - out.RawString(prefix) - { - out.RawByte('[') - for v17, v18 := range in.DeliveryMethods { - if v17 > 0 { - out.RawByte(',') - } - out.Int(int(v18)) - } - out.RawByte(']') - } - } - if in.Position != 0 { - const prefix string = ",\"pos\":" - out.RawString(prefix) - out.Int(int(in.Position)) - } - if len(in.CompanionAds) != 0 { - const prefix string = ",\"companionad\":" - out.RawString(prefix) - { - out.RawByte('[') - for v19, v20 := range in.CompanionAds { - if v19 > 0 { - out.RawByte(',') - } - (v20).MarshalEasyJSON(out) - } - out.RawByte(']') - } - } - if len(in.APIFrameworks) != 0 { - const prefix string = ",\"api\":" - out.RawString(prefix) - { - out.RawByte('[') - for v21, v22 := range in.APIFrameworks { - if v21 > 0 { - out.RawByte(',') - } - out.Int(int(v22)) - } - out.RawByte(']') - } - } - if len(in.CompanionTypes) != 0 { - const prefix string = ",\"companiontype\":" - out.RawString(prefix) - { - out.RawByte('[') - for v23, v24 := range in.CompanionTypes { - if v23 > 0 { - out.RawByte(',') - } - out.Int(int(v24)) - } - out.RawByte(']') - } - } - if len(in.Extension) != 0 { - const prefix string = ",\"ext\":" - out.RawString(prefix) - out.Raw((in.Extension).MarshalJSON()) - } - out.RawByte('}') -} - -// MarshalJSON supports json.Marshaler interface -func (v Video) MarshalJSON() ([]byte, error) { - w := jwriter.Writer{} - easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtb(&w, v) - return w.Buffer.BuildBytes(), w.Error -} - -// MarshalEasyJSON supports easyjson.Marshaler interface -func (v Video) MarshalEasyJSON(w *jwriter.Writer) { - easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtb(w, v) -} - -// UnmarshalJSON supports json.Unmarshaler interface -func (v *Video) UnmarshalJSON(data []byte) error { - r := jlexer.Lexer{Data: data} - easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtb(&r, v) - return r.Error() -} - -// UnmarshalEasyJSON supports easyjson.Unmarshaler interface -func (v *Video) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtb(l, v) -} From 7e4cb8d8d689c1c8175e747761df9b2936102f76 Mon Sep 17 00:00:00 2001 From: xiaopeng0216 Date: Thu, 22 Jul 2021 11:52:59 +0800 Subject: [PATCH 3/5] update easyjson version --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 67a296e..a92f473 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ env: - GO111MODULE=on before_install: - go get -v golang.org/x/lint/golint@v0.0.0-20201208152925-83fdc39ff7b5 - - go get -v github.com/mailru/easyjson/...@v0.7.1 + - go get -v github.com/mailru/easyjson/...@v0.7.7 - go mod download - go mod graph From 8c87212a218dda5557baa2bdc75eb630cd8a2b60 Mon Sep 17 00:00:00 2001 From: xiaopeng0216 Date: Thu, 22 Jul 2021 11:58:02 +0800 Subject: [PATCH 4/5] update go mod --- go.mod | 2 +- go.sum | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 586da5b..ab16313 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,6 @@ go 1.12 require ( github.com/go-test/deep v1.0.4 github.com/google/go-cmp v0.5.6 - github.com/mailru/easyjson v0.7.1 + github.com/mailru/easyjson v0.7.7 golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 // indirect ) diff --git a/go.sum b/go.sum index 146dc48..564f7b1 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,12 @@ github.com/go-test/deep v1.0.4 h1:u2CU3YKy9I2pmu9pX0eq50wCgjfGIt539SqR7FbHiho= github.com/go-test/deep v1.0.4/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/mailru/easyjson v0.7.1 h1:mdxE1MF9o53iCb2Ghj1VfWvh7ZOwHpnVG/xwXrV90U8= github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k= From c23ef069e2adfc68d2ab7808ec2e1f9a92f5fa60 Mon Sep 17 00:00:00 2001 From: xiaopeng0216 Date: Thu, 22 Jul 2021 13:01:15 +0800 Subject: [PATCH 5/5] update easyjson generated file --- openrtb/application_easyjson.go | 1239 ++++++ openrtb/audio_easyjson.go | 1003 +++++ openrtb/banner_easyjson.go | 595 +++ openrtb/bid_easyjson.go | 341 ++ openrtb/bidrequest_easyjson.go | 3949 +++++++++++++++++ openrtb/bidresponse_easyjson.go | 262 ++ openrtb/content_easyjson.go | 823 ++++ openrtb/data_easyjson.go | 229 + openrtb/deal_easyjson.go | 171 + openrtb/device_easyjson.go | 681 +++ openrtb/format_easyjson.go | 130 + openrtb/geo_easyjson.go | 226 + openrtb/impression_easyjson.go | 1107 +++++ openrtb/metric_easyjson.go | 90 + openrtb/native/request/asset_easyjson.go | 537 +++ openrtb/native/request/data_easyjson.go | 84 + .../native/request/eventtracker_easyjson.go | 116 + openrtb/native/request/image_easyjson.go | 173 + openrtb/native/request/request_easyjson.go | 240 + openrtb/native/request/title_easyjson.go | 76 + openrtb/native/request/video_easyjson.go | 162 + openrtb/native/response/asset_easyjson.go | 544 +++ openrtb/native/response/data_easyjson.go | 102 + .../native/response/eventtracker_easyjson.go | 100 + openrtb/native/response/image_easyjson.go | 104 + openrtb/native/response/link_easyjson.go | 120 + openrtb/native/response/response_easyjson.go | 243 + openrtb/native/response/title_easyjson.go | 83 + openrtb/native/response/video_easyjson.go | 67 + openrtb/native_easyjson.go | 157 + openrtb/privatemarketplace_easyjson.go | 129 + openrtb/producer_easyjson.go | 148 + openrtb/publisher_easyjson.go | 118 + openrtb/regulation_easyjson.go | 92 + openrtb/seatbid_easyjson.go | 134 + openrtb/segment_easyjson.go | 106 + openrtb/site_easyjson.go | 364 ++ openrtb/user_easyjson.go | 204 + openrtb/video_easyjson.go | 519 +++ 39 files changed, 15568 insertions(+) diff --git a/openrtb/application_easyjson.go b/openrtb/application_easyjson.go index 793d66c..65916b9 100644 --- a/openrtb/application_easyjson.go +++ b/openrtb/application_easyjson.go @@ -16,3 +16,1242 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Application) { + 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 "id": + out.ID = string(in.String()) + case "name": + out.Name = string(in.String()) + case "bundle": + out.Bundle = string(in.String()) + case "domain": + out.Domain = string(in.String()) + case "storeurl": + out.StoreURL = string(in.String()) + case "cat": + if in.IsNull() { + in.Skip() + out.Categories = nil + } else { + in.Delim('[') + if out.Categories == nil { + if !in.IsDelim(']') { + out.Categories = make([]Category, 0, 4) + } else { + out.Categories = []Category{} + } + } else { + out.Categories = (out.Categories)[:0] + } + for !in.IsDelim(']') { + var v1 Category + v1 = Category(in.String()) + out.Categories = append(out.Categories, v1) + in.WantComma() + } + in.Delim(']') + } + case "sectioncat": + if in.IsNull() { + in.Skip() + out.SectionCategories = nil + } else { + in.Delim('[') + if out.SectionCategories == nil { + if !in.IsDelim(']') { + out.SectionCategories = make([]Category, 0, 4) + } else { + out.SectionCategories = []Category{} + } + } else { + out.SectionCategories = (out.SectionCategories)[:0] + } + for !in.IsDelim(']') { + var v2 Category + v2 = Category(in.String()) + out.SectionCategories = append(out.SectionCategories, v2) + in.WantComma() + } + in.Delim(']') + } + case "pagecat": + if in.IsNull() { + in.Skip() + out.PageCategories = nil + } else { + in.Delim('[') + if out.PageCategories == nil { + if !in.IsDelim(']') { + out.PageCategories = make([]Category, 0, 4) + } else { + out.PageCategories = []Category{} + } + } else { + out.PageCategories = (out.PageCategories)[:0] + } + for !in.IsDelim(']') { + var v3 Category + v3 = Category(in.String()) + out.PageCategories = append(out.PageCategories, v3) + in.WantComma() + } + in.Delim(']') + } + case "ver": + out.Version = string(in.String()) + case "privacypolicy": + if data := in.Raw(); in.Ok() { + in.AddError((out.HasPrivacyPolicy).UnmarshalJSON(data)) + } + case "paid": + if data := in.Raw(); in.Ok() { + in.AddError((out.IsPaid).UnmarshalJSON(data)) + } + case "publisher": + if in.IsNull() { + in.Skip() + out.Publisher = nil + } else { + if out.Publisher == nil { + out.Publisher = new(Publisher) + } + easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb1(in, out.Publisher) + } + case "content": + if in.IsNull() { + in.Skip() + out.Content = nil + } else { + if out.Content == nil { + out.Content = new(Content) + } + easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb2(in, out.Content) + } + case "keywords": + out.Keywords = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Application) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Name != "" { + const prefix string = ",\"name\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Name)) + } + if in.Bundle != "" { + const prefix string = ",\"bundle\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Bundle)) + } + if in.Domain != "" { + const prefix string = ",\"domain\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Domain)) + } + if in.StoreURL != "" { + const prefix string = ",\"storeurl\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.StoreURL)) + } + if len(in.Categories) != 0 { + const prefix string = ",\"cat\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v4, v5 := range in.Categories { + if v4 > 0 { + out.RawByte(',') + } + out.String(string(v5)) + } + out.RawByte(']') + } + } + if len(in.SectionCategories) != 0 { + const prefix string = ",\"sectioncat\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v6, v7 := range in.SectionCategories { + if v6 > 0 { + out.RawByte(',') + } + out.String(string(v7)) + } + out.RawByte(']') + } + } + if len(in.PageCategories) != 0 { + const prefix string = ",\"pagecat\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v8, v9 := range in.PageCategories { + if v8 > 0 { + out.RawByte(',') + } + out.String(string(v9)) + } + out.RawByte(']') + } + } + if in.Version != "" { + const prefix string = ",\"ver\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Version)) + } + if in.HasPrivacyPolicy { + const prefix string = ",\"privacypolicy\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.HasPrivacyPolicy).MarshalJSON()) + } + if in.IsPaid { + const prefix string = ",\"paid\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.IsPaid).MarshalJSON()) + } + if in.Publisher != nil { + const prefix string = ",\"publisher\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb1(out, *in.Publisher) + } + if in.Content != nil { + const prefix string = ",\"content\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb2(out, *in.Content) + } + if in.Keywords != "" { + const prefix string = ",\"keywords\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Keywords)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Application) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Application) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Application) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Application) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb(l, v) +} +func easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb2(in *jlexer.Lexer, out *Content) { + 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 "id": + out.ID = string(in.String()) + case "episode": + if in.IsNull() { + in.Skip() + out.Episode = nil + } else { + if out.Episode == nil { + out.Episode = new(int) + } + *out.Episode = int(in.Int()) + } + case "title": + out.Title = string(in.String()) + case "series": + out.Series = string(in.String()) + case "season": + out.Season = string(in.String()) + case "artist": + out.Artist = string(in.String()) + case "genre": + out.Genre = string(in.String()) + case "album": + out.Album = string(in.String()) + case "isrc": + out.ISRC = string(in.String()) + case "producer": + if in.IsNull() { + in.Skip() + out.Producer = nil + } else { + if out.Producer == nil { + out.Producer = new(Producer) + } + easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb3(in, out.Producer) + } + case "url": + out.URL = string(in.String()) + case "cat": + if in.IsNull() { + in.Skip() + out.Cat = nil + } else { + in.Delim('[') + if out.Cat == nil { + if !in.IsDelim(']') { + out.Cat = make([]string, 0, 4) + } else { + out.Cat = []string{} + } + } else { + out.Cat = (out.Cat)[:0] + } + for !in.IsDelim(']') { + var v10 string + v10 = string(in.String()) + out.Cat = append(out.Cat, v10) + in.WantComma() + } + in.Delim(']') + } + case "prodq": + out.ProdQ = ProductionQuality(in.Int()) + case "videoquality": + out.VideoQuality = ProductionQuality(in.Int()) + case "context": + out.Context = ContentContext(in.Int()) + case "contentrating": + out.ContentRating = string(in.String()) + case "userrating": + out.UserRating = string(in.String()) + case "qagmediarating": + out.QAGMediaRating = IQGMediaRating(in.Int()) + case "keywords": + out.Keywords = string(in.String()) + case "livestream": + if in.IsNull() { + in.Skip() + out.LiveStream = nil + } else { + if out.LiveStream == nil { + out.LiveStream = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.LiveStream).UnmarshalJSON(data)) + } + } + case "sourcerelationship": + if in.IsNull() { + in.Skip() + out.SourceRelationship = nil + } else { + if out.SourceRelationship == nil { + out.SourceRelationship = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.SourceRelationship).UnmarshalJSON(data)) + } + } + case "len": + if in.IsNull() { + in.Skip() + out.Len = nil + } else { + if out.Len == nil { + out.Len = new(int) + } + *out.Len = int(in.Int()) + } + case "language": + out.Language = string(in.String()) + case "embeddable": + if in.IsNull() { + in.Skip() + out.Embeddable = nil + } else { + if out.Embeddable == nil { + out.Embeddable = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.Embeddable).UnmarshalJSON(data)) + } + } + case "data": + if in.IsNull() { + in.Skip() + out.Data = nil + } else { + in.Delim('[') + if out.Data == nil { + if !in.IsDelim(']') { + out.Data = make([]*Data, 0, 8) + } else { + out.Data = []*Data{} + } + } else { + out.Data = (out.Data)[:0] + } + for !in.IsDelim(']') { + var v11 *Data + if in.IsNull() { + in.Skip() + v11 = nil + } else { + if v11 == nil { + v11 = new(Data) + } + easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb4(in, v11) + } + out.Data = append(out.Data, v11) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb2(out *jwriter.Writer, in Content) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Episode != nil { + const prefix string = ",\"episode\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(*in.Episode)) + } + if in.Title != "" { + const prefix string = ",\"title\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Title)) + } + if in.Series != "" { + const prefix string = ",\"series\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Series)) + } + if in.Season != "" { + const prefix string = ",\"season\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Season)) + } + if in.Artist != "" { + const prefix string = ",\"artist\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Artist)) + } + if in.Genre != "" { + const prefix string = ",\"genre\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Genre)) + } + if in.Album != "" { + const prefix string = ",\"album\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Album)) + } + if in.ISRC != "" { + const prefix string = ",\"isrc\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.ISRC)) + } + if in.Producer != nil { + const prefix string = ",\"producer\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb3(out, *in.Producer) + } + if in.URL != "" { + const prefix string = ",\"url\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.URL)) + } + if len(in.Cat) != 0 { + const prefix string = ",\"cat\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v12, v13 := range in.Cat { + if v12 > 0 { + out.RawByte(',') + } + out.String(string(v13)) + } + out.RawByte(']') + } + } + if in.ProdQ != 0 { + const prefix string = ",\"prodq\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.ProdQ)) + } + if in.VideoQuality != 0 { + const prefix string = ",\"videoquality\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.VideoQuality)) + } + if in.Context != 0 { + const prefix string = ",\"context\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Context)) + } + if in.ContentRating != "" { + const prefix string = ",\"contentrating\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.ContentRating)) + } + if in.UserRating != "" { + const prefix string = ",\"userrating\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.UserRating)) + } + if in.QAGMediaRating != 0 { + const prefix string = ",\"qagmediarating\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.QAGMediaRating)) + } + if in.Keywords != "" { + const prefix string = ",\"keywords\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Keywords)) + } + if in.LiveStream != nil { + const prefix string = ",\"livestream\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.LiveStream).MarshalJSON()) + } + if in.SourceRelationship != nil { + const prefix string = ",\"sourcerelationship\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.SourceRelationship).MarshalJSON()) + } + if in.Len != nil { + const prefix string = ",\"len\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(*in.Len)) + } + if in.Language != "" { + const prefix string = ",\"language\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Language)) + } + if in.Embeddable != nil { + const prefix string = ",\"embeddable\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.Embeddable).MarshalJSON()) + } + if len(in.Data) != 0 { + const prefix string = ",\"data\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v14, v15 := range in.Data { + if v14 > 0 { + out.RawByte(',') + } + if v15 == nil { + out.RawString("null") + } else { + easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb4(out, *v15) + } + } + out.RawByte(']') + } + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} +func easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb4(in *jlexer.Lexer, out *Data) { + 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 "id": + out.ID = string(in.String()) + case "name": + out.Name = string(in.String()) + case "segment": + if in.IsNull() { + in.Skip() + out.Segment = nil + } else { + in.Delim('[') + if out.Segment == nil { + if !in.IsDelim(']') { + out.Segment = make([]*Segment, 0, 8) + } else { + out.Segment = []*Segment{} + } + } else { + out.Segment = (out.Segment)[:0] + } + for !in.IsDelim(']') { + var v16 *Segment + if in.IsNull() { + in.Skip() + v16 = nil + } else { + if v16 == nil { + v16 = new(Segment) + } + easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb5(in, v16) + } + out.Segment = append(out.Segment, v16) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb4(out *jwriter.Writer, in Data) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Name != "" { + const prefix string = ",\"name\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Name)) + } + if len(in.Segment) != 0 { + const prefix string = ",\"segment\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v17, v18 := range in.Segment { + if v17 > 0 { + out.RawByte(',') + } + if v18 == nil { + out.RawString("null") + } else { + easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb5(out, *v18) + } + } + out.RawByte(']') + } + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} +func easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb5(in *jlexer.Lexer, out *Segment) { + 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 "id": + out.ID = string(in.String()) + case "name": + out.Name = string(in.String()) + case "value": + out.Value = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb5(out *jwriter.Writer, in Segment) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Name != "" { + const prefix string = ",\"name\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Name)) + } + if in.Value != "" { + const prefix string = ",\"value\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Value)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} +func easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb3(in *jlexer.Lexer, out *Producer) { + 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 "id": + out.ID = string(in.String()) + case "name": + out.Name = string(in.String()) + case "cat": + if in.IsNull() { + in.Skip() + out.Cat = nil + } else { + in.Delim('[') + if out.Cat == nil { + if !in.IsDelim(']') { + out.Cat = make([]string, 0, 4) + } else { + out.Cat = []string{} + } + } else { + out.Cat = (out.Cat)[:0] + } + for !in.IsDelim(']') { + var v19 string + v19 = string(in.String()) + out.Cat = append(out.Cat, v19) + in.WantComma() + } + in.Delim(']') + } + case "domain": + out.Domain = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb3(out *jwriter.Writer, in Producer) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Name != "" { + const prefix string = ",\"name\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Name)) + } + if len(in.Cat) != 0 { + const prefix string = ",\"cat\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v20, v21 := range in.Cat { + if v20 > 0 { + out.RawByte(',') + } + out.String(string(v21)) + } + out.RawByte(']') + } + } + if in.Domain != "" { + const prefix string = ",\"domain\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Domain)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} +func easyjsonB2e97d60DecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *Publisher) { + 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 "id": + out.ID = string(in.String()) + case "name": + out.Name = string(in.String()) + case "cat": + if in.IsNull() { + in.Skip() + out.Categories = nil + } else { + in.Delim('[') + if out.Categories == nil { + if !in.IsDelim(']') { + out.Categories = make([]Category, 0, 4) + } else { + out.Categories = []Category{} + } + } else { + out.Categories = (out.Categories)[:0] + } + for !in.IsDelim(']') { + var v22 Category + v22 = Category(in.String()) + out.Categories = append(out.Categories, v22) + in.WantComma() + } + in.Delim(']') + } + case "domain": + out.Domain = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonB2e97d60EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in Publisher) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"id\":" + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Name != "" { + const prefix string = ",\"name\":" + out.RawString(prefix) + out.String(string(in.Name)) + } + if len(in.Categories) != 0 { + const prefix string = ",\"cat\":" + out.RawString(prefix) + { + out.RawByte('[') + for v23, v24 := range in.Categories { + if v23 > 0 { + out.RawByte(',') + } + out.String(string(v24)) + } + out.RawByte(']') + } + } + if in.Domain != "" { + const prefix string = ",\"domain\":" + out.RawString(prefix) + out.String(string(in.Domain)) + } + out.RawByte('}') +} diff --git a/openrtb/audio_easyjson.go b/openrtb/audio_easyjson.go index 793d66c..b2b7b1c 100644 --- a/openrtb/audio_easyjson.go +++ b/openrtb/audio_easyjson.go @@ -16,3 +16,1006 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson48f1e884DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Audio) { + 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 "mimes": + if in.IsNull() { + in.Skip() + out.MIMETypes = nil + } else { + in.Delim('[') + if out.MIMETypes == nil { + if !in.IsDelim(']') { + out.MIMETypes = make([]string, 0, 4) + } else { + out.MIMETypes = []string{} + } + } else { + out.MIMETypes = (out.MIMETypes)[:0] + } + for !in.IsDelim(']') { + var v1 string + v1 = string(in.String()) + out.MIMETypes = append(out.MIMETypes, v1) + in.WantComma() + } + in.Delim(']') + } + case "minduration": + if in.IsNull() { + in.Skip() + out.MinDuration = nil + } else { + if out.MinDuration == nil { + out.MinDuration = new(int) + } + *out.MinDuration = int(in.Int()) + } + case "maxduration": + if in.IsNull() { + in.Skip() + out.MaxDuration = nil + } else { + if out.MaxDuration == nil { + out.MaxDuration = new(int) + } + *out.MaxDuration = int(in.Int()) + } + case "protocols": + if in.IsNull() { + in.Skip() + out.Protocols = nil + } else { + in.Delim('[') + if out.Protocols == nil { + if !in.IsDelim(']') { + out.Protocols = make([]Protocol, 0, 8) + } else { + out.Protocols = []Protocol{} + } + } else { + out.Protocols = (out.Protocols)[:0] + } + for !in.IsDelim(']') { + var v2 Protocol + v2 = Protocol(in.Int()) + out.Protocols = append(out.Protocols, v2) + in.WantComma() + } + in.Delim(']') + } + case "startdelay": + if in.IsNull() { + in.Skip() + out.StartDelay = nil + } else { + if out.StartDelay == nil { + out.StartDelay = new(StartDelay) + } + *out.StartDelay = StartDelay(in.Int()) + } + case "sequence": + out.Sequence = int(in.Int()) + case "battr": + if in.IsNull() { + in.Skip() + out.BlockedCreativeAttributes = nil + } else { + in.Delim('[') + if out.BlockedCreativeAttributes == nil { + if !in.IsDelim(']') { + out.BlockedCreativeAttributes = make([]CreativeAttribute, 0, 8) + } else { + out.BlockedCreativeAttributes = []CreativeAttribute{} + } + } else { + out.BlockedCreativeAttributes = (out.BlockedCreativeAttributes)[:0] + } + for !in.IsDelim(']') { + var v3 CreativeAttribute + v3 = CreativeAttribute(in.Int()) + out.BlockedCreativeAttributes = append(out.BlockedCreativeAttributes, v3) + in.WantComma() + } + in.Delim(']') + } + case "maxextended": + out.MaxExtendedDuration = int(in.Int()) + case "minbitrate": + out.MinBitRate = int(in.Int()) + case "maxbitrate": + out.MaxBitRate = int(in.Int()) + case "delivery": + if in.IsNull() { + in.Skip() + out.DeliveryMethods = nil + } else { + in.Delim('[') + if out.DeliveryMethods == nil { + if !in.IsDelim(']') { + out.DeliveryMethods = make([]DeliveryMethod, 0, 8) + } else { + out.DeliveryMethods = []DeliveryMethod{} + } + } else { + out.DeliveryMethods = (out.DeliveryMethods)[:0] + } + for !in.IsDelim(']') { + var v4 DeliveryMethod + v4 = DeliveryMethod(in.Int()) + out.DeliveryMethods = append(out.DeliveryMethods, v4) + in.WantComma() + } + in.Delim(']') + } + case "companionad": + if in.IsNull() { + in.Skip() + out.CompanionAds = nil + } else { + in.Delim('[') + if out.CompanionAds == nil { + if !in.IsDelim(']') { + out.CompanionAds = make([]Banner, 0, 0) + } else { + out.CompanionAds = []Banner{} + } + } else { + out.CompanionAds = (out.CompanionAds)[:0] + } + for !in.IsDelim(']') { + var v5 Banner + easyjson48f1e884DecodeGithubComVungleVungoOpenrtb1(in, &v5) + out.CompanionAds = append(out.CompanionAds, v5) + in.WantComma() + } + in.Delim(']') + } + case "api": + if in.IsNull() { + in.Skip() + out.APIFrameworks = nil + } else { + in.Delim('[') + if out.APIFrameworks == nil { + if !in.IsDelim(']') { + out.APIFrameworks = make([]APIFramework, 0, 8) + } else { + out.APIFrameworks = []APIFramework{} + } + } else { + out.APIFrameworks = (out.APIFrameworks)[:0] + } + for !in.IsDelim(']') { + var v6 APIFramework + v6 = APIFramework(in.Int()) + out.APIFrameworks = append(out.APIFrameworks, v6) + in.WantComma() + } + in.Delim(']') + } + case "companiontype": + if in.IsNull() { + in.Skip() + out.CompanionTypes = nil + } else { + in.Delim('[') + if out.CompanionTypes == nil { + if !in.IsDelim(']') { + out.CompanionTypes = make([]CompanionType, 0, 8) + } else { + out.CompanionTypes = []CompanionType{} + } + } else { + out.CompanionTypes = (out.CompanionTypes)[:0] + } + for !in.IsDelim(']') { + var v7 CompanionType + v7 = CompanionType(in.Int()) + out.CompanionTypes = append(out.CompanionTypes, v7) + in.WantComma() + } + in.Delim(']') + } + case "maxseq": + out.MaxSequence = int(in.Int()) + case "feed": + out.Feed = FeedType(in.Int()) + case "stitched": + if data := in.Raw(); in.Ok() { + in.AddError((out.Stitched).UnmarshalJSON(data)) + } + case "nvol": + out.NormalizedVolume = VolumeNormalizationMode(in.Int()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson48f1e884EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Audio) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"mimes\":" + out.RawString(prefix[1:]) + if in.MIMETypes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v8, v9 := range in.MIMETypes { + if v8 > 0 { + out.RawByte(',') + } + out.String(string(v9)) + } + out.RawByte(']') + } + } + if in.MinDuration != nil { + const prefix string = ",\"minduration\":" + out.RawString(prefix) + out.Int(int(*in.MinDuration)) + } + if in.MaxDuration != nil { + const prefix string = ",\"maxduration\":" + out.RawString(prefix) + out.Int(int(*in.MaxDuration)) + } + if len(in.Protocols) != 0 { + const prefix string = ",\"protocols\":" + out.RawString(prefix) + { + out.RawByte('[') + for v10, v11 := range in.Protocols { + if v10 > 0 { + out.RawByte(',') + } + out.Int(int(v11)) + } + out.RawByte(']') + } + } + if in.StartDelay != nil { + const prefix string = ",\"startdelay\":" + out.RawString(prefix) + out.Int(int(*in.StartDelay)) + } + if in.Sequence != 0 { + const prefix string = ",\"sequence\":" + out.RawString(prefix) + out.Int(int(in.Sequence)) + } + if len(in.BlockedCreativeAttributes) != 0 { + const prefix string = ",\"battr\":" + out.RawString(prefix) + { + out.RawByte('[') + for v12, v13 := range in.BlockedCreativeAttributes { + if v12 > 0 { + out.RawByte(',') + } + out.Int(int(v13)) + } + out.RawByte(']') + } + } + if in.MaxExtendedDuration != 0 { + const prefix string = ",\"maxextended\":" + out.RawString(prefix) + out.Int(int(in.MaxExtendedDuration)) + } + if in.MinBitRate != 0 { + const prefix string = ",\"minbitrate\":" + out.RawString(prefix) + out.Int(int(in.MinBitRate)) + } + if in.MaxBitRate != 0 { + const prefix string = ",\"maxbitrate\":" + out.RawString(prefix) + out.Int(int(in.MaxBitRate)) + } + if len(in.DeliveryMethods) != 0 { + const prefix string = ",\"delivery\":" + out.RawString(prefix) + { + out.RawByte('[') + for v14, v15 := range in.DeliveryMethods { + if v14 > 0 { + out.RawByte(',') + } + out.Int(int(v15)) + } + out.RawByte(']') + } + } + if len(in.CompanionAds) != 0 { + const prefix string = ",\"companionad\":" + out.RawString(prefix) + { + out.RawByte('[') + for v16, v17 := range in.CompanionAds { + if v16 > 0 { + out.RawByte(',') + } + easyjson48f1e884EncodeGithubComVungleVungoOpenrtb1(out, v17) + } + out.RawByte(']') + } + } + if len(in.APIFrameworks) != 0 { + const prefix string = ",\"api\":" + out.RawString(prefix) + { + out.RawByte('[') + for v18, v19 := range in.APIFrameworks { + if v18 > 0 { + out.RawByte(',') + } + out.Int(int(v19)) + } + out.RawByte(']') + } + } + if len(in.CompanionTypes) != 0 { + const prefix string = ",\"companiontype\":" + out.RawString(prefix) + { + out.RawByte('[') + for v20, v21 := range in.CompanionTypes { + if v20 > 0 { + out.RawByte(',') + } + out.Int(int(v21)) + } + out.RawByte(']') + } + } + if in.MaxSequence != 0 { + const prefix string = ",\"maxseq\":" + out.RawString(prefix) + out.Int(int(in.MaxSequence)) + } + if in.Feed != 0 { + const prefix string = ",\"feed\":" + out.RawString(prefix) + out.Int(int(in.Feed)) + } + if in.Stitched { + const prefix string = ",\"stitched\":" + out.RawString(prefix) + out.Raw((in.Stitched).MarshalJSON()) + } + if in.NormalizedVolume != 0 { + const prefix string = ",\"nvol\":" + out.RawString(prefix) + out.Int(int(in.NormalizedVolume)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Audio) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson48f1e884EncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Audio) MarshalEasyJSON(w *jwriter.Writer) { + easyjson48f1e884EncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Audio) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson48f1e884DecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Audio) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson48f1e884DecodeGithubComVungleVungoOpenrtb(l, v) +} +func easyjson48f1e884DecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *Banner) { + 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 "format": + if in.IsNull() { + in.Skip() + out.Format = nil + } else { + in.Delim('[') + if out.Format == nil { + if !in.IsDelim(']') { + out.Format = make([]Format, 0, 1) + } else { + out.Format = []Format{} + } + } else { + out.Format = (out.Format)[:0] + } + for !in.IsDelim(']') { + var v22 Format + easyjson48f1e884DecodeGithubComVungleVungoOpenrtb2(in, &v22) + out.Format = append(out.Format, v22) + in.WantComma() + } + in.Delim(']') + } + case "w": + out.Width = int(in.Int()) + case "h": + out.Height = int(in.Int()) + case "wmax": + if in.IsNull() { + in.Skip() + out.MaxWidth = nil + } else { + if out.MaxWidth == nil { + out.MaxWidth = new(int) + } + *out.MaxWidth = int(in.Int()) + } + case "hmax": + if in.IsNull() { + in.Skip() + out.MaxHeight = nil + } else { + if out.MaxHeight == nil { + out.MaxHeight = new(int) + } + *out.MaxHeight = int(in.Int()) + } + case "wmin": + if in.IsNull() { + in.Skip() + out.MinWidth = nil + } else { + if out.MinWidth == nil { + out.MinWidth = new(int) + } + *out.MinWidth = int(in.Int()) + } + case "hmin": + if in.IsNull() { + in.Skip() + out.MinHeight = nil + } else { + if out.MinHeight == nil { + out.MinHeight = new(int) + } + *out.MinHeight = int(in.Int()) + } + case "btype": + if in.IsNull() { + in.Skip() + out.BlockedTypes = nil + } else { + in.Delim('[') + if out.BlockedTypes == nil { + if !in.IsDelim(']') { + out.BlockedTypes = make([]int, 0, 8) + } else { + out.BlockedTypes = []int{} + } + } else { + out.BlockedTypes = (out.BlockedTypes)[:0] + } + for !in.IsDelim(']') { + var v23 int + v23 = int(in.Int()) + out.BlockedTypes = append(out.BlockedTypes, v23) + in.WantComma() + } + in.Delim(']') + } + case "battr": + if in.IsNull() { + in.Skip() + out.BlockedAttributes = nil + } else { + in.Delim('[') + if out.BlockedAttributes == nil { + if !in.IsDelim(']') { + out.BlockedAttributes = make([]int, 0, 8) + } else { + out.BlockedAttributes = []int{} + } + } else { + out.BlockedAttributes = (out.BlockedAttributes)[:0] + } + for !in.IsDelim(']') { + var v24 int + v24 = int(in.Int()) + out.BlockedAttributes = append(out.BlockedAttributes, v24) + in.WantComma() + } + in.Delim(']') + } + case "pos": + out.Position = AdPosition(in.Int()) + case "mimes": + if in.IsNull() { + in.Skip() + out.MIMETypes = nil + } else { + in.Delim('[') + if out.MIMETypes == nil { + if !in.IsDelim(']') { + out.MIMETypes = make([]string, 0, 4) + } else { + out.MIMETypes = []string{} + } + } else { + out.MIMETypes = (out.MIMETypes)[:0] + } + for !in.IsDelim(']') { + var v25 string + v25 = string(in.String()) + out.MIMETypes = append(out.MIMETypes, v25) + in.WantComma() + } + in.Delim(']') + } + case "topframe": + if in.IsNull() { + in.Skip() + out.TopFrame = nil + } else { + if out.TopFrame == nil { + out.TopFrame = new(int) + } + *out.TopFrame = int(in.Int()) + } + case "expdir": + if in.IsNull() { + in.Skip() + out.ExpandDirections = nil + } else { + in.Delim('[') + if out.ExpandDirections == nil { + if !in.IsDelim(']') { + out.ExpandDirections = make([]int, 0, 8) + } else { + out.ExpandDirections = []int{} + } + } else { + out.ExpandDirections = (out.ExpandDirections)[:0] + } + for !in.IsDelim(']') { + var v26 int + v26 = int(in.Int()) + out.ExpandDirections = append(out.ExpandDirections, v26) + in.WantComma() + } + in.Delim(']') + } + case "api": + if in.IsNull() { + in.Skip() + out.APIFrameworks = nil + } else { + in.Delim('[') + if out.APIFrameworks == nil { + if !in.IsDelim(']') { + out.APIFrameworks = make([]int, 0, 8) + } else { + out.APIFrameworks = []int{} + } + } else { + out.APIFrameworks = (out.APIFrameworks)[:0] + } + for !in.IsDelim(']') { + var v27 int + v27 = int(in.Int()) + out.APIFrameworks = append(out.APIFrameworks, v27) + in.WantComma() + } + in.Delim(']') + } + case "id": + if in.IsNull() { + in.Skip() + out.ID = nil + } else { + if out.ID == nil { + out.ID = new(string) + } + *out.ID = string(in.String()) + } + case "vcm": + out.VCM = CompanionRenderingMode(in.Int()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson48f1e884EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in Banner) { + out.RawByte('{') + first := true + _ = first + if len(in.Format) != 0 { + const prefix string = ",\"format\":" + first = false + out.RawString(prefix[1:]) + { + out.RawByte('[') + for v28, v29 := range in.Format { + if v28 > 0 { + out.RawByte(',') + } + easyjson48f1e884EncodeGithubComVungleVungoOpenrtb2(out, v29) + } + out.RawByte(']') + } + } + if in.Width != 0 { + const prefix string = ",\"w\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Width)) + } + if in.Height != 0 { + const prefix string = ",\"h\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Height)) + } + if in.MaxWidth != nil { + const prefix string = ",\"wmax\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(*in.MaxWidth)) + } + if in.MaxHeight != nil { + const prefix string = ",\"hmax\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(*in.MaxHeight)) + } + if in.MinWidth != nil { + const prefix string = ",\"wmin\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(*in.MinWidth)) + } + if in.MinHeight != nil { + const prefix string = ",\"hmin\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(*in.MinHeight)) + } + if len(in.BlockedTypes) != 0 { + const prefix string = ",\"btype\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v30, v31 := range in.BlockedTypes { + if v30 > 0 { + out.RawByte(',') + } + out.Int(int(v31)) + } + out.RawByte(']') + } + } + if len(in.BlockedAttributes) != 0 { + const prefix string = ",\"battr\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v32, v33 := range in.BlockedAttributes { + if v32 > 0 { + out.RawByte(',') + } + out.Int(int(v33)) + } + out.RawByte(']') + } + } + if in.Position != 0 { + const prefix string = ",\"pos\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Position)) + } + if len(in.MIMETypes) != 0 { + const prefix string = ",\"mimes\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v34, v35 := range in.MIMETypes { + if v34 > 0 { + out.RawByte(',') + } + out.String(string(v35)) + } + out.RawByte(']') + } + } + if in.TopFrame != nil { + const prefix string = ",\"topframe\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(*in.TopFrame)) + } + if len(in.ExpandDirections) != 0 { + const prefix string = ",\"expdir\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v36, v37 := range in.ExpandDirections { + if v36 > 0 { + out.RawByte(',') + } + out.Int(int(v37)) + } + out.RawByte(']') + } + } + if len(in.APIFrameworks) != 0 { + const prefix string = ",\"api\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v38, v39 := range in.APIFrameworks { + if v38 > 0 { + out.RawByte(',') + } + out.Int(int(v39)) + } + out.RawByte(']') + } + } + if in.ID != nil { + const prefix string = ",\"id\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(*in.ID)) + } + if in.VCM != 0 { + const prefix string = ",\"vcm\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.VCM)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson48f1e884DecodeGithubComVungleVungoOpenrtb2(in *jlexer.Lexer, out *Format) { + 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 "w": + out.W = uint64(in.Uint64()) + case "h": + out.H = uint64(in.Uint64()) + case "wratio": + out.WRatio = uint64(in.Uint64()) + case "hratio": + out.HRatio = uint64(in.Uint64()) + case "wmin": + out.WMin = uint64(in.Uint64()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson48f1e884EncodeGithubComVungleVungoOpenrtb2(out *jwriter.Writer, in Format) { + out.RawByte('{') + first := true + _ = first + if in.W != 0 { + const prefix string = ",\"w\":" + first = false + out.RawString(prefix[1:]) + out.Uint64(uint64(in.W)) + } + if in.H != 0 { + const prefix string = ",\"h\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Uint64(uint64(in.H)) + } + if in.WRatio != 0 { + const prefix string = ",\"wratio\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Uint64(uint64(in.WRatio)) + } + if in.HRatio != 0 { + const prefix string = ",\"hratio\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Uint64(uint64(in.HRatio)) + } + if in.WMin != 0 { + const prefix string = ",\"wmin\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Uint64(uint64(in.WMin)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} diff --git a/openrtb/banner_easyjson.go b/openrtb/banner_easyjson.go index 793d66c..31489ce 100644 --- a/openrtb/banner_easyjson.go +++ b/openrtb/banner_easyjson.go @@ -16,3 +16,598 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjsonC16456caDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Banner) { + 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 "format": + if in.IsNull() { + in.Skip() + out.Format = nil + } else { + in.Delim('[') + if out.Format == nil { + if !in.IsDelim(']') { + out.Format = make([]Format, 0, 1) + } else { + out.Format = []Format{} + } + } else { + out.Format = (out.Format)[:0] + } + for !in.IsDelim(']') { + var v1 Format + easyjsonC16456caDecodeGithubComVungleVungoOpenrtb1(in, &v1) + out.Format = append(out.Format, v1) + in.WantComma() + } + in.Delim(']') + } + case "w": + out.Width = int(in.Int()) + case "h": + out.Height = int(in.Int()) + case "wmax": + if in.IsNull() { + in.Skip() + out.MaxWidth = nil + } else { + if out.MaxWidth == nil { + out.MaxWidth = new(int) + } + *out.MaxWidth = int(in.Int()) + } + case "hmax": + if in.IsNull() { + in.Skip() + out.MaxHeight = nil + } else { + if out.MaxHeight == nil { + out.MaxHeight = new(int) + } + *out.MaxHeight = int(in.Int()) + } + case "wmin": + if in.IsNull() { + in.Skip() + out.MinWidth = nil + } else { + if out.MinWidth == nil { + out.MinWidth = new(int) + } + *out.MinWidth = int(in.Int()) + } + case "hmin": + if in.IsNull() { + in.Skip() + out.MinHeight = nil + } else { + if out.MinHeight == nil { + out.MinHeight = new(int) + } + *out.MinHeight = int(in.Int()) + } + case "btype": + if in.IsNull() { + in.Skip() + out.BlockedTypes = nil + } else { + in.Delim('[') + if out.BlockedTypes == nil { + if !in.IsDelim(']') { + out.BlockedTypes = make([]int, 0, 8) + } else { + out.BlockedTypes = []int{} + } + } else { + out.BlockedTypes = (out.BlockedTypes)[:0] + } + for !in.IsDelim(']') { + var v2 int + v2 = int(in.Int()) + out.BlockedTypes = append(out.BlockedTypes, v2) + in.WantComma() + } + in.Delim(']') + } + case "battr": + if in.IsNull() { + in.Skip() + out.BlockedAttributes = nil + } else { + in.Delim('[') + if out.BlockedAttributes == nil { + if !in.IsDelim(']') { + out.BlockedAttributes = make([]int, 0, 8) + } else { + out.BlockedAttributes = []int{} + } + } else { + out.BlockedAttributes = (out.BlockedAttributes)[:0] + } + for !in.IsDelim(']') { + var v3 int + v3 = int(in.Int()) + out.BlockedAttributes = append(out.BlockedAttributes, v3) + in.WantComma() + } + in.Delim(']') + } + case "pos": + out.Position = AdPosition(in.Int()) + case "mimes": + if in.IsNull() { + in.Skip() + out.MIMETypes = nil + } else { + in.Delim('[') + if out.MIMETypes == nil { + if !in.IsDelim(']') { + out.MIMETypes = make([]string, 0, 4) + } else { + out.MIMETypes = []string{} + } + } else { + out.MIMETypes = (out.MIMETypes)[:0] + } + for !in.IsDelim(']') { + var v4 string + v4 = string(in.String()) + out.MIMETypes = append(out.MIMETypes, v4) + in.WantComma() + } + in.Delim(']') + } + case "topframe": + if in.IsNull() { + in.Skip() + out.TopFrame = nil + } else { + if out.TopFrame == nil { + out.TopFrame = new(int) + } + *out.TopFrame = int(in.Int()) + } + case "expdir": + if in.IsNull() { + in.Skip() + out.ExpandDirections = nil + } else { + in.Delim('[') + if out.ExpandDirections == nil { + if !in.IsDelim(']') { + out.ExpandDirections = make([]int, 0, 8) + } else { + out.ExpandDirections = []int{} + } + } else { + out.ExpandDirections = (out.ExpandDirections)[:0] + } + for !in.IsDelim(']') { + var v5 int + v5 = int(in.Int()) + out.ExpandDirections = append(out.ExpandDirections, v5) + in.WantComma() + } + in.Delim(']') + } + case "api": + if in.IsNull() { + in.Skip() + out.APIFrameworks = nil + } else { + in.Delim('[') + if out.APIFrameworks == nil { + if !in.IsDelim(']') { + out.APIFrameworks = make([]int, 0, 8) + } else { + out.APIFrameworks = []int{} + } + } else { + out.APIFrameworks = (out.APIFrameworks)[:0] + } + for !in.IsDelim(']') { + var v6 int + v6 = int(in.Int()) + out.APIFrameworks = append(out.APIFrameworks, v6) + in.WantComma() + } + in.Delim(']') + } + case "id": + if in.IsNull() { + in.Skip() + out.ID = nil + } else { + if out.ID == nil { + out.ID = new(string) + } + *out.ID = string(in.String()) + } + case "vcm": + out.VCM = CompanionRenderingMode(in.Int()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC16456caEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Banner) { + out.RawByte('{') + first := true + _ = first + if len(in.Format) != 0 { + const prefix string = ",\"format\":" + first = false + out.RawString(prefix[1:]) + { + out.RawByte('[') + for v7, v8 := range in.Format { + if v7 > 0 { + out.RawByte(',') + } + easyjsonC16456caEncodeGithubComVungleVungoOpenrtb1(out, v8) + } + out.RawByte(']') + } + } + if in.Width != 0 { + const prefix string = ",\"w\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Width)) + } + if in.Height != 0 { + const prefix string = ",\"h\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Height)) + } + if in.MaxWidth != nil { + const prefix string = ",\"wmax\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(*in.MaxWidth)) + } + if in.MaxHeight != nil { + const prefix string = ",\"hmax\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(*in.MaxHeight)) + } + if in.MinWidth != nil { + const prefix string = ",\"wmin\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(*in.MinWidth)) + } + if in.MinHeight != nil { + const prefix string = ",\"hmin\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(*in.MinHeight)) + } + if len(in.BlockedTypes) != 0 { + const prefix string = ",\"btype\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v9, v10 := range in.BlockedTypes { + if v9 > 0 { + out.RawByte(',') + } + out.Int(int(v10)) + } + out.RawByte(']') + } + } + if len(in.BlockedAttributes) != 0 { + const prefix string = ",\"battr\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v11, v12 := range in.BlockedAttributes { + if v11 > 0 { + out.RawByte(',') + } + out.Int(int(v12)) + } + out.RawByte(']') + } + } + if in.Position != 0 { + const prefix string = ",\"pos\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Position)) + } + if len(in.MIMETypes) != 0 { + const prefix string = ",\"mimes\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v13, v14 := range in.MIMETypes { + if v13 > 0 { + out.RawByte(',') + } + out.String(string(v14)) + } + out.RawByte(']') + } + } + if in.TopFrame != nil { + const prefix string = ",\"topframe\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(*in.TopFrame)) + } + if len(in.ExpandDirections) != 0 { + const prefix string = ",\"expdir\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v15, v16 := range in.ExpandDirections { + if v15 > 0 { + out.RawByte(',') + } + out.Int(int(v16)) + } + out.RawByte(']') + } + } + if len(in.APIFrameworks) != 0 { + const prefix string = ",\"api\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v17, v18 := range in.APIFrameworks { + if v17 > 0 { + out.RawByte(',') + } + out.Int(int(v18)) + } + out.RawByte(']') + } + } + if in.ID != nil { + const prefix string = ",\"id\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(*in.ID)) + } + if in.VCM != 0 { + const prefix string = ",\"vcm\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.VCM)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Banner) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonC16456caEncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Banner) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonC16456caEncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Banner) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonC16456caDecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Banner) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonC16456caDecodeGithubComVungleVungoOpenrtb(l, v) +} +func easyjsonC16456caDecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *Format) { + 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 "w": + out.W = uint64(in.Uint64()) + case "h": + out.H = uint64(in.Uint64()) + case "wratio": + out.WRatio = uint64(in.Uint64()) + case "hratio": + out.HRatio = uint64(in.Uint64()) + case "wmin": + out.WMin = uint64(in.Uint64()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonC16456caEncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in Format) { + out.RawByte('{') + first := true + _ = first + if in.W != 0 { + const prefix string = ",\"w\":" + first = false + out.RawString(prefix[1:]) + out.Uint64(uint64(in.W)) + } + if in.H != 0 { + const prefix string = ",\"h\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Uint64(uint64(in.H)) + } + if in.WRatio != 0 { + const prefix string = ",\"wratio\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Uint64(uint64(in.WRatio)) + } + if in.HRatio != 0 { + const prefix string = ",\"hratio\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Uint64(uint64(in.HRatio)) + } + if in.WMin != 0 { + const prefix string = ",\"wmin\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Uint64(uint64(in.WMin)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} diff --git a/openrtb/bid_easyjson.go b/openrtb/bid_easyjson.go index 793d66c..b10a132 100644 --- a/openrtb/bid_easyjson.go +++ b/openrtb/bid_easyjson.go @@ -16,3 +16,344 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson31527abDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Bid) { + 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 "id": + out.ID = string(in.String()) + case "impid": + out.ImpressionID = string(in.String()) + case "price": + out.Price = float64(in.Float64()) + case "nurl": + out.WinNotificationURL = string(in.String()) + case "burl": + out.BURL = string(in.String()) + case "lurl": + out.LossNotificationURL = string(in.String()) + case "adm": + out.AdMarkup = string(in.String()) + case "adid": + out.AdID = string(in.String()) + case "adomain": + if in.IsNull() { + in.Skip() + out.AdvertiserDomains = nil + } else { + in.Delim('[') + if out.AdvertiserDomains == nil { + if !in.IsDelim(']') { + out.AdvertiserDomains = make([]string, 0, 4) + } else { + out.AdvertiserDomains = []string{} + } + } else { + out.AdvertiserDomains = (out.AdvertiserDomains)[:0] + } + for !in.IsDelim(']') { + var v1 string + v1 = string(in.String()) + out.AdvertiserDomains = append(out.AdvertiserDomains, v1) + in.WantComma() + } + in.Delim(']') + } + case "bundle": + out.Bundle = string(in.String()) + case "iurl": + out.QualityImageURL = string(in.String()) + case "cid": + out.CampaignID = string(in.String()) + case "crid": + out.CreativeID = string(in.String()) + case "tactic": + out.Tactic = string(in.String()) + case "cat": + if in.IsNull() { + in.Skip() + out.Categories = nil + } else { + in.Delim('[') + if out.Categories == nil { + if !in.IsDelim(']') { + out.Categories = make([]Category, 0, 4) + } else { + out.Categories = []Category{} + } + } else { + out.Categories = (out.Categories)[:0] + } + for !in.IsDelim(']') { + var v2 Category + v2 = Category(in.String()) + out.Categories = append(out.Categories, v2) + in.WantComma() + } + in.Delim(']') + } + case "attr": + if in.IsNull() { + in.Skip() + out.CreativeAttributes = nil + } else { + in.Delim('[') + if out.CreativeAttributes == nil { + if !in.IsDelim(']') { + out.CreativeAttributes = make([]CreativeAttribute, 0, 8) + } else { + out.CreativeAttributes = []CreativeAttribute{} + } + } else { + out.CreativeAttributes = (out.CreativeAttributes)[:0] + } + for !in.IsDelim(']') { + var v3 CreativeAttribute + v3 = CreativeAttribute(in.Int()) + out.CreativeAttributes = append(out.CreativeAttributes, v3) + in.WantComma() + } + in.Delim(']') + } + case "api": + out.API = APIFramework(in.Int()) + case "protocol": + out.Protocol = Protocol(in.Int()) + case "qagmediarating": + out.QAGMediaRating = IQGMediaRating(in.Int()) + case "language": + out.Language = string(in.String()) + case "dealid": + out.DealID = string(in.String()) + case "w": + out.Width = int(in.Int()) + case "h": + out.Height = int(in.Int()) + case "wratio": + out.WRatio = int(in.Int()) + case "hratio": + out.HRatio = int(in.Int()) + case "exp": + out.Exp = int(in.Int()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson31527abEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Bid) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"id\":" + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + { + const prefix string = ",\"impid\":" + out.RawString(prefix) + out.String(string(in.ImpressionID)) + } + { + const prefix string = ",\"price\":" + out.RawString(prefix) + out.Float64(float64(in.Price)) + } + if in.WinNotificationURL != "" { + const prefix string = ",\"nurl\":" + out.RawString(prefix) + out.String(string(in.WinNotificationURL)) + } + if in.BURL != "" { + const prefix string = ",\"burl\":" + out.RawString(prefix) + out.String(string(in.BURL)) + } + if in.LossNotificationURL != "" { + const prefix string = ",\"lurl\":" + out.RawString(prefix) + out.String(string(in.LossNotificationURL)) + } + if in.AdMarkup != "" { + const prefix string = ",\"adm\":" + out.RawString(prefix) + out.String(string(in.AdMarkup)) + } + if in.AdID != "" { + const prefix string = ",\"adid\":" + out.RawString(prefix) + out.String(string(in.AdID)) + } + if len(in.AdvertiserDomains) != 0 { + const prefix string = ",\"adomain\":" + out.RawString(prefix) + { + out.RawByte('[') + for v4, v5 := range in.AdvertiserDomains { + if v4 > 0 { + out.RawByte(',') + } + out.String(string(v5)) + } + out.RawByte(']') + } + } + if in.Bundle != "" { + const prefix string = ",\"bundle\":" + out.RawString(prefix) + out.String(string(in.Bundle)) + } + if in.QualityImageURL != "" { + const prefix string = ",\"iurl\":" + out.RawString(prefix) + out.String(string(in.QualityImageURL)) + } + if in.CampaignID != "" { + const prefix string = ",\"cid\":" + out.RawString(prefix) + out.String(string(in.CampaignID)) + } + if in.CreativeID != "" { + const prefix string = ",\"crid\":" + out.RawString(prefix) + out.String(string(in.CreativeID)) + } + if in.Tactic != "" { + const prefix string = ",\"tactic\":" + out.RawString(prefix) + out.String(string(in.Tactic)) + } + if len(in.Categories) != 0 { + const prefix string = ",\"cat\":" + out.RawString(prefix) + { + out.RawByte('[') + for v6, v7 := range in.Categories { + if v6 > 0 { + out.RawByte(',') + } + out.String(string(v7)) + } + out.RawByte(']') + } + } + if len(in.CreativeAttributes) != 0 { + const prefix string = ",\"attr\":" + out.RawString(prefix) + { + out.RawByte('[') + for v8, v9 := range in.CreativeAttributes { + if v8 > 0 { + out.RawByte(',') + } + out.Int(int(v9)) + } + out.RawByte(']') + } + } + if in.API != 0 { + const prefix string = ",\"api\":" + out.RawString(prefix) + out.Int(int(in.API)) + } + if in.Protocol != 0 { + const prefix string = ",\"protocol\":" + out.RawString(prefix) + out.Int(int(in.Protocol)) + } + if in.QAGMediaRating != 0 { + const prefix string = ",\"qagmediarating\":" + out.RawString(prefix) + out.Int(int(in.QAGMediaRating)) + } + if in.Language != "" { + const prefix string = ",\"language\":" + out.RawString(prefix) + out.String(string(in.Language)) + } + if in.DealID != "" { + const prefix string = ",\"dealid\":" + out.RawString(prefix) + out.String(string(in.DealID)) + } + if in.Width != 0 { + const prefix string = ",\"w\":" + out.RawString(prefix) + out.Int(int(in.Width)) + } + if in.Height != 0 { + const prefix string = ",\"h\":" + out.RawString(prefix) + out.Int(int(in.Height)) + } + if in.WRatio != 0 { + const prefix string = ",\"wratio\":" + out.RawString(prefix) + out.Int(int(in.WRatio)) + } + if in.HRatio != 0 { + const prefix string = ",\"hratio\":" + out.RawString(prefix) + out.Int(int(in.HRatio)) + } + if in.Exp != 0 { + const prefix string = ",\"exp\":" + out.RawString(prefix) + out.Int(int(in.Exp)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Bid) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson31527abEncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Bid) MarshalEasyJSON(w *jwriter.Writer) { + easyjson31527abEncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Bid) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson31527abDecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Bid) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson31527abDecodeGithubComVungleVungoOpenrtb(l, v) +} diff --git a/openrtb/bidrequest_easyjson.go b/openrtb/bidrequest_easyjson.go index 793d66c..648b500 100644 --- a/openrtb/bidrequest_easyjson.go +++ b/openrtb/bidrequest_easyjson.go @@ -16,3 +16,3952 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *BidRequest) { + 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 "id": + out.ID = string(in.String()) + case "imp": + if in.IsNull() { + in.Skip() + out.Impressions = nil + } else { + in.Delim('[') + if out.Impressions == nil { + if !in.IsDelim(']') { + out.Impressions = make([]*Impression, 0, 8) + } else { + out.Impressions = []*Impression{} + } + } else { + out.Impressions = (out.Impressions)[:0] + } + for !in.IsDelim(']') { + var v1 *Impression + if in.IsNull() { + in.Skip() + v1 = nil + } else { + if v1 == nil { + v1 = new(Impression) + } + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb1(in, v1) + } + out.Impressions = append(out.Impressions, v1) + in.WantComma() + } + in.Delim(']') + } + case "site": + if in.IsNull() { + in.Skip() + out.Site = nil + } else { + if out.Site == nil { + out.Site = new(Site) + } + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb2(in, out.Site) + } + case "app": + if in.IsNull() { + in.Skip() + out.Application = nil + } else { + if out.Application == nil { + out.Application = new(Application) + } + (*out.Application).UnmarshalEasyJSON(in) + } + case "device": + if in.IsNull() { + in.Skip() + out.Device = nil + } else { + if out.Device == nil { + out.Device = new(Device) + } + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb3(in, out.Device) + } + case "user": + if in.IsNull() { + in.Skip() + out.User = nil + } else { + if out.User == nil { + out.User = new(User) + } + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb4(in, out.User) + } + case "test": + if data := in.Raw(); in.Ok() { + in.AddError((out.IsTestMode).UnmarshalJSON(data)) + } + case "at": + out.AuctionType = BidAuctionType(in.Int()) + case "tmax": + out.Timeout = int(in.Int()) + case "wseat": + if in.IsNull() { + in.Skip() + out.WhitelistedSeats = nil + } else { + in.Delim('[') + if out.WhitelistedSeats == nil { + if !in.IsDelim(']') { + out.WhitelistedSeats = make([]string, 0, 4) + } else { + out.WhitelistedSeats = []string{} + } + } else { + out.WhitelistedSeats = (out.WhitelistedSeats)[:0] + } + for !in.IsDelim(']') { + var v2 string + v2 = string(in.String()) + out.WhitelistedSeats = append(out.WhitelistedSeats, v2) + in.WantComma() + } + in.Delim(']') + } + case "bseat": + if in.IsNull() { + in.Skip() + out.BlocklistedSeats = nil + } else { + in.Delim('[') + if out.BlocklistedSeats == nil { + if !in.IsDelim(']') { + out.BlocklistedSeats = make([]string, 0, 4) + } else { + out.BlocklistedSeats = []string{} + } + } else { + out.BlocklistedSeats = (out.BlocklistedSeats)[:0] + } + for !in.IsDelim(']') { + var v3 string + v3 = string(in.String()) + out.BlocklistedSeats = append(out.BlocklistedSeats, v3) + in.WantComma() + } + in.Delim(']') + } + case "allimps": + if data := in.Raw(); in.Ok() { + in.AddError((out.HasAllImpressions).UnmarshalJSON(data)) + } + case "cur": + if in.IsNull() { + in.Skip() + out.Currencies = nil + } else { + in.Delim('[') + if out.Currencies == nil { + if !in.IsDelim(']') { + out.Currencies = make([]Currency, 0, 4) + } else { + out.Currencies = []Currency{} + } + } else { + out.Currencies = (out.Currencies)[:0] + } + for !in.IsDelim(']') { + var v4 Currency + v4 = Currency(in.String()) + out.Currencies = append(out.Currencies, v4) + in.WantComma() + } + in.Delim(']') + } + case "wlang": + if in.IsNull() { + in.Skip() + out.WhitelistLanguages = nil + } else { + in.Delim('[') + if out.WhitelistLanguages == nil { + if !in.IsDelim(']') { + out.WhitelistLanguages = make([]string, 0, 4) + } else { + out.WhitelistLanguages = []string{} + } + } else { + out.WhitelistLanguages = (out.WhitelistLanguages)[:0] + } + for !in.IsDelim(']') { + var v5 string + v5 = string(in.String()) + out.WhitelistLanguages = append(out.WhitelistLanguages, v5) + in.WantComma() + } + in.Delim(']') + } + case "bcat": + if in.IsNull() { + in.Skip() + out.BlockedCategories = nil + } else { + in.Delim('[') + if out.BlockedCategories == nil { + if !in.IsDelim(']') { + out.BlockedCategories = make([]Category, 0, 4) + } else { + out.BlockedCategories = []Category{} + } + } else { + out.BlockedCategories = (out.BlockedCategories)[:0] + } + for !in.IsDelim(']') { + var v6 Category + v6 = Category(in.String()) + out.BlockedCategories = append(out.BlockedCategories, v6) + in.WantComma() + } + in.Delim(']') + } + case "badv": + if in.IsNull() { + in.Skip() + out.BlockedAdvertisers = nil + } else { + in.Delim('[') + if out.BlockedAdvertisers == nil { + if !in.IsDelim(']') { + out.BlockedAdvertisers = make([]string, 0, 4) + } else { + out.BlockedAdvertisers = []string{} + } + } else { + out.BlockedAdvertisers = (out.BlockedAdvertisers)[:0] + } + for !in.IsDelim(']') { + var v7 string + v7 = string(in.String()) + out.BlockedAdvertisers = append(out.BlockedAdvertisers, v7) + in.WantComma() + } + in.Delim(']') + } + case "bapp": + if in.IsNull() { + in.Skip() + out.BlockedAdvertisersByMarketID = nil + } else { + in.Delim('[') + if out.BlockedAdvertisersByMarketID == nil { + if !in.IsDelim(']') { + out.BlockedAdvertisersByMarketID = make([]string, 0, 4) + } else { + out.BlockedAdvertisersByMarketID = []string{} + } + } else { + out.BlockedAdvertisersByMarketID = (out.BlockedAdvertisersByMarketID)[:0] + } + for !in.IsDelim(']') { + var v8 string + v8 = string(in.String()) + out.BlockedAdvertisersByMarketID = append(out.BlockedAdvertisersByMarketID, v8) + in.WantComma() + } + in.Delim(']') + } + case "source": + if in.IsNull() { + in.Skip() + out.Source = nil + } else { + if out.Source == nil { + out.Source = new(Source) + } + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb5(in, out.Source) + } + case "regs": + if in.IsNull() { + in.Skip() + out.Regulation = nil + } else { + if out.Regulation == nil { + out.Regulation = new(Regulation) + } + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb6(in, out.Regulation) + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in BidRequest) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"id\":" + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + { + const prefix string = ",\"imp\":" + out.RawString(prefix) + if in.Impressions == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v9, v10 := range in.Impressions { + if v9 > 0 { + out.RawByte(',') + } + if v10 == nil { + out.RawString("null") + } else { + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb1(out, *v10) + } + } + out.RawByte(']') + } + } + if in.Site != nil { + const prefix string = ",\"site\":" + out.RawString(prefix) + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb2(out, *in.Site) + } + if in.Application != nil { + const prefix string = ",\"app\":" + out.RawString(prefix) + (*in.Application).MarshalEasyJSON(out) + } + if in.Device != nil { + const prefix string = ",\"device\":" + out.RawString(prefix) + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb3(out, *in.Device) + } + if in.User != nil { + const prefix string = ",\"user\":" + out.RawString(prefix) + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb4(out, *in.User) + } + if in.IsTestMode { + const prefix string = ",\"test\":" + out.RawString(prefix) + out.Raw((in.IsTestMode).MarshalJSON()) + } + { + const prefix string = ",\"at\":" + out.RawString(prefix) + out.Int(int(in.AuctionType)) + } + if in.Timeout != 0 { + const prefix string = ",\"tmax\":" + out.RawString(prefix) + out.Int(int(in.Timeout)) + } + if len(in.WhitelistedSeats) != 0 { + const prefix string = ",\"wseat\":" + out.RawString(prefix) + { + out.RawByte('[') + for v11, v12 := range in.WhitelistedSeats { + if v11 > 0 { + out.RawByte(',') + } + out.String(string(v12)) + } + out.RawByte(']') + } + } + if len(in.BlocklistedSeats) != 0 { + const prefix string = ",\"bseat\":" + out.RawString(prefix) + { + out.RawByte('[') + for v13, v14 := range in.BlocklistedSeats { + if v13 > 0 { + out.RawByte(',') + } + out.String(string(v14)) + } + out.RawByte(']') + } + } + if in.HasAllImpressions { + const prefix string = ",\"allimps\":" + out.RawString(prefix) + out.Raw((in.HasAllImpressions).MarshalJSON()) + } + if len(in.Currencies) != 0 { + const prefix string = ",\"cur\":" + out.RawString(prefix) + { + out.RawByte('[') + for v15, v16 := range in.Currencies { + if v15 > 0 { + out.RawByte(',') + } + out.String(string(v16)) + } + out.RawByte(']') + } + } + if len(in.WhitelistLanguages) != 0 { + const prefix string = ",\"wlang\":" + out.RawString(prefix) + { + out.RawByte('[') + for v17, v18 := range in.WhitelistLanguages { + if v17 > 0 { + out.RawByte(',') + } + out.String(string(v18)) + } + out.RawByte(']') + } + } + if len(in.BlockedCategories) != 0 { + const prefix string = ",\"bcat\":" + out.RawString(prefix) + { + out.RawByte('[') + for v19, v20 := range in.BlockedCategories { + if v19 > 0 { + out.RawByte(',') + } + out.String(string(v20)) + } + out.RawByte(']') + } + } + if len(in.BlockedAdvertisers) != 0 { + const prefix string = ",\"badv\":" + out.RawString(prefix) + { + out.RawByte('[') + for v21, v22 := range in.BlockedAdvertisers { + if v21 > 0 { + out.RawByte(',') + } + out.String(string(v22)) + } + out.RawByte(']') + } + } + if len(in.BlockedAdvertisersByMarketID) != 0 { + const prefix string = ",\"bapp\":" + out.RawString(prefix) + { + out.RawByte('[') + for v23, v24 := range in.BlockedAdvertisersByMarketID { + if v23 > 0 { + out.RawByte(',') + } + out.String(string(v24)) + } + out.RawByte(']') + } + } + if in.Source != nil { + const prefix string = ",\"source\":" + out.RawString(prefix) + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb5(out, *in.Source) + } + if in.Regulation != nil { + const prefix string = ",\"regs\":" + out.RawString(prefix) + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb6(out, *in.Regulation) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v BidRequest) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v BidRequest) MarshalEasyJSON(w *jwriter.Writer) { + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *BidRequest) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *BidRequest) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb(l, v) +} +func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb6(in *jlexer.Lexer, out *Regulation) { + 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 "coppa": + if in.IsNull() { + in.Skip() + out.IsCoppaCompliant = nil + } else { + if out.IsCoppaCompliant == nil { + out.IsCoppaCompliant = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.IsCoppaCompliant).UnmarshalJSON(data)) + } + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb6(out *jwriter.Writer, in Regulation) { + out.RawByte('{') + first := true + _ = first + if in.IsCoppaCompliant != nil { + const prefix string = ",\"coppa\":" + first = false + out.RawString(prefix[1:]) + out.Raw((*in.IsCoppaCompliant).MarshalJSON()) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb5(in *jlexer.Lexer, out *Source) { + 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 "fd": + out.FD = int8(in.Int8()) + case "tid": + out.TID = string(in.String()) + case "pchain": + out.PChain = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb5(out *jwriter.Writer, in Source) { + out.RawByte('{') + first := true + _ = first + if in.FD != 0 { + const prefix string = ",\"fd\":" + first = false + out.RawString(prefix[1:]) + out.Int8(int8(in.FD)) + } + if in.TID != "" { + const prefix string = ",\"tid\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.TID)) + } + if in.PChain != "" { + const prefix string = ",\"pchain\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.PChain)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb4(in *jlexer.Lexer, out *User) { + 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 "id": + out.ID = string(in.String()) + case "buyeruid": + out.BuyerID = string(in.String()) + case "yob": + out.BirthYear = int(in.Int()) + case "gender": + out.Gender = Gender(in.String()) + case "keywords": + out.Keywords = string(in.String()) + case "customdata": + out.CustomData = string(in.String()) + case "geo": + if in.IsNull() { + in.Skip() + out.Geo = nil + } else { + if out.Geo == nil { + out.Geo = new(Geo) + } + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb7(in, out.Geo) + } + case "data": + if in.IsNull() { + in.Skip() + out.Data = nil + } else { + in.Delim('[') + if out.Data == nil { + if !in.IsDelim(']') { + out.Data = make([]Data, 0, 0) + } else { + out.Data = []Data{} + } + } else { + out.Data = (out.Data)[:0] + } + for !in.IsDelim(']') { + var v25 Data + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb8(in, &v25) + out.Data = append(out.Data, v25) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb4(out *jwriter.Writer, in User) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.BuyerID != "" { + const prefix string = ",\"buyeruid\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.BuyerID)) + } + if in.BirthYear != 0 { + const prefix string = ",\"yob\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.BirthYear)) + } + if in.Gender != "" { + const prefix string = ",\"gender\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Gender)) + } + if in.Keywords != "" { + const prefix string = ",\"keywords\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Keywords)) + } + if in.CustomData != "" { + const prefix string = ",\"customdata\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.CustomData)) + } + if in.Geo != nil { + const prefix string = ",\"geo\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb7(out, *in.Geo) + } + if len(in.Data) != 0 { + const prefix string = ",\"data\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v26, v27 := range in.Data { + if v26 > 0 { + out.RawByte(',') + } + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb8(out, v27) + } + out.RawByte(']') + } + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb8(in *jlexer.Lexer, out *Data) { + 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 "id": + out.ID = string(in.String()) + case "name": + out.Name = string(in.String()) + case "segment": + if in.IsNull() { + in.Skip() + out.Segment = nil + } else { + in.Delim('[') + if out.Segment == nil { + if !in.IsDelim(']') { + out.Segment = make([]*Segment, 0, 8) + } else { + out.Segment = []*Segment{} + } + } else { + out.Segment = (out.Segment)[:0] + } + for !in.IsDelim(']') { + var v28 *Segment + if in.IsNull() { + in.Skip() + v28 = nil + } else { + if v28 == nil { + v28 = new(Segment) + } + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb9(in, v28) + } + out.Segment = append(out.Segment, v28) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb8(out *jwriter.Writer, in Data) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Name != "" { + const prefix string = ",\"name\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Name)) + } + if len(in.Segment) != 0 { + const prefix string = ",\"segment\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v29, v30 := range in.Segment { + if v29 > 0 { + out.RawByte(',') + } + if v30 == nil { + out.RawString("null") + } else { + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb9(out, *v30) + } + } + out.RawByte(']') + } + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb9(in *jlexer.Lexer, out *Segment) { + 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 "id": + out.ID = string(in.String()) + case "name": + out.Name = string(in.String()) + case "value": + out.Value = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb9(out *jwriter.Writer, in Segment) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Name != "" { + const prefix string = ",\"name\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Name)) + } + if in.Value != "" { + const prefix string = ",\"value\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Value)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb7(in *jlexer.Lexer, out *Geo) { + 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.Latitude = float64(in.Float64()) + case "lon": + out.Longitude = float64(in.Float64()) + case "type": + out.Type = LocationType(in.Int()) + case "accuracy": + out.Accuracy = int(in.Int()) + case "lastfix": + out.LastFix = int(in.Int()) + case "ipservice": + out.IPService = IPLocationService(in.Int()) + case "country": + out.Country = string(in.String()) + case "region": + out.Region = string(in.String()) + case "regionfips104": + out.RegionFIPS104 = string(in.String()) + case "metro": + out.Metro = string(in.String()) + case "city": + out.City = string(in.String()) + case "zip": + out.ZipCode = string(in.String()) + case "utcoffset": + out.UTCOffset = int(in.Int()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb7(out *jwriter.Writer, in Geo) { + out.RawByte('{') + first := true + _ = first + if in.Latitude != 0 { + const prefix string = ",\"lat\":" + first = false + out.RawString(prefix[1:]) + out.Float64(float64(in.Latitude)) + } + if in.Longitude != 0 { + const prefix string = ",\"lon\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Float64(float64(in.Longitude)) + } + if in.Type != 0 { + const prefix string = ",\"type\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Type)) + } + if in.Accuracy != 0 { + const prefix string = ",\"accuracy\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Accuracy)) + } + if in.LastFix != 0 { + const prefix string = ",\"lastfix\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.LastFix)) + } + if in.IPService != 0 { + const prefix string = ",\"ipservice\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.IPService)) + } + if in.Country != "" { + const prefix string = ",\"country\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Country)) + } + if in.Region != "" { + const prefix string = ",\"region\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Region)) + } + if in.RegionFIPS104 != "" { + const prefix string = ",\"regionfips104\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.RegionFIPS104)) + } + if in.Metro != "" { + const prefix string = ",\"metro\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Metro)) + } + if in.City != "" { + const prefix string = ",\"city\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.City)) + } + if in.ZipCode != "" { + const prefix string = ",\"zip\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.ZipCode)) + } + if in.UTCOffset != 0 { + const prefix string = ",\"utcoffset\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.UTCOffset)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb3(in *jlexer.Lexer, out *Device) { + 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 "ua": + out.BrowserUserAgent = string(in.String()) + case "geo": + if in.IsNull() { + in.Skip() + out.Geo = nil + } else { + if out.Geo == nil { + out.Geo = new(Geo) + } + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb7(in, out.Geo) + } + case "dnt": + if in.IsNull() { + in.Skip() + out.HasDoNotTrack = nil + } else { + if out.HasDoNotTrack == nil { + out.HasDoNotTrack = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.HasDoNotTrack).UnmarshalJSON(data)) + } + } + case "lmt": + if in.IsNull() { + in.Skip() + out.HasLimitedAdTracking = nil + } else { + if out.HasLimitedAdTracking == nil { + out.HasLimitedAdTracking = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.HasLimitedAdTracking).UnmarshalJSON(data)) + } + } + case "ip": + out.IP = string(in.String()) + case "ipv6": + out.IPv6 = string(in.String()) + case "devicetype": + out.Type = DeviceType(in.Int()) + case "make": + out.Make = string(in.String()) + case "model": + out.Model = string(in.String()) + case "os": + if data := in.Raw(); in.Ok() { + in.AddError((out.OS).UnmarshalJSON(data)) + } + case "osv": + out.OSVersion = OSVersion(in.String()) + case "hwv": + out.HardwareVersion = string(in.String()) + case "h": + out.Height = int(in.Int()) + case "w": + out.Width = int(in.Int()) + case "ppi": + out.PPI = int(in.Int()) + case "pxratio": + out.PixelRatio = float64(in.Float64()) + case "js": + if in.IsNull() { + in.Skip() + out.SupportsJavaScript = nil + } else { + if out.SupportsJavaScript == nil { + out.SupportsJavaScript = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.SupportsJavaScript).UnmarshalJSON(data)) + } + } + case "geofetch": + if in.IsNull() { + in.Skip() + out.GeoFetch = nil + } else { + if out.GeoFetch == nil { + out.GeoFetch = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.GeoFetch).UnmarshalJSON(data)) + } + } + case "flashver": + out.FlashVersion = string(in.String()) + case "language": + out.Language = string(in.String()) + case "carrier": + out.Carrier = string(in.String()) + case "mccmnc": + out.MCCMNC = string(in.String()) + case "connectiontype": + out.ConnectionType = ConnectionType(in.Int()) + case "ifa": + out.IFA = string(in.String()) + case "didsha1": + out.HardwareIDSHA1 = string(in.String()) + case "didmd5": + out.HardwareIDMD5 = string(in.String()) + case "dpidsha1": + out.PlatformIDSHA1 = string(in.String()) + case "dpidmd5": + out.PlatformIDMD5 = string(in.String()) + case "macsha1": + out.MACSHA1 = string(in.String()) + case "macmd5": + out.MACMD5 = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb3(out *jwriter.Writer, in Device) { + out.RawByte('{') + first := true + _ = first + if in.BrowserUserAgent != "" { + const prefix string = ",\"ua\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.BrowserUserAgent)) + } + if in.Geo != nil { + const prefix string = ",\"geo\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb7(out, *in.Geo) + } + if in.HasDoNotTrack != nil { + const prefix string = ",\"dnt\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.HasDoNotTrack).MarshalJSON()) + } + if in.HasLimitedAdTracking != nil { + const prefix string = ",\"lmt\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.HasLimitedAdTracking).MarshalJSON()) + } + if in.IP != "" { + const prefix string = ",\"ip\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.IP)) + } + if in.IPv6 != "" { + const prefix string = ",\"ipv6\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.IPv6)) + } + if in.Type != 0 { + const prefix string = ",\"devicetype\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Type)) + } + if in.Make != "" { + const prefix string = ",\"make\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Make)) + } + if in.Model != "" { + const prefix string = ",\"model\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Model)) + } + if in.OS != "" { + const prefix string = ",\"os\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.OS)) + } + if in.OSVersion != "" { + const prefix string = ",\"osv\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.OSVersion)) + } + if in.HardwareVersion != "" { + const prefix string = ",\"hwv\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.HardwareVersion)) + } + if in.Height != 0 { + const prefix string = ",\"h\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Height)) + } + if in.Width != 0 { + const prefix string = ",\"w\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Width)) + } + if in.PPI != 0 { + const prefix string = ",\"ppi\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.PPI)) + } + if in.PixelRatio != 0 { + const prefix string = ",\"pxratio\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Float64(float64(in.PixelRatio)) + } + if in.SupportsJavaScript != nil { + const prefix string = ",\"js\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.SupportsJavaScript).MarshalJSON()) + } + if in.GeoFetch != nil { + const prefix string = ",\"geofetch\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.GeoFetch).MarshalJSON()) + } + if in.FlashVersion != "" { + const prefix string = ",\"flashver\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.FlashVersion)) + } + if in.Language != "" { + const prefix string = ",\"language\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Language)) + } + if in.Carrier != "" { + const prefix string = ",\"carrier\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Carrier)) + } + if in.MCCMNC != "" { + const prefix string = ",\"mccmnc\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.MCCMNC)) + } + if in.ConnectionType != 0 { + const prefix string = ",\"connectiontype\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.ConnectionType)) + } + if in.IFA != "" { + const prefix string = ",\"ifa\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.IFA)) + } + if in.HardwareIDSHA1 != "" { + const prefix string = ",\"didsha1\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.HardwareIDSHA1)) + } + if in.HardwareIDMD5 != "" { + const prefix string = ",\"didmd5\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.HardwareIDMD5)) + } + if in.PlatformIDSHA1 != "" { + const prefix string = ",\"dpidsha1\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.PlatformIDSHA1)) + } + if in.PlatformIDMD5 != "" { + const prefix string = ",\"dpidmd5\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.PlatformIDMD5)) + } + if in.MACSHA1 != "" { + const prefix string = ",\"macsha1\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.MACSHA1)) + } + if in.MACMD5 != "" { + const prefix string = ",\"macmd5\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.MACMD5)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb2(in *jlexer.Lexer, out *Site) { + 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 "id": + out.ID = string(in.String()) + case "name": + out.Name = string(in.String()) + case "domain": + out.Domain = string(in.String()) + case "cat": + if in.IsNull() { + in.Skip() + out.Cat = nil + } else { + in.Delim('[') + if out.Cat == nil { + if !in.IsDelim(']') { + out.Cat = make([]string, 0, 4) + } else { + out.Cat = []string{} + } + } else { + out.Cat = (out.Cat)[:0] + } + for !in.IsDelim(']') { + var v31 string + v31 = string(in.String()) + out.Cat = append(out.Cat, v31) + in.WantComma() + } + in.Delim(']') + } + case "sectioncat": + if in.IsNull() { + in.Skip() + out.SectionCat = nil + } else { + in.Delim('[') + if out.SectionCat == nil { + if !in.IsDelim(']') { + out.SectionCat = make([]string, 0, 4) + } else { + out.SectionCat = []string{} + } + } else { + out.SectionCat = (out.SectionCat)[:0] + } + for !in.IsDelim(']') { + var v32 string + v32 = string(in.String()) + out.SectionCat = append(out.SectionCat, v32) + in.WantComma() + } + in.Delim(']') + } + case "pagecat": + if in.IsNull() { + in.Skip() + out.PageCat = nil + } else { + in.Delim('[') + if out.PageCat == nil { + if !in.IsDelim(']') { + out.PageCat = make([]string, 0, 4) + } else { + out.PageCat = []string{} + } + } else { + out.PageCat = (out.PageCat)[:0] + } + for !in.IsDelim(']') { + var v33 string + v33 = string(in.String()) + out.PageCat = append(out.PageCat, v33) + in.WantComma() + } + in.Delim(']') + } + case "page": + out.Page = string(in.String()) + case "ref": + out.Ref = string(in.String()) + case "search": + out.Search = string(in.String()) + case "mobile": + if in.IsNull() { + in.Skip() + out.Mobile = nil + } else { + if out.Mobile == nil { + out.Mobile = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.Mobile).UnmarshalJSON(data)) + } + } + case "privacypolicy": + if in.IsNull() { + in.Skip() + out.PrivacyPolicy = nil + } else { + if out.PrivacyPolicy == nil { + out.PrivacyPolicy = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.PrivacyPolicy).UnmarshalJSON(data)) + } + } + case "publisher": + if in.IsNull() { + in.Skip() + out.Publisher = nil + } else { + if out.Publisher == nil { + out.Publisher = new(Publisher) + } + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb10(in, out.Publisher) + } + case "content": + if in.IsNull() { + in.Skip() + out.Content = nil + } else { + if out.Content == nil { + out.Content = new(Content) + } + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb11(in, out.Content) + } + case "keywords": + out.Keywords = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb2(out *jwriter.Writer, in Site) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Name != "" { + const prefix string = ",\"name\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Name)) + } + if in.Domain != "" { + const prefix string = ",\"domain\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Domain)) + } + if len(in.Cat) != 0 { + const prefix string = ",\"cat\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v34, v35 := range in.Cat { + if v34 > 0 { + out.RawByte(',') + } + out.String(string(v35)) + } + out.RawByte(']') + } + } + if len(in.SectionCat) != 0 { + const prefix string = ",\"sectioncat\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v36, v37 := range in.SectionCat { + if v36 > 0 { + out.RawByte(',') + } + out.String(string(v37)) + } + out.RawByte(']') + } + } + if len(in.PageCat) != 0 { + const prefix string = ",\"pagecat\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v38, v39 := range in.PageCat { + if v38 > 0 { + out.RawByte(',') + } + out.String(string(v39)) + } + out.RawByte(']') + } + } + if in.Page != "" { + const prefix string = ",\"page\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Page)) + } + if in.Ref != "" { + const prefix string = ",\"ref\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Ref)) + } + if in.Search != "" { + const prefix string = ",\"search\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Search)) + } + if in.Mobile != nil { + const prefix string = ",\"mobile\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.Mobile).MarshalJSON()) + } + if in.PrivacyPolicy != nil { + const prefix string = ",\"privacypolicy\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.PrivacyPolicy).MarshalJSON()) + } + if in.Publisher != nil { + const prefix string = ",\"publisher\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb10(out, *in.Publisher) + } + if in.Content != nil { + const prefix string = ",\"content\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb11(out, *in.Content) + } + if in.Keywords != "" { + const prefix string = ",\"keywords\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Keywords)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb11(in *jlexer.Lexer, out *Content) { + 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 "id": + out.ID = string(in.String()) + case "episode": + if in.IsNull() { + in.Skip() + out.Episode = nil + } else { + if out.Episode == nil { + out.Episode = new(int) + } + *out.Episode = int(in.Int()) + } + case "title": + out.Title = string(in.String()) + case "series": + out.Series = string(in.String()) + case "season": + out.Season = string(in.String()) + case "artist": + out.Artist = string(in.String()) + case "genre": + out.Genre = string(in.String()) + case "album": + out.Album = string(in.String()) + case "isrc": + out.ISRC = string(in.String()) + case "producer": + if in.IsNull() { + in.Skip() + out.Producer = nil + } else { + if out.Producer == nil { + out.Producer = new(Producer) + } + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb12(in, out.Producer) + } + case "url": + out.URL = string(in.String()) + case "cat": + if in.IsNull() { + in.Skip() + out.Cat = nil + } else { + in.Delim('[') + if out.Cat == nil { + if !in.IsDelim(']') { + out.Cat = make([]string, 0, 4) + } else { + out.Cat = []string{} + } + } else { + out.Cat = (out.Cat)[:0] + } + for !in.IsDelim(']') { + var v40 string + v40 = string(in.String()) + out.Cat = append(out.Cat, v40) + in.WantComma() + } + in.Delim(']') + } + case "prodq": + out.ProdQ = ProductionQuality(in.Int()) + case "videoquality": + out.VideoQuality = ProductionQuality(in.Int()) + case "context": + out.Context = ContentContext(in.Int()) + case "contentrating": + out.ContentRating = string(in.String()) + case "userrating": + out.UserRating = string(in.String()) + case "qagmediarating": + out.QAGMediaRating = IQGMediaRating(in.Int()) + case "keywords": + out.Keywords = string(in.String()) + case "livestream": + if in.IsNull() { + in.Skip() + out.LiveStream = nil + } else { + if out.LiveStream == nil { + out.LiveStream = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.LiveStream).UnmarshalJSON(data)) + } + } + case "sourcerelationship": + if in.IsNull() { + in.Skip() + out.SourceRelationship = nil + } else { + if out.SourceRelationship == nil { + out.SourceRelationship = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.SourceRelationship).UnmarshalJSON(data)) + } + } + case "len": + if in.IsNull() { + in.Skip() + out.Len = nil + } else { + if out.Len == nil { + out.Len = new(int) + } + *out.Len = int(in.Int()) + } + case "language": + out.Language = string(in.String()) + case "embeddable": + if in.IsNull() { + in.Skip() + out.Embeddable = nil + } else { + if out.Embeddable == nil { + out.Embeddable = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.Embeddable).UnmarshalJSON(data)) + } + } + case "data": + if in.IsNull() { + in.Skip() + out.Data = nil + } else { + in.Delim('[') + if out.Data == nil { + if !in.IsDelim(']') { + out.Data = make([]*Data, 0, 8) + } else { + out.Data = []*Data{} + } + } else { + out.Data = (out.Data)[:0] + } + for !in.IsDelim(']') { + var v41 *Data + if in.IsNull() { + in.Skip() + v41 = nil + } else { + if v41 == nil { + v41 = new(Data) + } + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb8(in, v41) + } + out.Data = append(out.Data, v41) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb11(out *jwriter.Writer, in Content) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Episode != nil { + const prefix string = ",\"episode\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(*in.Episode)) + } + if in.Title != "" { + const prefix string = ",\"title\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Title)) + } + if in.Series != "" { + const prefix string = ",\"series\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Series)) + } + if in.Season != "" { + const prefix string = ",\"season\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Season)) + } + if in.Artist != "" { + const prefix string = ",\"artist\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Artist)) + } + if in.Genre != "" { + const prefix string = ",\"genre\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Genre)) + } + if in.Album != "" { + const prefix string = ",\"album\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Album)) + } + if in.ISRC != "" { + const prefix string = ",\"isrc\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.ISRC)) + } + if in.Producer != nil { + const prefix string = ",\"producer\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb12(out, *in.Producer) + } + if in.URL != "" { + const prefix string = ",\"url\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.URL)) + } + if len(in.Cat) != 0 { + const prefix string = ",\"cat\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v42, v43 := range in.Cat { + if v42 > 0 { + out.RawByte(',') + } + out.String(string(v43)) + } + out.RawByte(']') + } + } + if in.ProdQ != 0 { + const prefix string = ",\"prodq\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.ProdQ)) + } + if in.VideoQuality != 0 { + const prefix string = ",\"videoquality\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.VideoQuality)) + } + if in.Context != 0 { + const prefix string = ",\"context\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Context)) + } + if in.ContentRating != "" { + const prefix string = ",\"contentrating\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.ContentRating)) + } + if in.UserRating != "" { + const prefix string = ",\"userrating\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.UserRating)) + } + if in.QAGMediaRating != 0 { + const prefix string = ",\"qagmediarating\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.QAGMediaRating)) + } + if in.Keywords != "" { + const prefix string = ",\"keywords\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Keywords)) + } + if in.LiveStream != nil { + const prefix string = ",\"livestream\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.LiveStream).MarshalJSON()) + } + if in.SourceRelationship != nil { + const prefix string = ",\"sourcerelationship\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.SourceRelationship).MarshalJSON()) + } + if in.Len != nil { + const prefix string = ",\"len\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(*in.Len)) + } + if in.Language != "" { + const prefix string = ",\"language\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Language)) + } + if in.Embeddable != nil { + const prefix string = ",\"embeddable\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.Embeddable).MarshalJSON()) + } + if len(in.Data) != 0 { + const prefix string = ",\"data\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v44, v45 := range in.Data { + if v44 > 0 { + out.RawByte(',') + } + if v45 == nil { + out.RawString("null") + } else { + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb8(out, *v45) + } + } + out.RawByte(']') + } + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb12(in *jlexer.Lexer, out *Producer) { + 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 "id": + out.ID = string(in.String()) + case "name": + out.Name = string(in.String()) + case "cat": + if in.IsNull() { + in.Skip() + out.Cat = nil + } else { + in.Delim('[') + if out.Cat == nil { + if !in.IsDelim(']') { + out.Cat = make([]string, 0, 4) + } else { + out.Cat = []string{} + } + } else { + out.Cat = (out.Cat)[:0] + } + for !in.IsDelim(']') { + var v46 string + v46 = string(in.String()) + out.Cat = append(out.Cat, v46) + in.WantComma() + } + in.Delim(']') + } + case "domain": + out.Domain = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb12(out *jwriter.Writer, in Producer) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Name != "" { + const prefix string = ",\"name\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Name)) + } + if len(in.Cat) != 0 { + const prefix string = ",\"cat\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v47, v48 := range in.Cat { + if v47 > 0 { + out.RawByte(',') + } + out.String(string(v48)) + } + out.RawByte(']') + } + } + if in.Domain != "" { + const prefix string = ",\"domain\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Domain)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb10(in *jlexer.Lexer, out *Publisher) { + 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 "id": + out.ID = string(in.String()) + case "name": + out.Name = string(in.String()) + case "cat": + if in.IsNull() { + in.Skip() + out.Categories = nil + } else { + in.Delim('[') + if out.Categories == nil { + if !in.IsDelim(']') { + out.Categories = make([]Category, 0, 4) + } else { + out.Categories = []Category{} + } + } else { + out.Categories = (out.Categories)[:0] + } + for !in.IsDelim(']') { + var v49 Category + v49 = Category(in.String()) + out.Categories = append(out.Categories, v49) + in.WantComma() + } + in.Delim(']') + } + case "domain": + out.Domain = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb10(out *jwriter.Writer, in Publisher) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"id\":" + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Name != "" { + const prefix string = ",\"name\":" + out.RawString(prefix) + out.String(string(in.Name)) + } + if len(in.Categories) != 0 { + const prefix string = ",\"cat\":" + out.RawString(prefix) + { + out.RawByte('[') + for v50, v51 := range in.Categories { + if v50 > 0 { + out.RawByte(',') + } + out.String(string(v51)) + } + out.RawByte(']') + } + } + if in.Domain != "" { + const prefix string = ",\"domain\":" + out.RawString(prefix) + out.String(string(in.Domain)) + } + out.RawByte('}') +} +func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *Impression) { + 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 "id": + out.ID = string(in.String()) + case "metric": + if in.IsNull() { + in.Skip() + out.Metrics = nil + } else { + in.Delim('[') + if out.Metrics == nil { + if !in.IsDelim(']') { + out.Metrics = make([]*Metric, 0, 8) + } else { + out.Metrics = []*Metric{} + } + } else { + out.Metrics = (out.Metrics)[:0] + } + for !in.IsDelim(']') { + var v52 *Metric + if in.IsNull() { + in.Skip() + v52 = nil + } else { + if v52 == nil { + v52 = new(Metric) + } + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb13(in, v52) + } + out.Metrics = append(out.Metrics, v52) + in.WantComma() + } + in.Delim(']') + } + case "banner": + if in.IsNull() { + in.Skip() + out.Banner = nil + } else { + if out.Banner == nil { + out.Banner = new(Banner) + } + (*out.Banner).UnmarshalEasyJSON(in) + } + case "video": + if in.IsNull() { + in.Skip() + out.Video = nil + } else { + if out.Video == nil { + out.Video = new(Video) + } + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb14(in, out.Video) + } + case "audio": + if in.IsNull() { + in.Skip() + out.Audio = nil + } else { + if out.Audio == nil { + out.Audio = new(Audio) + } + (*out.Audio).UnmarshalEasyJSON(in) + } + case "native": + if in.IsNull() { + in.Skip() + out.Native = nil + } else { + if out.Native == nil { + out.Native = new(Native) + } + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb15(in, out.Native) + } + case "pmp": + if in.IsNull() { + in.Skip() + out.PrivateMarketplace = nil + } else { + if out.PrivateMarketplace == nil { + out.PrivateMarketplace = new(PrivateMarketplace) + } + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb16(in, out.PrivateMarketplace) + } + case "displaymanager": + out.DisplayManager = string(in.String()) + case "displaymanagerver": + out.DisplayManagerVersion = string(in.String()) + case "instl": + if data := in.Raw(); in.Ok() { + in.AddError((out.IsInterstitial).UnmarshalJSON(data)) + } + case "tagid": + out.TagID = string(in.String()) + case "bidfloor": + out.BidFloorPrice = float64(in.Float64()) + case "bidfloorcur": + out.BidFloorCurrency = Currency(in.String()) + case "clickbrowser": + if in.IsNull() { + in.Skip() + out.BrowserTypeUponClick = nil + } else { + if out.BrowserTypeUponClick == nil { + out.BrowserTypeUponClick = new(BrowserType) + } + *out.BrowserTypeUponClick = BrowserType(in.Int()) + } + case "secure": + if data := in.Raw(); in.Ok() { + in.AddError((out.IsSecure).UnmarshalJSON(data)) + } + case "iframebuster": + if in.IsNull() { + in.Skip() + out.IframeBuster = nil + } else { + in.Delim('[') + if out.IframeBuster == nil { + if !in.IsDelim(']') { + out.IframeBuster = make([]string, 0, 4) + } else { + out.IframeBuster = []string{} + } + } else { + out.IframeBuster = (out.IframeBuster)[:0] + } + for !in.IsDelim(']') { + var v53 string + v53 = string(in.String()) + out.IframeBuster = append(out.IframeBuster, v53) + in.WantComma() + } + in.Delim(']') + } + case "exp": + out.Exp = int(in.Int()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in Impression) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"id\":" + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if len(in.Metrics) != 0 { + const prefix string = ",\"metric\":" + out.RawString(prefix) + { + out.RawByte('[') + for v54, v55 := range in.Metrics { + if v54 > 0 { + out.RawByte(',') + } + if v55 == nil { + out.RawString("null") + } else { + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb13(out, *v55) + } + } + out.RawByte(']') + } + } + if in.Banner != nil { + const prefix string = ",\"banner\":" + out.RawString(prefix) + (*in.Banner).MarshalEasyJSON(out) + } + if in.Video != nil { + const prefix string = ",\"video\":" + out.RawString(prefix) + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb14(out, *in.Video) + } + if in.Audio != nil { + const prefix string = ",\"audio\":" + out.RawString(prefix) + (*in.Audio).MarshalEasyJSON(out) + } + if in.Native != nil { + const prefix string = ",\"native\":" + out.RawString(prefix) + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb15(out, *in.Native) + } + if in.PrivateMarketplace != nil { + const prefix string = ",\"pmp\":" + out.RawString(prefix) + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb16(out, *in.PrivateMarketplace) + } + if in.DisplayManager != "" { + const prefix string = ",\"displaymanager\":" + out.RawString(prefix) + out.String(string(in.DisplayManager)) + } + if in.DisplayManagerVersion != "" { + const prefix string = ",\"displaymanagerver\":" + out.RawString(prefix) + out.String(string(in.DisplayManagerVersion)) + } + if in.IsInterstitial { + const prefix string = ",\"instl\":" + out.RawString(prefix) + out.Raw((in.IsInterstitial).MarshalJSON()) + } + if in.TagID != "" { + const prefix string = ",\"tagid\":" + out.RawString(prefix) + out.String(string(in.TagID)) + } + { + const prefix string = ",\"bidfloor\":" + out.RawString(prefix) + out.Float64(float64(in.BidFloorPrice)) + } + if in.BidFloorCurrency != "" { + const prefix string = ",\"bidfloorcur\":" + out.RawString(prefix) + out.String(string(in.BidFloorCurrency)) + } + if in.BrowserTypeUponClick != nil { + const prefix string = ",\"clickbrowser\":" + out.RawString(prefix) + out.Int(int(*in.BrowserTypeUponClick)) + } + if in.IsSecure { + const prefix string = ",\"secure\":" + out.RawString(prefix) + out.Raw((in.IsSecure).MarshalJSON()) + } + if len(in.IframeBuster) != 0 { + const prefix string = ",\"iframebuster\":" + out.RawString(prefix) + { + out.RawByte('[') + for v56, v57 := range in.IframeBuster { + if v56 > 0 { + out.RawByte(',') + } + out.String(string(v57)) + } + out.RawByte(']') + } + } + if in.Exp != 0 { + const prefix string = ",\"exp\":" + out.RawString(prefix) + out.Int(int(in.Exp)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb16(in *jlexer.Lexer, out *PrivateMarketplace) { + 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 "private_auction": + if data := in.Raw(); in.Ok() { + in.AddError((out.IsPrivateAuction).UnmarshalJSON(data)) + } + case "deals": + if in.IsNull() { + in.Skip() + out.Deals = nil + } else { + in.Delim('[') + if out.Deals == nil { + if !in.IsDelim(']') { + out.Deals = make([]*Deal, 0, 8) + } else { + out.Deals = []*Deal{} + } + } else { + out.Deals = (out.Deals)[:0] + } + for !in.IsDelim(']') { + var v58 *Deal + if in.IsNull() { + in.Skip() + v58 = nil + } else { + if v58 == nil { + v58 = new(Deal) + } + easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb17(in, v58) + } + out.Deals = append(out.Deals, v58) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb16(out *jwriter.Writer, in PrivateMarketplace) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"private_auction\":" + out.RawString(prefix[1:]) + out.Raw((in.IsPrivateAuction).MarshalJSON()) + } + { + const prefix string = ",\"deals\":" + out.RawString(prefix) + if in.Deals == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v59, v60 := range in.Deals { + if v59 > 0 { + out.RawByte(',') + } + if v60 == nil { + out.RawString("null") + } else { + easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb17(out, *v60) + } + } + out.RawByte(']') + } + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb17(in *jlexer.Lexer, out *Deal) { + 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 "id": + out.ID = string(in.String()) + case "bidfloor": + out.BidFloorPrice = float64(in.Float64()) + case "bidfloorcur": + out.BidFloorCurrency = Currency(in.String()) + case "at": + out.AuctionType = DealAuctionType(in.Int()) + case "wseat": + if in.IsNull() { + in.Skip() + out.WhitelistedSeats = nil + } else { + in.Delim('[') + if out.WhitelistedSeats == nil { + if !in.IsDelim(']') { + out.WhitelistedSeats = make([]string, 0, 4) + } else { + out.WhitelistedSeats = []string{} + } + } else { + out.WhitelistedSeats = (out.WhitelistedSeats)[:0] + } + for !in.IsDelim(']') { + var v61 string + v61 = string(in.String()) + out.WhitelistedSeats = append(out.WhitelistedSeats, v61) + in.WantComma() + } + in.Delim(']') + } + case "wadomain": + if in.IsNull() { + in.Skip() + out.AdvertiserDomains = nil + } else { + in.Delim('[') + if out.AdvertiserDomains == nil { + if !in.IsDelim(']') { + out.AdvertiserDomains = make([]string, 0, 4) + } else { + out.AdvertiserDomains = []string{} + } + } else { + out.AdvertiserDomains = (out.AdvertiserDomains)[:0] + } + for !in.IsDelim(']') { + var v62 string + v62 = string(in.String()) + out.AdvertiserDomains = append(out.AdvertiserDomains, v62) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb17(out *jwriter.Writer, in Deal) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"id\":" + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + { + const prefix string = ",\"bidfloor\":" + out.RawString(prefix) + out.Float64(float64(in.BidFloorPrice)) + } + if in.BidFloorCurrency != "" { + const prefix string = ",\"bidfloorcur\":" + out.RawString(prefix) + out.String(string(in.BidFloorCurrency)) + } + if in.AuctionType != 0 { + const prefix string = ",\"at\":" + out.RawString(prefix) + out.Int(int(in.AuctionType)) + } + if len(in.WhitelistedSeats) != 0 { + const prefix string = ",\"wseat\":" + out.RawString(prefix) + { + out.RawByte('[') + for v63, v64 := range in.WhitelistedSeats { + if v63 > 0 { + out.RawByte(',') + } + out.String(string(v64)) + } + out.RawByte(']') + } + } + if len(in.AdvertiserDomains) != 0 { + const prefix string = ",\"wadomain\":" + out.RawString(prefix) + { + out.RawByte('[') + for v65, v66 := range in.AdvertiserDomains { + if v65 > 0 { + out.RawByte(',') + } + out.String(string(v66)) + } + out.RawByte(']') + } + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb15(in *jlexer.Lexer, out *Native) { + 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 "request": + out.Request = string(in.String()) + case "ver": + out.Version = string(in.String()) + case "api": + if in.IsNull() { + in.Skip() + out.APIFrameworks = nil + } else { + in.Delim('[') + if out.APIFrameworks == nil { + if !in.IsDelim(']') { + out.APIFrameworks = make([]APIFramework, 0, 8) + } else { + out.APIFrameworks = []APIFramework{} + } + } else { + out.APIFrameworks = (out.APIFrameworks)[:0] + } + for !in.IsDelim(']') { + var v67 APIFramework + v67 = APIFramework(in.Int()) + out.APIFrameworks = append(out.APIFrameworks, v67) + in.WantComma() + } + in.Delim(']') + } + case "battr": + if in.IsNull() { + in.Skip() + out.BlockedCreativeAttributes = nil + } else { + in.Delim('[') + if out.BlockedCreativeAttributes == nil { + if !in.IsDelim(']') { + out.BlockedCreativeAttributes = make([]CreativeAttribute, 0, 8) + } else { + out.BlockedCreativeAttributes = []CreativeAttribute{} + } + } else { + out.BlockedCreativeAttributes = (out.BlockedCreativeAttributes)[:0] + } + for !in.IsDelim(']') { + var v68 CreativeAttribute + v68 = CreativeAttribute(in.Int()) + out.BlockedCreativeAttributes = append(out.BlockedCreativeAttributes, v68) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb15(out *jwriter.Writer, in Native) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"request\":" + out.RawString(prefix[1:]) + out.String(string(in.Request)) + } + if in.Version != "" { + const prefix string = ",\"ver\":" + out.RawString(prefix) + out.String(string(in.Version)) + } + if len(in.APIFrameworks) != 0 { + const prefix string = ",\"api\":" + out.RawString(prefix) + { + out.RawByte('[') + for v69, v70 := range in.APIFrameworks { + if v69 > 0 { + out.RawByte(',') + } + out.Int(int(v70)) + } + out.RawByte(']') + } + } + if len(in.BlockedCreativeAttributes) != 0 { + const prefix string = ",\"battr\":" + out.RawString(prefix) + { + out.RawByte('[') + for v71, v72 := range in.BlockedCreativeAttributes { + if v71 > 0 { + out.RawByte(',') + } + out.Int(int(v72)) + } + out.RawByte(']') + } + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb14(in *jlexer.Lexer, out *Video) { + 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 "mimes": + if in.IsNull() { + in.Skip() + out.MIMETypes = nil + } else { + in.Delim('[') + if out.MIMETypes == nil { + if !in.IsDelim(']') { + out.MIMETypes = make([]string, 0, 4) + } else { + out.MIMETypes = []string{} + } + } else { + out.MIMETypes = (out.MIMETypes)[:0] + } + for !in.IsDelim(']') { + var v73 string + v73 = string(in.String()) + out.MIMETypes = append(out.MIMETypes, v73) + in.WantComma() + } + in.Delim(']') + } + case "minduration": + if in.IsNull() { + in.Skip() + out.MinDuration = nil + } else { + if out.MinDuration == nil { + out.MinDuration = new(int) + } + *out.MinDuration = int(in.Int()) + } + case "maxduration": + if in.IsNull() { + in.Skip() + out.MaxDuration = nil + } else { + if out.MaxDuration == nil { + out.MaxDuration = new(int) + } + *out.MaxDuration = int(in.Int()) + } + case "protocols": + if in.IsNull() { + in.Skip() + out.Protocols = nil + } else { + in.Delim('[') + if out.Protocols == nil { + if !in.IsDelim(']') { + out.Protocols = make([]Protocol, 0, 8) + } else { + out.Protocols = []Protocol{} + } + } else { + out.Protocols = (out.Protocols)[:0] + } + for !in.IsDelim(']') { + var v74 Protocol + v74 = Protocol(in.Int()) + out.Protocols = append(out.Protocols, v74) + in.WantComma() + } + in.Delim(']') + } + case "protocol": + out.Protocol = Protocol(in.Int()) + case "w": + out.Width = int(in.Int()) + case "h": + out.Height = int(in.Int()) + case "startdelay": + if in.IsNull() { + in.Skip() + out.StartDelay = nil + } else { + if out.StartDelay == nil { + out.StartDelay = new(StartDelay) + } + *out.StartDelay = StartDelay(in.Int()) + } + case "placement": + out.PlacementType = VideoPlacementType(in.Int()) + case "linearity": + out.Linearity = Linearity(in.Int()) + case "skip": + out.Skippable = int(in.Int()) + case "skipmin": + out.SkipMin = int(in.Int()) + case "skipafter": + out.SkipAfter = int(in.Int()) + case "sequence": + out.Sequence = int(in.Int()) + case "battr": + if in.IsNull() { + in.Skip() + out.BlockedCreativeAttributes = nil + } else { + in.Delim('[') + if out.BlockedCreativeAttributes == nil { + if !in.IsDelim(']') { + out.BlockedCreativeAttributes = make([]CreativeAttribute, 0, 8) + } else { + out.BlockedCreativeAttributes = []CreativeAttribute{} + } + } else { + out.BlockedCreativeAttributes = (out.BlockedCreativeAttributes)[:0] + } + for !in.IsDelim(']') { + var v75 CreativeAttribute + v75 = CreativeAttribute(in.Int()) + out.BlockedCreativeAttributes = append(out.BlockedCreativeAttributes, v75) + in.WantComma() + } + in.Delim(']') + } + case "maxextended": + out.MaxExtendedDuration = int(in.Int()) + case "minbitrate": + out.MinBitRate = int(in.Int()) + case "maxbitrate": + out.MaxBitRate = int(in.Int()) + case "boxingallowed": + if data := in.Raw(); in.Ok() { + in.AddError((out.IsBoxingAllowed).UnmarshalJSON(data)) + } + case "playbackmethod": + if in.IsNull() { + in.Skip() + out.PlaybackMethods = nil + } else { + in.Delim('[') + if out.PlaybackMethods == nil { + if !in.IsDelim(']') { + out.PlaybackMethods = make([]PlaybackMethod, 0, 8) + } else { + out.PlaybackMethods = []PlaybackMethod{} + } + } else { + out.PlaybackMethods = (out.PlaybackMethods)[:0] + } + for !in.IsDelim(']') { + var v76 PlaybackMethod + v76 = PlaybackMethod(in.Int()) + out.PlaybackMethods = append(out.PlaybackMethods, v76) + in.WantComma() + } + in.Delim(']') + } + case "playbackend": + out.PlaybackEndEvent = PlaybackCessationMode(in.Int()) + case "delivery": + if in.IsNull() { + in.Skip() + out.DeliveryMethods = nil + } else { + in.Delim('[') + if out.DeliveryMethods == nil { + if !in.IsDelim(']') { + out.DeliveryMethods = make([]DeliveryMethod, 0, 8) + } else { + out.DeliveryMethods = []DeliveryMethod{} + } + } else { + out.DeliveryMethods = (out.DeliveryMethods)[:0] + } + for !in.IsDelim(']') { + var v77 DeliveryMethod + v77 = DeliveryMethod(in.Int()) + out.DeliveryMethods = append(out.DeliveryMethods, v77) + in.WantComma() + } + in.Delim(']') + } + case "pos": + out.Position = AdPosition(in.Int()) + case "companionad": + if in.IsNull() { + in.Skip() + out.CompanionAds = nil + } else { + in.Delim('[') + if out.CompanionAds == nil { + if !in.IsDelim(']') { + out.CompanionAds = make([]Banner, 0, 0) + } else { + out.CompanionAds = []Banner{} + } + } else { + out.CompanionAds = (out.CompanionAds)[:0] + } + for !in.IsDelim(']') { + var v78 Banner + (v78).UnmarshalEasyJSON(in) + out.CompanionAds = append(out.CompanionAds, v78) + in.WantComma() + } + in.Delim(']') + } + case "api": + if in.IsNull() { + in.Skip() + out.APIFrameworks = nil + } else { + in.Delim('[') + if out.APIFrameworks == nil { + if !in.IsDelim(']') { + out.APIFrameworks = make([]APIFramework, 0, 8) + } else { + out.APIFrameworks = []APIFramework{} + } + } else { + out.APIFrameworks = (out.APIFrameworks)[:0] + } + for !in.IsDelim(']') { + var v79 APIFramework + v79 = APIFramework(in.Int()) + out.APIFrameworks = append(out.APIFrameworks, v79) + in.WantComma() + } + in.Delim(']') + } + case "companiontype": + if in.IsNull() { + in.Skip() + out.CompanionTypes = nil + } else { + in.Delim('[') + if out.CompanionTypes == nil { + if !in.IsDelim(']') { + out.CompanionTypes = make([]CompanionType, 0, 8) + } else { + out.CompanionTypes = []CompanionType{} + } + } else { + out.CompanionTypes = (out.CompanionTypes)[:0] + } + for !in.IsDelim(']') { + var v80 CompanionType + v80 = CompanionType(in.Int()) + out.CompanionTypes = append(out.CompanionTypes, v80) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb14(out *jwriter.Writer, in Video) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"mimes\":" + out.RawString(prefix[1:]) + if in.MIMETypes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v81, v82 := range in.MIMETypes { + if v81 > 0 { + out.RawByte(',') + } + out.String(string(v82)) + } + out.RawByte(']') + } + } + if in.MinDuration != nil { + const prefix string = ",\"minduration\":" + out.RawString(prefix) + out.Int(int(*in.MinDuration)) + } + if in.MaxDuration != nil { + const prefix string = ",\"maxduration\":" + out.RawString(prefix) + out.Int(int(*in.MaxDuration)) + } + if len(in.Protocols) != 0 { + const prefix string = ",\"protocols\":" + out.RawString(prefix) + { + out.RawByte('[') + for v83, v84 := range in.Protocols { + if v83 > 0 { + out.RawByte(',') + } + out.Int(int(v84)) + } + out.RawByte(']') + } + } + if in.Protocol != 0 { + const prefix string = ",\"protocol\":" + out.RawString(prefix) + out.Int(int(in.Protocol)) + } + if in.Width != 0 { + const prefix string = ",\"w\":" + out.RawString(prefix) + out.Int(int(in.Width)) + } + if in.Height != 0 { + const prefix string = ",\"h\":" + out.RawString(prefix) + out.Int(int(in.Height)) + } + if in.StartDelay != nil { + const prefix string = ",\"startdelay\":" + out.RawString(prefix) + out.Int(int(*in.StartDelay)) + } + if in.PlacementType != 0 { + const prefix string = ",\"placement\":" + out.RawString(prefix) + out.Int(int(in.PlacementType)) + } + if in.Linearity != 0 { + const prefix string = ",\"linearity\":" + out.RawString(prefix) + out.Int(int(in.Linearity)) + } + if in.Skippable != 0 { + const prefix string = ",\"skip\":" + out.RawString(prefix) + out.Int(int(in.Skippable)) + } + if in.SkipMin != 0 { + const prefix string = ",\"skipmin\":" + out.RawString(prefix) + out.Int(int(in.SkipMin)) + } + if in.SkipAfter != 0 { + const prefix string = ",\"skipafter\":" + out.RawString(prefix) + out.Int(int(in.SkipAfter)) + } + if in.Sequence != 0 { + const prefix string = ",\"sequence\":" + out.RawString(prefix) + out.Int(int(in.Sequence)) + } + if len(in.BlockedCreativeAttributes) != 0 { + const prefix string = ",\"battr\":" + out.RawString(prefix) + { + out.RawByte('[') + for v85, v86 := range in.BlockedCreativeAttributes { + if v85 > 0 { + out.RawByte(',') + } + out.Int(int(v86)) + } + out.RawByte(']') + } + } + if in.MaxExtendedDuration != 0 { + const prefix string = ",\"maxextended\":" + out.RawString(prefix) + out.Int(int(in.MaxExtendedDuration)) + } + if in.MinBitRate != 0 { + const prefix string = ",\"minbitrate\":" + out.RawString(prefix) + out.Int(int(in.MinBitRate)) + } + if in.MaxBitRate != 0 { + const prefix string = ",\"maxbitrate\":" + out.RawString(prefix) + out.Int(int(in.MaxBitRate)) + } + if in.IsBoxingAllowed { + const prefix string = ",\"boxingallowed\":" + out.RawString(prefix) + out.Raw((in.IsBoxingAllowed).MarshalJSON()) + } + if len(in.PlaybackMethods) != 0 { + const prefix string = ",\"playbackmethod\":" + out.RawString(prefix) + { + out.RawByte('[') + for v87, v88 := range in.PlaybackMethods { + if v87 > 0 { + out.RawByte(',') + } + out.Int(int(v88)) + } + out.RawByte(']') + } + } + if in.PlaybackEndEvent != 0 { + const prefix string = ",\"playbackend\":" + out.RawString(prefix) + out.Int(int(in.PlaybackEndEvent)) + } + if len(in.DeliveryMethods) != 0 { + const prefix string = ",\"delivery\":" + out.RawString(prefix) + { + out.RawByte('[') + for v89, v90 := range in.DeliveryMethods { + if v89 > 0 { + out.RawByte(',') + } + out.Int(int(v90)) + } + out.RawByte(']') + } + } + if in.Position != 0 { + const prefix string = ",\"pos\":" + out.RawString(prefix) + out.Int(int(in.Position)) + } + if len(in.CompanionAds) != 0 { + const prefix string = ",\"companionad\":" + out.RawString(prefix) + { + out.RawByte('[') + for v91, v92 := range in.CompanionAds { + if v91 > 0 { + out.RawByte(',') + } + (v92).MarshalEasyJSON(out) + } + out.RawByte(']') + } + } + if len(in.APIFrameworks) != 0 { + const prefix string = ",\"api\":" + out.RawString(prefix) + { + out.RawByte('[') + for v93, v94 := range in.APIFrameworks { + if v93 > 0 { + out.RawByte(',') + } + out.Int(int(v94)) + } + out.RawByte(']') + } + } + if len(in.CompanionTypes) != 0 { + const prefix string = ",\"companiontype\":" + out.RawString(prefix) + { + out.RawByte('[') + for v95, v96 := range in.CompanionTypes { + if v95 > 0 { + out.RawByte(',') + } + out.Int(int(v96)) + } + out.RawByte(']') + } + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson89fe9b30DecodeGithubComVungleVungoOpenrtb13(in *jlexer.Lexer, out *Metric) { + 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 "type": + out.Type = string(in.String()) + case "value": + out.Value = float64(in.Float64()) + case "vendor": + out.Vendor = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson89fe9b30EncodeGithubComVungleVungoOpenrtb13(out *jwriter.Writer, in Metric) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"type\":" + out.RawString(prefix[1:]) + out.String(string(in.Type)) + } + if in.Value != 0 { + const prefix string = ",\"value\":" + out.RawString(prefix) + out.Float64(float64(in.Value)) + } + if in.Vendor != "" { + const prefix string = ",\"vendor\":" + out.RawString(prefix) + out.String(string(in.Vendor)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} diff --git a/openrtb/bidresponse_easyjson.go b/openrtb/bidresponse_easyjson.go index 793d66c..cff2b95 100644 --- a/openrtb/bidresponse_easyjson.go +++ b/openrtb/bidresponse_easyjson.go @@ -16,3 +16,265 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson10eb023eDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *BidResponse) { + 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 "id": + out.ID = string(in.String()) + case "seatbid": + if in.IsNull() { + in.Skip() + out.SeatBids = nil + } else { + in.Delim('[') + if out.SeatBids == nil { + if !in.IsDelim(']') { + out.SeatBids = make([]*SeatBid, 0, 8) + } else { + out.SeatBids = []*SeatBid{} + } + } else { + out.SeatBids = (out.SeatBids)[:0] + } + for !in.IsDelim(']') { + var v1 *SeatBid + if in.IsNull() { + in.Skip() + v1 = nil + } else { + if v1 == nil { + v1 = new(SeatBid) + } + easyjson10eb023eDecodeGithubComVungleVungoOpenrtb1(in, v1) + } + out.SeatBids = append(out.SeatBids, v1) + in.WantComma() + } + in.Delim(']') + } + case "bidid": + out.BidID = string(in.String()) + case "cur": + out.Currency = Currency(in.String()) + case "customdata": + out.CustomData = string(in.String()) + case "nbr": + out.NoBidReason = NoBidReason(in.Int()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson10eb023eEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in BidResponse) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"id\":" + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if len(in.SeatBids) != 0 { + const prefix string = ",\"seatbid\":" + out.RawString(prefix) + { + out.RawByte('[') + for v2, v3 := range in.SeatBids { + if v2 > 0 { + out.RawByte(',') + } + if v3 == nil { + out.RawString("null") + } else { + easyjson10eb023eEncodeGithubComVungleVungoOpenrtb1(out, *v3) + } + } + out.RawByte(']') + } + } + if in.BidID != "" { + const prefix string = ",\"bidid\":" + out.RawString(prefix) + out.String(string(in.BidID)) + } + if in.Currency != "" { + const prefix string = ",\"cur\":" + out.RawString(prefix) + out.String(string(in.Currency)) + } + if in.CustomData != "" { + const prefix string = ",\"customdata\":" + out.RawString(prefix) + out.String(string(in.CustomData)) + } + if in.NoBidReason != 0 { + const prefix string = ",\"nbr\":" + out.RawString(prefix) + out.Int(int(in.NoBidReason)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v BidResponse) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson10eb023eEncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v BidResponse) MarshalEasyJSON(w *jwriter.Writer) { + easyjson10eb023eEncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *BidResponse) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson10eb023eDecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *BidResponse) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson10eb023eDecodeGithubComVungleVungoOpenrtb(l, v) +} +func easyjson10eb023eDecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *SeatBid) { + 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 "bid": + if in.IsNull() { + in.Skip() + out.Bids = nil + } else { + in.Delim('[') + if out.Bids == nil { + if !in.IsDelim(']') { + out.Bids = make([]*Bid, 0, 8) + } else { + out.Bids = []*Bid{} + } + } else { + out.Bids = (out.Bids)[:0] + } + for !in.IsDelim(']') { + var v4 *Bid + if in.IsNull() { + in.Skip() + v4 = nil + } else { + if v4 == nil { + v4 = new(Bid) + } + (*v4).UnmarshalEasyJSON(in) + } + out.Bids = append(out.Bids, v4) + in.WantComma() + } + in.Delim(']') + } + case "seat": + out.Seat = string(in.String()) + case "group": + out.Group = int(in.Int()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson10eb023eEncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in SeatBid) { + out.RawByte('{') + first := true + _ = first + if len(in.Bids) != 0 { + const prefix string = ",\"bid\":" + first = false + out.RawString(prefix[1:]) + { + out.RawByte('[') + for v5, v6 := range in.Bids { + if v5 > 0 { + out.RawByte(',') + } + if v6 == nil { + out.RawString("null") + } else { + (*v6).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + } + if in.Seat != "" { + const prefix string = ",\"seat\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Seat)) + } + if in.Group != 0 { + const prefix string = ",\"group\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Group)) + } + out.RawByte('}') +} diff --git a/openrtb/content_easyjson.go b/openrtb/content_easyjson.go index 793d66c..50af3a3 100644 --- a/openrtb/content_easyjson.go +++ b/openrtb/content_easyjson.go @@ -16,3 +16,826 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson344736e9DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Content) { + 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 "id": + out.ID = string(in.String()) + case "episode": + if in.IsNull() { + in.Skip() + out.Episode = nil + } else { + if out.Episode == nil { + out.Episode = new(int) + } + *out.Episode = int(in.Int()) + } + case "title": + out.Title = string(in.String()) + case "series": + out.Series = string(in.String()) + case "season": + out.Season = string(in.String()) + case "artist": + out.Artist = string(in.String()) + case "genre": + out.Genre = string(in.String()) + case "album": + out.Album = string(in.String()) + case "isrc": + out.ISRC = string(in.String()) + case "producer": + if in.IsNull() { + in.Skip() + out.Producer = nil + } else { + if out.Producer == nil { + out.Producer = new(Producer) + } + easyjson344736e9DecodeGithubComVungleVungoOpenrtb1(in, out.Producer) + } + case "url": + out.URL = string(in.String()) + case "cat": + if in.IsNull() { + in.Skip() + out.Cat = nil + } else { + in.Delim('[') + if out.Cat == nil { + if !in.IsDelim(']') { + out.Cat = make([]string, 0, 4) + } else { + out.Cat = []string{} + } + } else { + out.Cat = (out.Cat)[:0] + } + for !in.IsDelim(']') { + var v1 string + v1 = string(in.String()) + out.Cat = append(out.Cat, v1) + in.WantComma() + } + in.Delim(']') + } + case "prodq": + out.ProdQ = ProductionQuality(in.Int()) + case "videoquality": + out.VideoQuality = ProductionQuality(in.Int()) + case "context": + out.Context = ContentContext(in.Int()) + case "contentrating": + out.ContentRating = string(in.String()) + case "userrating": + out.UserRating = string(in.String()) + case "qagmediarating": + out.QAGMediaRating = IQGMediaRating(in.Int()) + case "keywords": + out.Keywords = string(in.String()) + case "livestream": + if in.IsNull() { + in.Skip() + out.LiveStream = nil + } else { + if out.LiveStream == nil { + out.LiveStream = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.LiveStream).UnmarshalJSON(data)) + } + } + case "sourcerelationship": + if in.IsNull() { + in.Skip() + out.SourceRelationship = nil + } else { + if out.SourceRelationship == nil { + out.SourceRelationship = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.SourceRelationship).UnmarshalJSON(data)) + } + } + case "len": + if in.IsNull() { + in.Skip() + out.Len = nil + } else { + if out.Len == nil { + out.Len = new(int) + } + *out.Len = int(in.Int()) + } + case "language": + out.Language = string(in.String()) + case "embeddable": + if in.IsNull() { + in.Skip() + out.Embeddable = nil + } else { + if out.Embeddable == nil { + out.Embeddable = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.Embeddable).UnmarshalJSON(data)) + } + } + case "data": + if in.IsNull() { + in.Skip() + out.Data = nil + } else { + in.Delim('[') + if out.Data == nil { + if !in.IsDelim(']') { + out.Data = make([]*Data, 0, 8) + } else { + out.Data = []*Data{} + } + } else { + out.Data = (out.Data)[:0] + } + for !in.IsDelim(']') { + var v2 *Data + if in.IsNull() { + in.Skip() + v2 = nil + } else { + if v2 == nil { + v2 = new(Data) + } + easyjson344736e9DecodeGithubComVungleVungoOpenrtb2(in, v2) + } + out.Data = append(out.Data, v2) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson344736e9EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Content) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Episode != nil { + const prefix string = ",\"episode\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(*in.Episode)) + } + if in.Title != "" { + const prefix string = ",\"title\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Title)) + } + if in.Series != "" { + const prefix string = ",\"series\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Series)) + } + if in.Season != "" { + const prefix string = ",\"season\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Season)) + } + if in.Artist != "" { + const prefix string = ",\"artist\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Artist)) + } + if in.Genre != "" { + const prefix string = ",\"genre\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Genre)) + } + if in.Album != "" { + const prefix string = ",\"album\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Album)) + } + if in.ISRC != "" { + const prefix string = ",\"isrc\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.ISRC)) + } + if in.Producer != nil { + const prefix string = ",\"producer\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + easyjson344736e9EncodeGithubComVungleVungoOpenrtb1(out, *in.Producer) + } + if in.URL != "" { + const prefix string = ",\"url\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.URL)) + } + if len(in.Cat) != 0 { + const prefix string = ",\"cat\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v3, v4 := range in.Cat { + if v3 > 0 { + out.RawByte(',') + } + out.String(string(v4)) + } + out.RawByte(']') + } + } + if in.ProdQ != 0 { + const prefix string = ",\"prodq\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.ProdQ)) + } + if in.VideoQuality != 0 { + const prefix string = ",\"videoquality\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.VideoQuality)) + } + if in.Context != 0 { + const prefix string = ",\"context\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Context)) + } + if in.ContentRating != "" { + const prefix string = ",\"contentrating\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.ContentRating)) + } + if in.UserRating != "" { + const prefix string = ",\"userrating\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.UserRating)) + } + if in.QAGMediaRating != 0 { + const prefix string = ",\"qagmediarating\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.QAGMediaRating)) + } + if in.Keywords != "" { + const prefix string = ",\"keywords\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Keywords)) + } + if in.LiveStream != nil { + const prefix string = ",\"livestream\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.LiveStream).MarshalJSON()) + } + if in.SourceRelationship != nil { + const prefix string = ",\"sourcerelationship\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.SourceRelationship).MarshalJSON()) + } + if in.Len != nil { + const prefix string = ",\"len\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(*in.Len)) + } + if in.Language != "" { + const prefix string = ",\"language\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Language)) + } + if in.Embeddable != nil { + const prefix string = ",\"embeddable\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.Embeddable).MarshalJSON()) + } + if len(in.Data) != 0 { + const prefix string = ",\"data\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v5, v6 := range in.Data { + if v5 > 0 { + out.RawByte(',') + } + if v6 == nil { + out.RawString("null") + } else { + easyjson344736e9EncodeGithubComVungleVungoOpenrtb2(out, *v6) + } + } + out.RawByte(']') + } + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Content) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson344736e9EncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Content) MarshalEasyJSON(w *jwriter.Writer) { + easyjson344736e9EncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Content) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson344736e9DecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Content) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson344736e9DecodeGithubComVungleVungoOpenrtb(l, v) +} +func easyjson344736e9DecodeGithubComVungleVungoOpenrtb2(in *jlexer.Lexer, out *Data) { + 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 "id": + out.ID = string(in.String()) + case "name": + out.Name = string(in.String()) + case "segment": + if in.IsNull() { + in.Skip() + out.Segment = nil + } else { + in.Delim('[') + if out.Segment == nil { + if !in.IsDelim(']') { + out.Segment = make([]*Segment, 0, 8) + } else { + out.Segment = []*Segment{} + } + } else { + out.Segment = (out.Segment)[:0] + } + for !in.IsDelim(']') { + var v7 *Segment + if in.IsNull() { + in.Skip() + v7 = nil + } else { + if v7 == nil { + v7 = new(Segment) + } + easyjson344736e9DecodeGithubComVungleVungoOpenrtb3(in, v7) + } + out.Segment = append(out.Segment, v7) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson344736e9EncodeGithubComVungleVungoOpenrtb2(out *jwriter.Writer, in Data) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Name != "" { + const prefix string = ",\"name\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Name)) + } + if len(in.Segment) != 0 { + const prefix string = ",\"segment\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v8, v9 := range in.Segment { + if v8 > 0 { + out.RawByte(',') + } + if v9 == nil { + out.RawString("null") + } else { + easyjson344736e9EncodeGithubComVungleVungoOpenrtb3(out, *v9) + } + } + out.RawByte(']') + } + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson344736e9DecodeGithubComVungleVungoOpenrtb3(in *jlexer.Lexer, out *Segment) { + 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 "id": + out.ID = string(in.String()) + case "name": + out.Name = string(in.String()) + case "value": + out.Value = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson344736e9EncodeGithubComVungleVungoOpenrtb3(out *jwriter.Writer, in Segment) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Name != "" { + const prefix string = ",\"name\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Name)) + } + if in.Value != "" { + const prefix string = ",\"value\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Value)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson344736e9DecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *Producer) { + 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 "id": + out.ID = string(in.String()) + case "name": + out.Name = string(in.String()) + case "cat": + if in.IsNull() { + in.Skip() + out.Cat = nil + } else { + in.Delim('[') + if out.Cat == nil { + if !in.IsDelim(']') { + out.Cat = make([]string, 0, 4) + } else { + out.Cat = []string{} + } + } else { + out.Cat = (out.Cat)[:0] + } + for !in.IsDelim(']') { + var v10 string + v10 = string(in.String()) + out.Cat = append(out.Cat, v10) + in.WantComma() + } + in.Delim(']') + } + case "domain": + out.Domain = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson344736e9EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in Producer) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Name != "" { + const prefix string = ",\"name\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Name)) + } + if len(in.Cat) != 0 { + const prefix string = ",\"cat\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v11, v12 := range in.Cat { + if v11 > 0 { + out.RawByte(',') + } + out.String(string(v12)) + } + out.RawByte(']') + } + } + if in.Domain != "" { + const prefix string = ",\"domain\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Domain)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} diff --git a/openrtb/data_easyjson.go b/openrtb/data_easyjson.go index 793d66c..9789e8a 100644 --- a/openrtb/data_easyjson.go +++ b/openrtb/data_easyjson.go @@ -16,3 +16,232 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson794297d0DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Data) { + 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 "id": + out.ID = string(in.String()) + case "name": + out.Name = string(in.String()) + case "segment": + if in.IsNull() { + in.Skip() + out.Segment = nil + } else { + in.Delim('[') + if out.Segment == nil { + if !in.IsDelim(']') { + out.Segment = make([]*Segment, 0, 8) + } else { + out.Segment = []*Segment{} + } + } else { + out.Segment = (out.Segment)[:0] + } + for !in.IsDelim(']') { + var v1 *Segment + if in.IsNull() { + in.Skip() + v1 = nil + } else { + if v1 == nil { + v1 = new(Segment) + } + easyjson794297d0DecodeGithubComVungleVungoOpenrtb1(in, v1) + } + out.Segment = append(out.Segment, v1) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson794297d0EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Data) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Name != "" { + const prefix string = ",\"name\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Name)) + } + if len(in.Segment) != 0 { + const prefix string = ",\"segment\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v2, v3 := range in.Segment { + if v2 > 0 { + out.RawByte(',') + } + if v3 == nil { + out.RawString("null") + } else { + easyjson794297d0EncodeGithubComVungleVungoOpenrtb1(out, *v3) + } + } + out.RawByte(']') + } + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Data) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson794297d0EncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Data) MarshalEasyJSON(w *jwriter.Writer) { + easyjson794297d0EncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Data) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson794297d0DecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Data) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson794297d0DecodeGithubComVungleVungoOpenrtb(l, v) +} +func easyjson794297d0DecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *Segment) { + 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 "id": + out.ID = string(in.String()) + case "name": + out.Name = string(in.String()) + case "value": + out.Value = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson794297d0EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in Segment) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Name != "" { + const prefix string = ",\"name\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Name)) + } + if in.Value != "" { + const prefix string = ",\"value\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Value)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} diff --git a/openrtb/deal_easyjson.go b/openrtb/deal_easyjson.go index 793d66c..0ffecc2 100644 --- a/openrtb/deal_easyjson.go +++ b/openrtb/deal_easyjson.go @@ -16,3 +16,174 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson8a221a72DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Deal) { + 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 "id": + out.ID = string(in.String()) + case "bidfloor": + out.BidFloorPrice = float64(in.Float64()) + case "bidfloorcur": + out.BidFloorCurrency = Currency(in.String()) + case "at": + out.AuctionType = DealAuctionType(in.Int()) + case "wseat": + if in.IsNull() { + in.Skip() + out.WhitelistedSeats = nil + } else { + in.Delim('[') + if out.WhitelistedSeats == nil { + if !in.IsDelim(']') { + out.WhitelistedSeats = make([]string, 0, 4) + } else { + out.WhitelistedSeats = []string{} + } + } else { + out.WhitelistedSeats = (out.WhitelistedSeats)[:0] + } + for !in.IsDelim(']') { + var v1 string + v1 = string(in.String()) + out.WhitelistedSeats = append(out.WhitelistedSeats, v1) + in.WantComma() + } + in.Delim(']') + } + case "wadomain": + if in.IsNull() { + in.Skip() + out.AdvertiserDomains = nil + } else { + in.Delim('[') + if out.AdvertiserDomains == nil { + if !in.IsDelim(']') { + out.AdvertiserDomains = make([]string, 0, 4) + } else { + out.AdvertiserDomains = []string{} + } + } else { + out.AdvertiserDomains = (out.AdvertiserDomains)[:0] + } + for !in.IsDelim(']') { + var v2 string + v2 = string(in.String()) + out.AdvertiserDomains = append(out.AdvertiserDomains, v2) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson8a221a72EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Deal) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"id\":" + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + { + const prefix string = ",\"bidfloor\":" + out.RawString(prefix) + out.Float64(float64(in.BidFloorPrice)) + } + if in.BidFloorCurrency != "" { + const prefix string = ",\"bidfloorcur\":" + out.RawString(prefix) + out.String(string(in.BidFloorCurrency)) + } + if in.AuctionType != 0 { + const prefix string = ",\"at\":" + out.RawString(prefix) + out.Int(int(in.AuctionType)) + } + if len(in.WhitelistedSeats) != 0 { + const prefix string = ",\"wseat\":" + out.RawString(prefix) + { + out.RawByte('[') + for v3, v4 := range in.WhitelistedSeats { + if v3 > 0 { + out.RawByte(',') + } + out.String(string(v4)) + } + out.RawByte(']') + } + } + if len(in.AdvertiserDomains) != 0 { + const prefix string = ",\"wadomain\":" + out.RawString(prefix) + { + out.RawByte('[') + for v5, v6 := range in.AdvertiserDomains { + if v5 > 0 { + out.RawByte(',') + } + out.String(string(v6)) + } + out.RawByte(']') + } + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Deal) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson8a221a72EncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Deal) MarshalEasyJSON(w *jwriter.Writer) { + easyjson8a221a72EncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Deal) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson8a221a72DecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Deal) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson8a221a72DecodeGithubComVungleVungoOpenrtb(l, v) +} diff --git a/openrtb/device_easyjson.go b/openrtb/device_easyjson.go index 793d66c..9010484 100644 --- a/openrtb/device_easyjson.go +++ b/openrtb/device_easyjson.go @@ -16,3 +16,684 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson3073ac56DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Device) { + 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 "ua": + out.BrowserUserAgent = string(in.String()) + case "geo": + if in.IsNull() { + in.Skip() + out.Geo = nil + } else { + if out.Geo == nil { + out.Geo = new(Geo) + } + easyjson3073ac56DecodeGithubComVungleVungoOpenrtb1(in, out.Geo) + } + case "dnt": + if in.IsNull() { + in.Skip() + out.HasDoNotTrack = nil + } else { + if out.HasDoNotTrack == nil { + out.HasDoNotTrack = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.HasDoNotTrack).UnmarshalJSON(data)) + } + } + case "lmt": + if in.IsNull() { + in.Skip() + out.HasLimitedAdTracking = nil + } else { + if out.HasLimitedAdTracking == nil { + out.HasLimitedAdTracking = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.HasLimitedAdTracking).UnmarshalJSON(data)) + } + } + case "ip": + out.IP = string(in.String()) + case "ipv6": + out.IPv6 = string(in.String()) + case "devicetype": + out.Type = DeviceType(in.Int()) + case "make": + out.Make = string(in.String()) + case "model": + out.Model = string(in.String()) + case "os": + if data := in.Raw(); in.Ok() { + in.AddError((out.OS).UnmarshalJSON(data)) + } + case "osv": + out.OSVersion = OSVersion(in.String()) + case "hwv": + out.HardwareVersion = string(in.String()) + case "h": + out.Height = int(in.Int()) + case "w": + out.Width = int(in.Int()) + case "ppi": + out.PPI = int(in.Int()) + case "pxratio": + out.PixelRatio = float64(in.Float64()) + case "js": + if in.IsNull() { + in.Skip() + out.SupportsJavaScript = nil + } else { + if out.SupportsJavaScript == nil { + out.SupportsJavaScript = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.SupportsJavaScript).UnmarshalJSON(data)) + } + } + case "geofetch": + if in.IsNull() { + in.Skip() + out.GeoFetch = nil + } else { + if out.GeoFetch == nil { + out.GeoFetch = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.GeoFetch).UnmarshalJSON(data)) + } + } + case "flashver": + out.FlashVersion = string(in.String()) + case "language": + out.Language = string(in.String()) + case "carrier": + out.Carrier = string(in.String()) + case "mccmnc": + out.MCCMNC = string(in.String()) + case "connectiontype": + out.ConnectionType = ConnectionType(in.Int()) + case "ifa": + out.IFA = string(in.String()) + case "didsha1": + out.HardwareIDSHA1 = string(in.String()) + case "didmd5": + out.HardwareIDMD5 = string(in.String()) + case "dpidsha1": + out.PlatformIDSHA1 = string(in.String()) + case "dpidmd5": + out.PlatformIDMD5 = string(in.String()) + case "macsha1": + out.MACSHA1 = string(in.String()) + case "macmd5": + out.MACMD5 = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3073ac56EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Device) { + out.RawByte('{') + first := true + _ = first + if in.BrowserUserAgent != "" { + const prefix string = ",\"ua\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.BrowserUserAgent)) + } + if in.Geo != nil { + const prefix string = ",\"geo\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + easyjson3073ac56EncodeGithubComVungleVungoOpenrtb1(out, *in.Geo) + } + if in.HasDoNotTrack != nil { + const prefix string = ",\"dnt\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.HasDoNotTrack).MarshalJSON()) + } + if in.HasLimitedAdTracking != nil { + const prefix string = ",\"lmt\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.HasLimitedAdTracking).MarshalJSON()) + } + if in.IP != "" { + const prefix string = ",\"ip\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.IP)) + } + if in.IPv6 != "" { + const prefix string = ",\"ipv6\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.IPv6)) + } + if in.Type != 0 { + const prefix string = ",\"devicetype\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Type)) + } + if in.Make != "" { + const prefix string = ",\"make\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Make)) + } + if in.Model != "" { + const prefix string = ",\"model\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Model)) + } + if in.OS != "" { + const prefix string = ",\"os\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.OS)) + } + if in.OSVersion != "" { + const prefix string = ",\"osv\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.OSVersion)) + } + if in.HardwareVersion != "" { + const prefix string = ",\"hwv\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.HardwareVersion)) + } + if in.Height != 0 { + const prefix string = ",\"h\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Height)) + } + if in.Width != 0 { + const prefix string = ",\"w\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Width)) + } + if in.PPI != 0 { + const prefix string = ",\"ppi\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.PPI)) + } + if in.PixelRatio != 0 { + const prefix string = ",\"pxratio\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Float64(float64(in.PixelRatio)) + } + if in.SupportsJavaScript != nil { + const prefix string = ",\"js\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.SupportsJavaScript).MarshalJSON()) + } + if in.GeoFetch != nil { + const prefix string = ",\"geofetch\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.GeoFetch).MarshalJSON()) + } + if in.FlashVersion != "" { + const prefix string = ",\"flashver\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.FlashVersion)) + } + if in.Language != "" { + const prefix string = ",\"language\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Language)) + } + if in.Carrier != "" { + const prefix string = ",\"carrier\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Carrier)) + } + if in.MCCMNC != "" { + const prefix string = ",\"mccmnc\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.MCCMNC)) + } + if in.ConnectionType != 0 { + const prefix string = ",\"connectiontype\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.ConnectionType)) + } + if in.IFA != "" { + const prefix string = ",\"ifa\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.IFA)) + } + if in.HardwareIDSHA1 != "" { + const prefix string = ",\"didsha1\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.HardwareIDSHA1)) + } + if in.HardwareIDMD5 != "" { + const prefix string = ",\"didmd5\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.HardwareIDMD5)) + } + if in.PlatformIDSHA1 != "" { + const prefix string = ",\"dpidsha1\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.PlatformIDSHA1)) + } + if in.PlatformIDMD5 != "" { + const prefix string = ",\"dpidmd5\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.PlatformIDMD5)) + } + if in.MACSHA1 != "" { + const prefix string = ",\"macsha1\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.MACSHA1)) + } + if in.MACMD5 != "" { + const prefix string = ",\"macmd5\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.MACMD5)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Device) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3073ac56EncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Device) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3073ac56EncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Device) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3073ac56DecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Device) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3073ac56DecodeGithubComVungleVungoOpenrtb(l, v) +} +func easyjson3073ac56DecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *Geo) { + 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.Latitude = float64(in.Float64()) + case "lon": + out.Longitude = float64(in.Float64()) + case "type": + out.Type = LocationType(in.Int()) + case "accuracy": + out.Accuracy = int(in.Int()) + case "lastfix": + out.LastFix = int(in.Int()) + case "ipservice": + out.IPService = IPLocationService(in.Int()) + case "country": + out.Country = string(in.String()) + case "region": + out.Region = string(in.String()) + case "regionfips104": + out.RegionFIPS104 = string(in.String()) + case "metro": + out.Metro = string(in.String()) + case "city": + out.City = string(in.String()) + case "zip": + out.ZipCode = string(in.String()) + case "utcoffset": + out.UTCOffset = int(in.Int()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3073ac56EncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in Geo) { + out.RawByte('{') + first := true + _ = first + if in.Latitude != 0 { + const prefix string = ",\"lat\":" + first = false + out.RawString(prefix[1:]) + out.Float64(float64(in.Latitude)) + } + if in.Longitude != 0 { + const prefix string = ",\"lon\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Float64(float64(in.Longitude)) + } + if in.Type != 0 { + const prefix string = ",\"type\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Type)) + } + if in.Accuracy != 0 { + const prefix string = ",\"accuracy\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Accuracy)) + } + if in.LastFix != 0 { + const prefix string = ",\"lastfix\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.LastFix)) + } + if in.IPService != 0 { + const prefix string = ",\"ipservice\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.IPService)) + } + if in.Country != "" { + const prefix string = ",\"country\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Country)) + } + if in.Region != "" { + const prefix string = ",\"region\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Region)) + } + if in.RegionFIPS104 != "" { + const prefix string = ",\"regionfips104\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.RegionFIPS104)) + } + if in.Metro != "" { + const prefix string = ",\"metro\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Metro)) + } + if in.City != "" { + const prefix string = ",\"city\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.City)) + } + if in.ZipCode != "" { + const prefix string = ",\"zip\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.ZipCode)) + } + if in.UTCOffset != 0 { + const prefix string = ",\"utcoffset\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.UTCOffset)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} diff --git a/openrtb/format_easyjson.go b/openrtb/format_easyjson.go index 793d66c..b57c766 100644 --- a/openrtb/format_easyjson.go +++ b/openrtb/format_easyjson.go @@ -16,3 +16,133 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson72863a49DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Format) { + 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 "w": + out.W = uint64(in.Uint64()) + case "h": + out.H = uint64(in.Uint64()) + case "wratio": + out.WRatio = uint64(in.Uint64()) + case "hratio": + out.HRatio = uint64(in.Uint64()) + case "wmin": + out.WMin = uint64(in.Uint64()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson72863a49EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Format) { + out.RawByte('{') + first := true + _ = first + if in.W != 0 { + const prefix string = ",\"w\":" + first = false + out.RawString(prefix[1:]) + out.Uint64(uint64(in.W)) + } + if in.H != 0 { + const prefix string = ",\"h\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Uint64(uint64(in.H)) + } + if in.WRatio != 0 { + const prefix string = ",\"wratio\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Uint64(uint64(in.WRatio)) + } + if in.HRatio != 0 { + const prefix string = ",\"hratio\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Uint64(uint64(in.HRatio)) + } + if in.WMin != 0 { + const prefix string = ",\"wmin\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Uint64(uint64(in.WMin)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Format) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson72863a49EncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Format) MarshalEasyJSON(w *jwriter.Writer) { + easyjson72863a49EncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Format) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson72863a49DecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Format) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson72863a49DecodeGithubComVungleVungoOpenrtb(l, v) +} diff --git a/openrtb/geo_easyjson.go b/openrtb/geo_easyjson.go index 793d66c..43a035c 100644 --- a/openrtb/geo_easyjson.go +++ b/openrtb/geo_easyjson.go @@ -16,3 +16,229 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjsonA0535929DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Geo) { + 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.Latitude = float64(in.Float64()) + case "lon": + out.Longitude = float64(in.Float64()) + case "type": + out.Type = LocationType(in.Int()) + case "accuracy": + out.Accuracy = int(in.Int()) + case "lastfix": + out.LastFix = int(in.Int()) + case "ipservice": + out.IPService = IPLocationService(in.Int()) + case "country": + out.Country = string(in.String()) + case "region": + out.Region = string(in.String()) + case "regionfips104": + out.RegionFIPS104 = string(in.String()) + case "metro": + out.Metro = string(in.String()) + case "city": + out.City = string(in.String()) + case "zip": + out.ZipCode = string(in.String()) + case "utcoffset": + out.UTCOffset = int(in.Int()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonA0535929EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Geo) { + out.RawByte('{') + first := true + _ = first + if in.Latitude != 0 { + const prefix string = ",\"lat\":" + first = false + out.RawString(prefix[1:]) + out.Float64(float64(in.Latitude)) + } + if in.Longitude != 0 { + const prefix string = ",\"lon\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Float64(float64(in.Longitude)) + } + if in.Type != 0 { + const prefix string = ",\"type\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Type)) + } + if in.Accuracy != 0 { + const prefix string = ",\"accuracy\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Accuracy)) + } + if in.LastFix != 0 { + const prefix string = ",\"lastfix\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.LastFix)) + } + if in.IPService != 0 { + const prefix string = ",\"ipservice\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.IPService)) + } + if in.Country != "" { + const prefix string = ",\"country\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Country)) + } + if in.Region != "" { + const prefix string = ",\"region\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Region)) + } + if in.RegionFIPS104 != "" { + const prefix string = ",\"regionfips104\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.RegionFIPS104)) + } + if in.Metro != "" { + const prefix string = ",\"metro\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Metro)) + } + if in.City != "" { + const prefix string = ",\"city\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.City)) + } + if in.ZipCode != "" { + const prefix string = ",\"zip\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.ZipCode)) + } + if in.UTCOffset != 0 { + const prefix string = ",\"utcoffset\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.UTCOffset)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Geo) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonA0535929EncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Geo) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonA0535929EncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Geo) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonA0535929DecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Geo) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonA0535929DecodeGithubComVungleVungoOpenrtb(l, v) +} diff --git a/openrtb/impression_easyjson.go b/openrtb/impression_easyjson.go index 793d66c..482d2fb 100644 --- a/openrtb/impression_easyjson.go +++ b/openrtb/impression_easyjson.go @@ -16,3 +16,1110 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Impression) { + 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 "id": + out.ID = string(in.String()) + case "metric": + if in.IsNull() { + in.Skip() + out.Metrics = nil + } else { + in.Delim('[') + if out.Metrics == nil { + if !in.IsDelim(']') { + out.Metrics = make([]*Metric, 0, 8) + } else { + out.Metrics = []*Metric{} + } + } else { + out.Metrics = (out.Metrics)[:0] + } + for !in.IsDelim(']') { + var v1 *Metric + if in.IsNull() { + in.Skip() + v1 = nil + } else { + if v1 == nil { + v1 = new(Metric) + } + easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb1(in, v1) + } + out.Metrics = append(out.Metrics, v1) + in.WantComma() + } + in.Delim(']') + } + case "banner": + if in.IsNull() { + in.Skip() + out.Banner = nil + } else { + if out.Banner == nil { + out.Banner = new(Banner) + } + (*out.Banner).UnmarshalEasyJSON(in) + } + case "video": + if in.IsNull() { + in.Skip() + out.Video = nil + } else { + if out.Video == nil { + out.Video = new(Video) + } + easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb2(in, out.Video) + } + case "audio": + if in.IsNull() { + in.Skip() + out.Audio = nil + } else { + if out.Audio == nil { + out.Audio = new(Audio) + } + (*out.Audio).UnmarshalEasyJSON(in) + } + case "native": + if in.IsNull() { + in.Skip() + out.Native = nil + } else { + if out.Native == nil { + out.Native = new(Native) + } + easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb3(in, out.Native) + } + case "pmp": + if in.IsNull() { + in.Skip() + out.PrivateMarketplace = nil + } else { + if out.PrivateMarketplace == nil { + out.PrivateMarketplace = new(PrivateMarketplace) + } + easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb4(in, out.PrivateMarketplace) + } + case "displaymanager": + out.DisplayManager = string(in.String()) + case "displaymanagerver": + out.DisplayManagerVersion = string(in.String()) + case "instl": + if data := in.Raw(); in.Ok() { + in.AddError((out.IsInterstitial).UnmarshalJSON(data)) + } + case "tagid": + out.TagID = string(in.String()) + case "bidfloor": + out.BidFloorPrice = float64(in.Float64()) + case "bidfloorcur": + out.BidFloorCurrency = Currency(in.String()) + case "clickbrowser": + if in.IsNull() { + in.Skip() + out.BrowserTypeUponClick = nil + } else { + if out.BrowserTypeUponClick == nil { + out.BrowserTypeUponClick = new(BrowserType) + } + *out.BrowserTypeUponClick = BrowserType(in.Int()) + } + case "secure": + if data := in.Raw(); in.Ok() { + in.AddError((out.IsSecure).UnmarshalJSON(data)) + } + case "iframebuster": + if in.IsNull() { + in.Skip() + out.IframeBuster = nil + } else { + in.Delim('[') + if out.IframeBuster == nil { + if !in.IsDelim(']') { + out.IframeBuster = make([]string, 0, 4) + } else { + out.IframeBuster = []string{} + } + } else { + out.IframeBuster = (out.IframeBuster)[:0] + } + for !in.IsDelim(']') { + var v2 string + v2 = string(in.String()) + out.IframeBuster = append(out.IframeBuster, v2) + in.WantComma() + } + in.Delim(']') + } + case "exp": + out.Exp = int(in.Int()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Impression) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"id\":" + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if len(in.Metrics) != 0 { + const prefix string = ",\"metric\":" + out.RawString(prefix) + { + out.RawByte('[') + for v3, v4 := range in.Metrics { + if v3 > 0 { + out.RawByte(',') + } + if v4 == nil { + out.RawString("null") + } else { + easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb1(out, *v4) + } + } + out.RawByte(']') + } + } + if in.Banner != nil { + const prefix string = ",\"banner\":" + out.RawString(prefix) + (*in.Banner).MarshalEasyJSON(out) + } + if in.Video != nil { + const prefix string = ",\"video\":" + out.RawString(prefix) + easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb2(out, *in.Video) + } + if in.Audio != nil { + const prefix string = ",\"audio\":" + out.RawString(prefix) + (*in.Audio).MarshalEasyJSON(out) + } + if in.Native != nil { + const prefix string = ",\"native\":" + out.RawString(prefix) + easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb3(out, *in.Native) + } + if in.PrivateMarketplace != nil { + const prefix string = ",\"pmp\":" + out.RawString(prefix) + easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb4(out, *in.PrivateMarketplace) + } + if in.DisplayManager != "" { + const prefix string = ",\"displaymanager\":" + out.RawString(prefix) + out.String(string(in.DisplayManager)) + } + if in.DisplayManagerVersion != "" { + const prefix string = ",\"displaymanagerver\":" + out.RawString(prefix) + out.String(string(in.DisplayManagerVersion)) + } + if in.IsInterstitial { + const prefix string = ",\"instl\":" + out.RawString(prefix) + out.Raw((in.IsInterstitial).MarshalJSON()) + } + if in.TagID != "" { + const prefix string = ",\"tagid\":" + out.RawString(prefix) + out.String(string(in.TagID)) + } + { + const prefix string = ",\"bidfloor\":" + out.RawString(prefix) + out.Float64(float64(in.BidFloorPrice)) + } + if in.BidFloorCurrency != "" { + const prefix string = ",\"bidfloorcur\":" + out.RawString(prefix) + out.String(string(in.BidFloorCurrency)) + } + if in.BrowserTypeUponClick != nil { + const prefix string = ",\"clickbrowser\":" + out.RawString(prefix) + out.Int(int(*in.BrowserTypeUponClick)) + } + if in.IsSecure { + const prefix string = ",\"secure\":" + out.RawString(prefix) + out.Raw((in.IsSecure).MarshalJSON()) + } + if len(in.IframeBuster) != 0 { + const prefix string = ",\"iframebuster\":" + out.RawString(prefix) + { + out.RawByte('[') + for v5, v6 := range in.IframeBuster { + if v5 > 0 { + out.RawByte(',') + } + out.String(string(v6)) + } + out.RawByte(']') + } + } + if in.Exp != 0 { + const prefix string = ",\"exp\":" + out.RawString(prefix) + out.Int(int(in.Exp)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Impression) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Impression) MarshalEasyJSON(w *jwriter.Writer) { + easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Impression) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Impression) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb(l, v) +} +func easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb4(in *jlexer.Lexer, out *PrivateMarketplace) { + 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 "private_auction": + if data := in.Raw(); in.Ok() { + in.AddError((out.IsPrivateAuction).UnmarshalJSON(data)) + } + case "deals": + if in.IsNull() { + in.Skip() + out.Deals = nil + } else { + in.Delim('[') + if out.Deals == nil { + if !in.IsDelim(']') { + out.Deals = make([]*Deal, 0, 8) + } else { + out.Deals = []*Deal{} + } + } else { + out.Deals = (out.Deals)[:0] + } + for !in.IsDelim(']') { + var v7 *Deal + if in.IsNull() { + in.Skip() + v7 = nil + } else { + if v7 == nil { + v7 = new(Deal) + } + (*v7).UnmarshalEasyJSON(in) + } + out.Deals = append(out.Deals, v7) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb4(out *jwriter.Writer, in PrivateMarketplace) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"private_auction\":" + out.RawString(prefix[1:]) + out.Raw((in.IsPrivateAuction).MarshalJSON()) + } + { + const prefix string = ",\"deals\":" + out.RawString(prefix) + if in.Deals == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v8, v9 := range in.Deals { + if v8 > 0 { + out.RawByte(',') + } + if v9 == nil { + out.RawString("null") + } else { + (*v9).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb3(in *jlexer.Lexer, out *Native) { + 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 "request": + out.Request = string(in.String()) + case "ver": + out.Version = string(in.String()) + case "api": + if in.IsNull() { + in.Skip() + out.APIFrameworks = nil + } else { + in.Delim('[') + if out.APIFrameworks == nil { + if !in.IsDelim(']') { + out.APIFrameworks = make([]APIFramework, 0, 8) + } else { + out.APIFrameworks = []APIFramework{} + } + } else { + out.APIFrameworks = (out.APIFrameworks)[:0] + } + for !in.IsDelim(']') { + var v10 APIFramework + v10 = APIFramework(in.Int()) + out.APIFrameworks = append(out.APIFrameworks, v10) + in.WantComma() + } + in.Delim(']') + } + case "battr": + if in.IsNull() { + in.Skip() + out.BlockedCreativeAttributes = nil + } else { + in.Delim('[') + if out.BlockedCreativeAttributes == nil { + if !in.IsDelim(']') { + out.BlockedCreativeAttributes = make([]CreativeAttribute, 0, 8) + } else { + out.BlockedCreativeAttributes = []CreativeAttribute{} + } + } else { + out.BlockedCreativeAttributes = (out.BlockedCreativeAttributes)[:0] + } + for !in.IsDelim(']') { + var v11 CreativeAttribute + v11 = CreativeAttribute(in.Int()) + out.BlockedCreativeAttributes = append(out.BlockedCreativeAttributes, v11) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb3(out *jwriter.Writer, in Native) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"request\":" + out.RawString(prefix[1:]) + out.String(string(in.Request)) + } + if in.Version != "" { + const prefix string = ",\"ver\":" + out.RawString(prefix) + out.String(string(in.Version)) + } + if len(in.APIFrameworks) != 0 { + const prefix string = ",\"api\":" + out.RawString(prefix) + { + out.RawByte('[') + for v12, v13 := range in.APIFrameworks { + if v12 > 0 { + out.RawByte(',') + } + out.Int(int(v13)) + } + out.RawByte(']') + } + } + if len(in.BlockedCreativeAttributes) != 0 { + const prefix string = ",\"battr\":" + out.RawString(prefix) + { + out.RawByte('[') + for v14, v15 := range in.BlockedCreativeAttributes { + if v14 > 0 { + out.RawByte(',') + } + out.Int(int(v15)) + } + out.RawByte(']') + } + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb2(in *jlexer.Lexer, out *Video) { + 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 "mimes": + if in.IsNull() { + in.Skip() + out.MIMETypes = nil + } else { + in.Delim('[') + if out.MIMETypes == nil { + if !in.IsDelim(']') { + out.MIMETypes = make([]string, 0, 4) + } else { + out.MIMETypes = []string{} + } + } else { + out.MIMETypes = (out.MIMETypes)[:0] + } + for !in.IsDelim(']') { + var v16 string + v16 = string(in.String()) + out.MIMETypes = append(out.MIMETypes, v16) + in.WantComma() + } + in.Delim(']') + } + case "minduration": + if in.IsNull() { + in.Skip() + out.MinDuration = nil + } else { + if out.MinDuration == nil { + out.MinDuration = new(int) + } + *out.MinDuration = int(in.Int()) + } + case "maxduration": + if in.IsNull() { + in.Skip() + out.MaxDuration = nil + } else { + if out.MaxDuration == nil { + out.MaxDuration = new(int) + } + *out.MaxDuration = int(in.Int()) + } + case "protocols": + if in.IsNull() { + in.Skip() + out.Protocols = nil + } else { + in.Delim('[') + if out.Protocols == nil { + if !in.IsDelim(']') { + out.Protocols = make([]Protocol, 0, 8) + } else { + out.Protocols = []Protocol{} + } + } else { + out.Protocols = (out.Protocols)[:0] + } + for !in.IsDelim(']') { + var v17 Protocol + v17 = Protocol(in.Int()) + out.Protocols = append(out.Protocols, v17) + in.WantComma() + } + in.Delim(']') + } + case "protocol": + out.Protocol = Protocol(in.Int()) + case "w": + out.Width = int(in.Int()) + case "h": + out.Height = int(in.Int()) + case "startdelay": + if in.IsNull() { + in.Skip() + out.StartDelay = nil + } else { + if out.StartDelay == nil { + out.StartDelay = new(StartDelay) + } + *out.StartDelay = StartDelay(in.Int()) + } + case "placement": + out.PlacementType = VideoPlacementType(in.Int()) + case "linearity": + out.Linearity = Linearity(in.Int()) + case "skip": + out.Skippable = int(in.Int()) + case "skipmin": + out.SkipMin = int(in.Int()) + case "skipafter": + out.SkipAfter = int(in.Int()) + case "sequence": + out.Sequence = int(in.Int()) + case "battr": + if in.IsNull() { + in.Skip() + out.BlockedCreativeAttributes = nil + } else { + in.Delim('[') + if out.BlockedCreativeAttributes == nil { + if !in.IsDelim(']') { + out.BlockedCreativeAttributes = make([]CreativeAttribute, 0, 8) + } else { + out.BlockedCreativeAttributes = []CreativeAttribute{} + } + } else { + out.BlockedCreativeAttributes = (out.BlockedCreativeAttributes)[:0] + } + for !in.IsDelim(']') { + var v18 CreativeAttribute + v18 = CreativeAttribute(in.Int()) + out.BlockedCreativeAttributes = append(out.BlockedCreativeAttributes, v18) + in.WantComma() + } + in.Delim(']') + } + case "maxextended": + out.MaxExtendedDuration = int(in.Int()) + case "minbitrate": + out.MinBitRate = int(in.Int()) + case "maxbitrate": + out.MaxBitRate = int(in.Int()) + case "boxingallowed": + if data := in.Raw(); in.Ok() { + in.AddError((out.IsBoxingAllowed).UnmarshalJSON(data)) + } + case "playbackmethod": + if in.IsNull() { + in.Skip() + out.PlaybackMethods = nil + } else { + in.Delim('[') + if out.PlaybackMethods == nil { + if !in.IsDelim(']') { + out.PlaybackMethods = make([]PlaybackMethod, 0, 8) + } else { + out.PlaybackMethods = []PlaybackMethod{} + } + } else { + out.PlaybackMethods = (out.PlaybackMethods)[:0] + } + for !in.IsDelim(']') { + var v19 PlaybackMethod + v19 = PlaybackMethod(in.Int()) + out.PlaybackMethods = append(out.PlaybackMethods, v19) + in.WantComma() + } + in.Delim(']') + } + case "playbackend": + out.PlaybackEndEvent = PlaybackCessationMode(in.Int()) + case "delivery": + if in.IsNull() { + in.Skip() + out.DeliveryMethods = nil + } else { + in.Delim('[') + if out.DeliveryMethods == nil { + if !in.IsDelim(']') { + out.DeliveryMethods = make([]DeliveryMethod, 0, 8) + } else { + out.DeliveryMethods = []DeliveryMethod{} + } + } else { + out.DeliveryMethods = (out.DeliveryMethods)[:0] + } + for !in.IsDelim(']') { + var v20 DeliveryMethod + v20 = DeliveryMethod(in.Int()) + out.DeliveryMethods = append(out.DeliveryMethods, v20) + in.WantComma() + } + in.Delim(']') + } + case "pos": + out.Position = AdPosition(in.Int()) + case "companionad": + if in.IsNull() { + in.Skip() + out.CompanionAds = nil + } else { + in.Delim('[') + if out.CompanionAds == nil { + if !in.IsDelim(']') { + out.CompanionAds = make([]Banner, 0, 0) + } else { + out.CompanionAds = []Banner{} + } + } else { + out.CompanionAds = (out.CompanionAds)[:0] + } + for !in.IsDelim(']') { + var v21 Banner + (v21).UnmarshalEasyJSON(in) + out.CompanionAds = append(out.CompanionAds, v21) + in.WantComma() + } + in.Delim(']') + } + case "api": + if in.IsNull() { + in.Skip() + out.APIFrameworks = nil + } else { + in.Delim('[') + if out.APIFrameworks == nil { + if !in.IsDelim(']') { + out.APIFrameworks = make([]APIFramework, 0, 8) + } else { + out.APIFrameworks = []APIFramework{} + } + } else { + out.APIFrameworks = (out.APIFrameworks)[:0] + } + for !in.IsDelim(']') { + var v22 APIFramework + v22 = APIFramework(in.Int()) + out.APIFrameworks = append(out.APIFrameworks, v22) + in.WantComma() + } + in.Delim(']') + } + case "companiontype": + if in.IsNull() { + in.Skip() + out.CompanionTypes = nil + } else { + in.Delim('[') + if out.CompanionTypes == nil { + if !in.IsDelim(']') { + out.CompanionTypes = make([]CompanionType, 0, 8) + } else { + out.CompanionTypes = []CompanionType{} + } + } else { + out.CompanionTypes = (out.CompanionTypes)[:0] + } + for !in.IsDelim(']') { + var v23 CompanionType + v23 = CompanionType(in.Int()) + out.CompanionTypes = append(out.CompanionTypes, v23) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb2(out *jwriter.Writer, in Video) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"mimes\":" + out.RawString(prefix[1:]) + if in.MIMETypes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v24, v25 := range in.MIMETypes { + if v24 > 0 { + out.RawByte(',') + } + out.String(string(v25)) + } + out.RawByte(']') + } + } + if in.MinDuration != nil { + const prefix string = ",\"minduration\":" + out.RawString(prefix) + out.Int(int(*in.MinDuration)) + } + if in.MaxDuration != nil { + const prefix string = ",\"maxduration\":" + out.RawString(prefix) + out.Int(int(*in.MaxDuration)) + } + if len(in.Protocols) != 0 { + const prefix string = ",\"protocols\":" + out.RawString(prefix) + { + out.RawByte('[') + for v26, v27 := range in.Protocols { + if v26 > 0 { + out.RawByte(',') + } + out.Int(int(v27)) + } + out.RawByte(']') + } + } + if in.Protocol != 0 { + const prefix string = ",\"protocol\":" + out.RawString(prefix) + out.Int(int(in.Protocol)) + } + if in.Width != 0 { + const prefix string = ",\"w\":" + out.RawString(prefix) + out.Int(int(in.Width)) + } + if in.Height != 0 { + const prefix string = ",\"h\":" + out.RawString(prefix) + out.Int(int(in.Height)) + } + if in.StartDelay != nil { + const prefix string = ",\"startdelay\":" + out.RawString(prefix) + out.Int(int(*in.StartDelay)) + } + if in.PlacementType != 0 { + const prefix string = ",\"placement\":" + out.RawString(prefix) + out.Int(int(in.PlacementType)) + } + if in.Linearity != 0 { + const prefix string = ",\"linearity\":" + out.RawString(prefix) + out.Int(int(in.Linearity)) + } + if in.Skippable != 0 { + const prefix string = ",\"skip\":" + out.RawString(prefix) + out.Int(int(in.Skippable)) + } + if in.SkipMin != 0 { + const prefix string = ",\"skipmin\":" + out.RawString(prefix) + out.Int(int(in.SkipMin)) + } + if in.SkipAfter != 0 { + const prefix string = ",\"skipafter\":" + out.RawString(prefix) + out.Int(int(in.SkipAfter)) + } + if in.Sequence != 0 { + const prefix string = ",\"sequence\":" + out.RawString(prefix) + out.Int(int(in.Sequence)) + } + if len(in.BlockedCreativeAttributes) != 0 { + const prefix string = ",\"battr\":" + out.RawString(prefix) + { + out.RawByte('[') + for v28, v29 := range in.BlockedCreativeAttributes { + if v28 > 0 { + out.RawByte(',') + } + out.Int(int(v29)) + } + out.RawByte(']') + } + } + if in.MaxExtendedDuration != 0 { + const prefix string = ",\"maxextended\":" + out.RawString(prefix) + out.Int(int(in.MaxExtendedDuration)) + } + if in.MinBitRate != 0 { + const prefix string = ",\"minbitrate\":" + out.RawString(prefix) + out.Int(int(in.MinBitRate)) + } + if in.MaxBitRate != 0 { + const prefix string = ",\"maxbitrate\":" + out.RawString(prefix) + out.Int(int(in.MaxBitRate)) + } + if in.IsBoxingAllowed { + const prefix string = ",\"boxingallowed\":" + out.RawString(prefix) + out.Raw((in.IsBoxingAllowed).MarshalJSON()) + } + if len(in.PlaybackMethods) != 0 { + const prefix string = ",\"playbackmethod\":" + out.RawString(prefix) + { + out.RawByte('[') + for v30, v31 := range in.PlaybackMethods { + if v30 > 0 { + out.RawByte(',') + } + out.Int(int(v31)) + } + out.RawByte(']') + } + } + if in.PlaybackEndEvent != 0 { + const prefix string = ",\"playbackend\":" + out.RawString(prefix) + out.Int(int(in.PlaybackEndEvent)) + } + if len(in.DeliveryMethods) != 0 { + const prefix string = ",\"delivery\":" + out.RawString(prefix) + { + out.RawByte('[') + for v32, v33 := range in.DeliveryMethods { + if v32 > 0 { + out.RawByte(',') + } + out.Int(int(v33)) + } + out.RawByte(']') + } + } + if in.Position != 0 { + const prefix string = ",\"pos\":" + out.RawString(prefix) + out.Int(int(in.Position)) + } + if len(in.CompanionAds) != 0 { + const prefix string = ",\"companionad\":" + out.RawString(prefix) + { + out.RawByte('[') + for v34, v35 := range in.CompanionAds { + if v34 > 0 { + out.RawByte(',') + } + (v35).MarshalEasyJSON(out) + } + out.RawByte(']') + } + } + if len(in.APIFrameworks) != 0 { + const prefix string = ",\"api\":" + out.RawString(prefix) + { + out.RawByte('[') + for v36, v37 := range in.APIFrameworks { + if v36 > 0 { + out.RawByte(',') + } + out.Int(int(v37)) + } + out.RawByte(']') + } + } + if len(in.CompanionTypes) != 0 { + const prefix string = ",\"companiontype\":" + out.RawString(prefix) + { + out.RawByte('[') + for v38, v39 := range in.CompanionTypes { + if v38 > 0 { + out.RawByte(',') + } + out.Int(int(v39)) + } + out.RawByte(']') + } + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson7ebaa60bDecodeGithubComVungleVungoOpenrtb1(in *jlexer.Lexer, out *Metric) { + 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 "type": + out.Type = string(in.String()) + case "value": + out.Value = float64(in.Float64()) + case "vendor": + out.Vendor = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson7ebaa60bEncodeGithubComVungleVungoOpenrtb1(out *jwriter.Writer, in Metric) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"type\":" + out.RawString(prefix[1:]) + out.String(string(in.Type)) + } + if in.Value != 0 { + const prefix string = ",\"value\":" + out.RawString(prefix) + out.Float64(float64(in.Value)) + } + if in.Vendor != "" { + const prefix string = ",\"vendor\":" + out.RawString(prefix) + out.String(string(in.Vendor)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} diff --git a/openrtb/metric_easyjson.go b/openrtb/metric_easyjson.go index 793d66c..9abe315 100644 --- a/openrtb/metric_easyjson.go +++ b/openrtb/metric_easyjson.go @@ -16,3 +16,93 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson9478868cDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Metric) { + 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 "type": + out.Type = string(in.String()) + case "value": + out.Value = float64(in.Float64()) + case "vendor": + out.Vendor = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson9478868cEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Metric) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"type\":" + out.RawString(prefix[1:]) + out.String(string(in.Type)) + } + if in.Value != 0 { + const prefix string = ",\"value\":" + out.RawString(prefix) + out.Float64(float64(in.Value)) + } + if in.Vendor != "" { + const prefix string = ",\"vendor\":" + out.RawString(prefix) + out.String(string(in.Vendor)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Metric) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson9478868cEncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Metric) MarshalEasyJSON(w *jwriter.Writer) { + easyjson9478868cEncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Metric) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson9478868cDecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Metric) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson9478868cDecodeGithubComVungleVungoOpenrtb(l, v) +} diff --git a/openrtb/native/request/asset_easyjson.go b/openrtb/native/request/asset_easyjson.go index e244b7c..8a7b2b1 100644 --- a/openrtb/native/request/asset_easyjson.go +++ b/openrtb/native/request/asset_easyjson.go @@ -4,6 +4,8 @@ package request import ( json "encoding/json" + openrtb "github.com/Vungle/vungo/openrtb" + native "github.com/Vungle/vungo/openrtb/native" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -16,3 +18,538 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.Lexer, out *Asset) { + 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 "id": + out.ID = int64(in.Int64()) + case "required": + out.Required = int8(in.Int8()) + case "title": + if in.IsNull() { + in.Skip() + out.Title = nil + } else { + if out.Title == nil { + out.Title = new(Title) + } + easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest1(in, out.Title) + } + case "img": + if in.IsNull() { + in.Skip() + out.Img = nil + } else { + if out.Img == nil { + out.Img = new(Image) + } + easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest2(in, out.Img) + } + case "video": + if in.IsNull() { + in.Skip() + out.Video = nil + } else { + if out.Video == nil { + out.Video = new(Video) + } + easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest3(in, out.Video) + } + case "data": + if in.IsNull() { + in.Skip() + out.Data = nil + } else { + if out.Data == nil { + out.Data = new(Data) + } + easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest4(in, out.Data) + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter.Writer, in Asset) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"id\":" + out.RawString(prefix[1:]) + out.Int64(int64(in.ID)) + } + if in.Required != 0 { + const prefix string = ",\"required\":" + out.RawString(prefix) + out.Int8(int8(in.Required)) + } + if in.Title != nil { + const prefix string = ",\"title\":" + out.RawString(prefix) + easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest1(out, *in.Title) + } + if in.Img != nil { + const prefix string = ",\"img\":" + out.RawString(prefix) + easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest2(out, *in.Img) + } + if in.Video != nil { + const prefix string = ",\"video\":" + out.RawString(prefix) + easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest3(out, *in.Video) + } + if in.Data != nil { + const prefix string = ",\"data\":" + out.RawString(prefix) + easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest4(out, *in.Data) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Asset) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Asset) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Asset) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Asset) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest(l, v) +} +func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest4(in *jlexer.Lexer, out *Data) { + 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 "type": + out.Type = native.DataAssetType(in.Int64()) + case "len": + out.Len = int64(in.Int64()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest4(out *jwriter.Writer, in Data) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"type\":" + out.RawString(prefix[1:]) + out.Int64(int64(in.Type)) + } + if in.Len != 0 { + const prefix string = ",\"len\":" + out.RawString(prefix) + out.Int64(int64(in.Len)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest3(in *jlexer.Lexer, out *Video) { + 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 "mimes": + if in.IsNull() { + in.Skip() + out.MIMEs = nil + } else { + in.Delim('[') + if out.MIMEs == nil { + if !in.IsDelim(']') { + out.MIMEs = make([]string, 0, 4) + } else { + out.MIMEs = []string{} + } + } else { + out.MIMEs = (out.MIMEs)[:0] + } + for !in.IsDelim(']') { + var v1 string + v1 = string(in.String()) + out.MIMEs = append(out.MIMEs, v1) + in.WantComma() + } + in.Delim(']') + } + case "minduration": + out.MinDuration = int64(in.Int64()) + case "maxduration": + out.MaxDuration = int64(in.Int64()) + case "protocols": + if in.IsNull() { + in.Skip() + out.Protocols = nil + } else { + in.Delim('[') + if out.Protocols == nil { + if !in.IsDelim(']') { + out.Protocols = make([]openrtb.Protocol, 0, 8) + } else { + out.Protocols = []openrtb.Protocol{} + } + } else { + out.Protocols = (out.Protocols)[:0] + } + for !in.IsDelim(']') { + var v2 openrtb.Protocol + v2 = openrtb.Protocol(in.Int()) + out.Protocols = append(out.Protocols, v2) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest3(out *jwriter.Writer, in Video) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"mimes\":" + out.RawString(prefix[1:]) + if in.MIMEs == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v3, v4 := range in.MIMEs { + if v3 > 0 { + out.RawByte(',') + } + out.String(string(v4)) + } + out.RawByte(']') + } + } + { + const prefix string = ",\"minduration\":" + out.RawString(prefix) + out.Int64(int64(in.MinDuration)) + } + { + const prefix string = ",\"maxduration\":" + out.RawString(prefix) + out.Int64(int64(in.MaxDuration)) + } + { + const prefix string = ",\"protocols\":" + out.RawString(prefix) + if in.Protocols == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v5, v6 := range in.Protocols { + if v5 > 0 { + out.RawByte(',') + } + out.Int(int(v6)) + } + out.RawByte(']') + } + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest2(in *jlexer.Lexer, out *Image) { + 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 "type": + out.Type = native.ImageAssetType(in.Int64()) + case "w": + out.W = int64(in.Int64()) + case "wmin": + out.WMin = int64(in.Int64()) + case "h": + out.H = int64(in.Int64()) + case "hmin": + out.HMin = int64(in.Int64()) + case "mimes": + if in.IsNull() { + in.Skip() + out.MIMEs = nil + } else { + in.Delim('[') + if out.MIMEs == nil { + if !in.IsDelim(']') { + out.MIMEs = make([]string, 0, 4) + } else { + out.MIMEs = []string{} + } + } else { + out.MIMEs = (out.MIMEs)[:0] + } + for !in.IsDelim(']') { + var v7 string + v7 = string(in.String()) + out.MIMEs = append(out.MIMEs, v7) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest2(out *jwriter.Writer, in Image) { + out.RawByte('{') + first := true + _ = first + if in.Type != 0 { + const prefix string = ",\"type\":" + first = false + out.RawString(prefix[1:]) + out.Int64(int64(in.Type)) + } + if in.W != 0 { + const prefix string = ",\"w\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int64(int64(in.W)) + } + if in.WMin != 0 { + const prefix string = ",\"wmin\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int64(int64(in.WMin)) + } + if in.H != 0 { + const prefix string = ",\"h\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int64(int64(in.H)) + } + if in.HMin != 0 { + const prefix string = ",\"hmin\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int64(int64(in.HMin)) + } + if len(in.MIMEs) != 0 { + const prefix string = ",\"mimes\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v8, v9 := range in.MIMEs { + if v8 > 0 { + out.RawByte(',') + } + out.String(string(v9)) + } + out.RawByte(']') + } + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeRequest1(in *jlexer.Lexer, out *Title) { + 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 "len": + out.Len = int64(in.Int64()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeRequest1(out *jwriter.Writer, in Title) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"len\":" + out.RawString(prefix[1:]) + out.Int64(int64(in.Len)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} diff --git a/openrtb/native/request/data_easyjson.go b/openrtb/native/request/data_easyjson.go index e244b7c..b1e99a6 100644 --- a/openrtb/native/request/data_easyjson.go +++ b/openrtb/native/request/data_easyjson.go @@ -4,6 +4,7 @@ package request import ( json "encoding/json" + native "github.com/Vungle/vungo/openrtb/native" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -16,3 +17,86 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson794297d0DecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.Lexer, out *Data) { + 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 "type": + out.Type = native.DataAssetType(in.Int64()) + case "len": + out.Len = int64(in.Int64()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson794297d0EncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter.Writer, in Data) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"type\":" + out.RawString(prefix[1:]) + out.Int64(int64(in.Type)) + } + if in.Len != 0 { + const prefix string = ",\"len\":" + out.RawString(prefix) + out.Int64(int64(in.Len)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Data) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson794297d0EncodeGithubComVungleVungoOpenrtbNativeRequest(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Data) MarshalEasyJSON(w *jwriter.Writer) { + easyjson794297d0EncodeGithubComVungleVungoOpenrtbNativeRequest(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Data) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson794297d0DecodeGithubComVungleVungoOpenrtbNativeRequest(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Data) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson794297d0DecodeGithubComVungleVungoOpenrtbNativeRequest(l, v) +} diff --git a/openrtb/native/request/eventtracker_easyjson.go b/openrtb/native/request/eventtracker_easyjson.go index e244b7c..7de6992 100644 --- a/openrtb/native/request/eventtracker_easyjson.go +++ b/openrtb/native/request/eventtracker_easyjson.go @@ -4,6 +4,7 @@ package request import ( json "encoding/json" + native "github.com/Vungle/vungo/openrtb/native" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -16,3 +17,118 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson88abeb4cDecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.Lexer, out *EventTracker) { + 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 "event": + out.Event = native.EventType(in.Int64()) + case "methods": + if in.IsNull() { + in.Skip() + out.Methods = nil + } else { + in.Delim('[') + if out.Methods == nil { + if !in.IsDelim(']') { + out.Methods = make([]native.EventTrackingMethod, 0, 8) + } else { + out.Methods = []native.EventTrackingMethod{} + } + } else { + out.Methods = (out.Methods)[:0] + } + for !in.IsDelim(']') { + var v1 native.EventTrackingMethod + v1 = native.EventTrackingMethod(in.Int64()) + out.Methods = append(out.Methods, v1) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson88abeb4cEncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter.Writer, in EventTracker) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"event\":" + out.RawString(prefix[1:]) + out.Int64(int64(in.Event)) + } + { + const prefix string = ",\"methods\":" + out.RawString(prefix) + if in.Methods == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v2, v3 := range in.Methods { + if v2 > 0 { + out.RawByte(',') + } + out.Int64(int64(v3)) + } + out.RawByte(']') + } + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v EventTracker) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson88abeb4cEncodeGithubComVungleVungoOpenrtbNativeRequest(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v EventTracker) MarshalEasyJSON(w *jwriter.Writer) { + easyjson88abeb4cEncodeGithubComVungleVungoOpenrtbNativeRequest(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *EventTracker) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson88abeb4cDecodeGithubComVungleVungoOpenrtbNativeRequest(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *EventTracker) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson88abeb4cDecodeGithubComVungleVungoOpenrtbNativeRequest(l, v) +} diff --git a/openrtb/native/request/image_easyjson.go b/openrtb/native/request/image_easyjson.go index e244b7c..392af4f 100644 --- a/openrtb/native/request/image_easyjson.go +++ b/openrtb/native/request/image_easyjson.go @@ -4,6 +4,7 @@ package request import ( json "encoding/json" + native "github.com/Vungle/vungo/openrtb/native" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -16,3 +17,175 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson220accf5DecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.Lexer, out *Image) { + 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 "type": + out.Type = native.ImageAssetType(in.Int64()) + case "w": + out.W = int64(in.Int64()) + case "wmin": + out.WMin = int64(in.Int64()) + case "h": + out.H = int64(in.Int64()) + case "hmin": + out.HMin = int64(in.Int64()) + case "mimes": + if in.IsNull() { + in.Skip() + out.MIMEs = nil + } else { + in.Delim('[') + if out.MIMEs == nil { + if !in.IsDelim(']') { + out.MIMEs = make([]string, 0, 4) + } else { + out.MIMEs = []string{} + } + } else { + out.MIMEs = (out.MIMEs)[:0] + } + for !in.IsDelim(']') { + var v1 string + v1 = string(in.String()) + out.MIMEs = append(out.MIMEs, v1) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson220accf5EncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter.Writer, in Image) { + out.RawByte('{') + first := true + _ = first + if in.Type != 0 { + const prefix string = ",\"type\":" + first = false + out.RawString(prefix[1:]) + out.Int64(int64(in.Type)) + } + if in.W != 0 { + const prefix string = ",\"w\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int64(int64(in.W)) + } + if in.WMin != 0 { + const prefix string = ",\"wmin\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int64(int64(in.WMin)) + } + if in.H != 0 { + const prefix string = ",\"h\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int64(int64(in.H)) + } + if in.HMin != 0 { + const prefix string = ",\"hmin\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int64(int64(in.HMin)) + } + if len(in.MIMEs) != 0 { + const prefix string = ",\"mimes\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v2, v3 := range in.MIMEs { + if v2 > 0 { + out.RawByte(',') + } + out.String(string(v3)) + } + out.RawByte(']') + } + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Image) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson220accf5EncodeGithubComVungleVungoOpenrtbNativeRequest(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Image) MarshalEasyJSON(w *jwriter.Writer) { + easyjson220accf5EncodeGithubComVungleVungoOpenrtbNativeRequest(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Image) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson220accf5DecodeGithubComVungleVungoOpenrtbNativeRequest(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Image) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson220accf5DecodeGithubComVungleVungoOpenrtbNativeRequest(l, v) +} diff --git a/openrtb/native/request/request_easyjson.go b/openrtb/native/request/request_easyjson.go index e244b7c..63e7329 100644 --- a/openrtb/native/request/request_easyjson.go +++ b/openrtb/native/request/request_easyjson.go @@ -4,6 +4,7 @@ package request import ( json "encoding/json" + native "github.com/Vungle/vungo/openrtb/native" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -16,3 +17,242 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson3c9d2b01DecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.Lexer, out *Request) { + 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 "ver": + out.Ver = string(in.String()) + case "context": + out.Context = native.ContextType(in.Int64()) + case "contextsubtype": + out.ContextSubType = native.ContextSubType(in.Int64()) + case "plcmttype": + out.PlacementType = native.PlacementType(in.Int64()) + case "plcmtcnt": + out.PlacementCnt = int64(in.Int64()) + case "seq": + out.Seq = int64(in.Int64()) + case "assets": + if in.IsNull() { + in.Skip() + out.Assets = nil + } else { + in.Delim('[') + if out.Assets == nil { + if !in.IsDelim(']') { + out.Assets = make([]Asset, 0, 0) + } else { + out.Assets = []Asset{} + } + } else { + out.Assets = (out.Assets)[:0] + } + for !in.IsDelim(']') { + var v1 Asset + (v1).UnmarshalEasyJSON(in) + out.Assets = append(out.Assets, v1) + in.WantComma() + } + in.Delim(']') + } + case "aurlsupport": + out.AURLSupport = int8(in.Int8()) + case "durlsupport": + out.DURLSupport = int8(in.Int8()) + case "eventtrackers": + if in.IsNull() { + in.Skip() + out.EventTrackers = nil + } else { + in.Delim('[') + if out.EventTrackers == nil { + if !in.IsDelim(']') { + out.EventTrackers = make([]EventTracker, 0, 1) + } else { + out.EventTrackers = []EventTracker{} + } + } else { + out.EventTrackers = (out.EventTrackers)[:0] + } + for !in.IsDelim(']') { + var v2 EventTracker + (v2).UnmarshalEasyJSON(in) + out.EventTrackers = append(out.EventTrackers, v2) + in.WantComma() + } + in.Delim(']') + } + case "privacy": + out.Privacy = int8(in.Int8()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3c9d2b01EncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter.Writer, in Request) { + out.RawByte('{') + first := true + _ = first + if in.Ver != "" { + const prefix string = ",\"ver\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.Ver)) + } + if in.Context != 0 { + const prefix string = ",\"context\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int64(int64(in.Context)) + } + if in.ContextSubType != 0 { + const prefix string = ",\"contextsubtype\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int64(int64(in.ContextSubType)) + } + if in.PlacementType != 0 { + const prefix string = ",\"plcmttype\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int64(int64(in.PlacementType)) + } + if in.PlacementCnt != 0 { + const prefix string = ",\"plcmtcnt\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int64(int64(in.PlacementCnt)) + } + if in.Seq != 0 { + const prefix string = ",\"seq\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int64(int64(in.Seq)) + } + { + const prefix string = ",\"assets\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + if in.Assets == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v3, v4 := range in.Assets { + if v3 > 0 { + out.RawByte(',') + } + (v4).MarshalEasyJSON(out) + } + out.RawByte(']') + } + } + if in.AURLSupport != 0 { + const prefix string = ",\"aurlsupport\":" + out.RawString(prefix) + out.Int8(int8(in.AURLSupport)) + } + if in.DURLSupport != 0 { + const prefix string = ",\"durlsupport\":" + out.RawString(prefix) + out.Int8(int8(in.DURLSupport)) + } + if len(in.EventTrackers) != 0 { + const prefix string = ",\"eventtrackers\":" + out.RawString(prefix) + { + out.RawByte('[') + for v5, v6 := range in.EventTrackers { + if v5 > 0 { + out.RawByte(',') + } + (v6).MarshalEasyJSON(out) + } + out.RawByte(']') + } + } + if in.Privacy != 0 { + const prefix string = ",\"privacy\":" + out.RawString(prefix) + out.Int8(int8(in.Privacy)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Request) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3c9d2b01EncodeGithubComVungleVungoOpenrtbNativeRequest(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Request) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3c9d2b01EncodeGithubComVungleVungoOpenrtbNativeRequest(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Request) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3c9d2b01DecodeGithubComVungleVungoOpenrtbNativeRequest(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Request) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3c9d2b01DecodeGithubComVungleVungoOpenrtbNativeRequest(l, v) +} diff --git a/openrtb/native/request/title_easyjson.go b/openrtb/native/request/title_easyjson.go index e244b7c..facfbf0 100644 --- a/openrtb/native/request/title_easyjson.go +++ b/openrtb/native/request/title_easyjson.go @@ -16,3 +16,79 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjsonE7952480DecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.Lexer, out *Title) { + 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 "len": + out.Len = int64(in.Int64()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonE7952480EncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter.Writer, in Title) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"len\":" + out.RawString(prefix[1:]) + out.Int64(int64(in.Len)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Title) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonE7952480EncodeGithubComVungleVungoOpenrtbNativeRequest(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Title) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonE7952480EncodeGithubComVungleVungoOpenrtbNativeRequest(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Title) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonE7952480DecodeGithubComVungleVungoOpenrtbNativeRequest(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Title) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonE7952480DecodeGithubComVungleVungoOpenrtbNativeRequest(l, v) +} diff --git a/openrtb/native/request/video_easyjson.go b/openrtb/native/request/video_easyjson.go index e244b7c..408a25d 100644 --- a/openrtb/native/request/video_easyjson.go +++ b/openrtb/native/request/video_easyjson.go @@ -4,6 +4,7 @@ package request import ( json "encoding/json" + openrtb "github.com/Vungle/vungo/openrtb" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -16,3 +17,164 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtbNativeRequest(in *jlexer.Lexer, out *Video) { + 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 "mimes": + if in.IsNull() { + in.Skip() + out.MIMEs = nil + } else { + in.Delim('[') + if out.MIMEs == nil { + if !in.IsDelim(']') { + out.MIMEs = make([]string, 0, 4) + } else { + out.MIMEs = []string{} + } + } else { + out.MIMEs = (out.MIMEs)[:0] + } + for !in.IsDelim(']') { + var v1 string + v1 = string(in.String()) + out.MIMEs = append(out.MIMEs, v1) + in.WantComma() + } + in.Delim(']') + } + case "minduration": + out.MinDuration = int64(in.Int64()) + case "maxduration": + out.MaxDuration = int64(in.Int64()) + case "protocols": + if in.IsNull() { + in.Skip() + out.Protocols = nil + } else { + in.Delim('[') + if out.Protocols == nil { + if !in.IsDelim(']') { + out.Protocols = make([]openrtb.Protocol, 0, 8) + } else { + out.Protocols = []openrtb.Protocol{} + } + } else { + out.Protocols = (out.Protocols)[:0] + } + for !in.IsDelim(']') { + var v2 openrtb.Protocol + v2 = openrtb.Protocol(in.Int()) + out.Protocols = append(out.Protocols, v2) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtbNativeRequest(out *jwriter.Writer, in Video) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"mimes\":" + out.RawString(prefix[1:]) + if in.MIMEs == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v3, v4 := range in.MIMEs { + if v3 > 0 { + out.RawByte(',') + } + out.String(string(v4)) + } + out.RawByte(']') + } + } + { + const prefix string = ",\"minduration\":" + out.RawString(prefix) + out.Int64(int64(in.MinDuration)) + } + { + const prefix string = ",\"maxduration\":" + out.RawString(prefix) + out.Int64(int64(in.MaxDuration)) + } + { + const prefix string = ",\"protocols\":" + out.RawString(prefix) + if in.Protocols == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v5, v6 := range in.Protocols { + if v5 > 0 { + out.RawByte(',') + } + out.Int(int(v6)) + } + out.RawByte(']') + } + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Video) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtbNativeRequest(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Video) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtbNativeRequest(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Video) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtbNativeRequest(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Video) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtbNativeRequest(l, v) +} diff --git a/openrtb/native/response/asset_easyjson.go b/openrtb/native/response/asset_easyjson.go index 813a70c..13b45aa 100644 --- a/openrtb/native/response/asset_easyjson.go +++ b/openrtb/native/response/asset_easyjson.go @@ -4,6 +4,7 @@ package response import ( json "encoding/json" + native "github.com/Vungle/vungo/openrtb/native" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -16,3 +17,546 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer.Lexer, out *Asset) { + 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 "id": + out.ID = int64(in.Int64()) + case "required": + out.Required = int8(in.Int8()) + case "title": + if in.IsNull() { + in.Skip() + out.Title = nil + } else { + if out.Title == nil { + out.Title = new(Title) + } + easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse1(in, out.Title) + } + case "img": + if in.IsNull() { + in.Skip() + out.Img = nil + } else { + if out.Img == nil { + out.Img = new(Image) + } + easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse2(in, out.Img) + } + case "video": + if in.IsNull() { + in.Skip() + out.Video = nil + } else { + if out.Video == nil { + out.Video = new(Video) + } + easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse3(in, out.Video) + } + case "data": + if in.IsNull() { + in.Skip() + out.Data = nil + } else { + if out.Data == nil { + out.Data = new(Data) + } + easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse4(in, out.Data) + } + case "link": + if in.IsNull() { + in.Skip() + out.Link = nil + } else { + if out.Link == nil { + out.Link = new(Link) + } + easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse5(in, out.Link) + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwriter.Writer, in Asset) { + out.RawByte('{') + first := true + _ = first + if in.ID != 0 { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.Int64(int64(in.ID)) + } + if in.Required != 0 { + const prefix string = ",\"required\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int8(int8(in.Required)) + } + if in.Title != nil { + const prefix string = ",\"title\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse1(out, *in.Title) + } + if in.Img != nil { + const prefix string = ",\"img\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse2(out, *in.Img) + } + if in.Video != nil { + const prefix string = ",\"video\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse3(out, *in.Video) + } + if in.Data != nil { + const prefix string = ",\"data\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse4(out, *in.Data) + } + if in.Link != nil { + const prefix string = ",\"link\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse5(out, *in.Link) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Asset) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Asset) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Asset) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Asset) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse(l, v) +} +func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse5(in *jlexer.Lexer, out *Link) { + 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 "url": + out.URL = string(in.String()) + case "clicktrackers": + if in.IsNull() { + in.Skip() + out.ClickTrackers = nil + } else { + in.Delim('[') + if out.ClickTrackers == nil { + if !in.IsDelim(']') { + out.ClickTrackers = make([]string, 0, 4) + } else { + out.ClickTrackers = []string{} + } + } else { + out.ClickTrackers = (out.ClickTrackers)[:0] + } + for !in.IsDelim(']') { + var v1 string + v1 = string(in.String()) + out.ClickTrackers = append(out.ClickTrackers, v1) + in.WantComma() + } + in.Delim(']') + } + case "fallback": + out.Fallback = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse5(out *jwriter.Writer, in Link) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"url\":" + out.RawString(prefix[1:]) + out.String(string(in.URL)) + } + if len(in.ClickTrackers) != 0 { + const prefix string = ",\"clicktrackers\":" + out.RawString(prefix) + { + out.RawByte('[') + for v2, v3 := range in.ClickTrackers { + if v2 > 0 { + out.RawByte(',') + } + out.String(string(v3)) + } + out.RawByte(']') + } + } + if in.Fallback != "" { + const prefix string = ",\"fallback\":" + out.RawString(prefix) + out.String(string(in.Fallback)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse4(in *jlexer.Lexer, out *Data) { + 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 "type": + out.Type = native.DataAssetType(in.Int64()) + case "len": + out.Len = int64(in.Int64()) + case "value": + out.Value = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse4(out *jwriter.Writer, in Data) { + out.RawByte('{') + first := true + _ = first + if in.Type != 0 { + const prefix string = ",\"type\":" + first = false + out.RawString(prefix[1:]) + out.Int64(int64(in.Type)) + } + if in.Len != 0 { + const prefix string = ",\"len\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int64(int64(in.Len)) + } + { + const prefix string = ",\"value\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Value)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse3(in *jlexer.Lexer, out *Video) { + 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 "vasttag": + out.VASTTag = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse3(out *jwriter.Writer, in Video) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"vasttag\":" + out.RawString(prefix[1:]) + out.String(string(in.VASTTag)) + } + out.RawByte('}') +} +func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse2(in *jlexer.Lexer, out *Image) { + 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 "type": + out.Type = native.ImageAssetType(in.Int64()) + case "url": + out.URL = string(in.String()) + case "w": + out.W = int64(in.Int64()) + case "h": + out.H = int64(in.Int64()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse2(out *jwriter.Writer, in Image) { + out.RawByte('{') + first := true + _ = first + if in.Type != 0 { + const prefix string = ",\"type\":" + first = false + out.RawString(prefix[1:]) + out.Int64(int64(in.Type)) + } + { + const prefix string = ",\"url\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.URL)) + } + if in.W != 0 { + const prefix string = ",\"w\":" + out.RawString(prefix) + out.Int64(int64(in.W)) + } + if in.H != 0 { + const prefix string = ",\"h\":" + out.RawString(prefix) + out.Int64(int64(in.H)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} +func easyjson3b94576aDecodeGithubComVungleVungoOpenrtbNativeResponse1(in *jlexer.Lexer, out *Title) { + 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 "text": + out.Text = string(in.String()) + case "len": + out.Len = int64(in.Int64()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3b94576aEncodeGithubComVungleVungoOpenrtbNativeResponse1(out *jwriter.Writer, in Title) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"text\":" + out.RawString(prefix[1:]) + out.String(string(in.Text)) + } + if in.Len != 0 { + const prefix string = ",\"len\":" + out.RawString(prefix) + out.Int64(int64(in.Len)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} diff --git a/openrtb/native/response/data_easyjson.go b/openrtb/native/response/data_easyjson.go index 813a70c..c76d82f 100644 --- a/openrtb/native/response/data_easyjson.go +++ b/openrtb/native/response/data_easyjson.go @@ -4,6 +4,7 @@ package response import ( json "encoding/json" + native "github.com/Vungle/vungo/openrtb/native" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -16,3 +17,104 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson794297d0DecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer.Lexer, out *Data) { + 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 "type": + out.Type = native.DataAssetType(in.Int64()) + case "len": + out.Len = int64(in.Int64()) + case "value": + out.Value = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson794297d0EncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwriter.Writer, in Data) { + out.RawByte('{') + first := true + _ = first + if in.Type != 0 { + const prefix string = ",\"type\":" + first = false + out.RawString(prefix[1:]) + out.Int64(int64(in.Type)) + } + if in.Len != 0 { + const prefix string = ",\"len\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int64(int64(in.Len)) + } + { + const prefix string = ",\"value\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Value)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Data) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson794297d0EncodeGithubComVungleVungoOpenrtbNativeResponse(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Data) MarshalEasyJSON(w *jwriter.Writer) { + easyjson794297d0EncodeGithubComVungleVungoOpenrtbNativeResponse(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Data) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson794297d0DecodeGithubComVungleVungoOpenrtbNativeResponse(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Data) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson794297d0DecodeGithubComVungleVungoOpenrtbNativeResponse(l, v) +} diff --git a/openrtb/native/response/eventtracker_easyjson.go b/openrtb/native/response/eventtracker_easyjson.go index 813a70c..8fb0c18 100644 --- a/openrtb/native/response/eventtracker_easyjson.go +++ b/openrtb/native/response/eventtracker_easyjson.go @@ -4,6 +4,7 @@ package response import ( json "encoding/json" + native "github.com/Vungle/vungo/openrtb/native" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -16,3 +17,102 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson88abeb4cDecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer.Lexer, out *EventTracker) { + 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 "event": + out.Event = native.EventType(in.Int64()) + case "method": + out.Method = native.EventTrackingMethod(in.Int64()) + case "url": + out.URL = string(in.String()) + case "customdata": + if data := in.Raw(); in.Ok() { + in.AddError((out.CustomData).UnmarshalJSON(data)) + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson88abeb4cEncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwriter.Writer, in EventTracker) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"event\":" + out.RawString(prefix[1:]) + out.Int64(int64(in.Event)) + } + { + const prefix string = ",\"method\":" + out.RawString(prefix) + out.Int64(int64(in.Method)) + } + if in.URL != "" { + const prefix string = ",\"url\":" + out.RawString(prefix) + out.String(string(in.URL)) + } + if len(in.CustomData) != 0 { + const prefix string = ",\"customdata\":" + out.RawString(prefix) + out.Raw((in.CustomData).MarshalJSON()) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v EventTracker) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson88abeb4cEncodeGithubComVungleVungoOpenrtbNativeResponse(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v EventTracker) MarshalEasyJSON(w *jwriter.Writer) { + easyjson88abeb4cEncodeGithubComVungleVungoOpenrtbNativeResponse(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *EventTracker) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson88abeb4cDecodeGithubComVungleVungoOpenrtbNativeResponse(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *EventTracker) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson88abeb4cDecodeGithubComVungleVungoOpenrtbNativeResponse(l, v) +} diff --git a/openrtb/native/response/image_easyjson.go b/openrtb/native/response/image_easyjson.go index 813a70c..4bde872 100644 --- a/openrtb/native/response/image_easyjson.go +++ b/openrtb/native/response/image_easyjson.go @@ -4,6 +4,7 @@ package response import ( json "encoding/json" + native "github.com/Vungle/vungo/openrtb/native" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -16,3 +17,106 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson220accf5DecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer.Lexer, out *Image) { + 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 "type": + out.Type = native.ImageAssetType(in.Int64()) + case "url": + out.URL = string(in.String()) + case "w": + out.W = int64(in.Int64()) + case "h": + out.H = int64(in.Int64()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson220accf5EncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwriter.Writer, in Image) { + out.RawByte('{') + first := true + _ = first + if in.Type != 0 { + const prefix string = ",\"type\":" + first = false + out.RawString(prefix[1:]) + out.Int64(int64(in.Type)) + } + { + const prefix string = ",\"url\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.URL)) + } + if in.W != 0 { + const prefix string = ",\"w\":" + out.RawString(prefix) + out.Int64(int64(in.W)) + } + if in.H != 0 { + const prefix string = ",\"h\":" + out.RawString(prefix) + out.Int64(int64(in.H)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Image) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson220accf5EncodeGithubComVungleVungoOpenrtbNativeResponse(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Image) MarshalEasyJSON(w *jwriter.Writer) { + easyjson220accf5EncodeGithubComVungleVungoOpenrtbNativeResponse(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Image) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson220accf5DecodeGithubComVungleVungoOpenrtbNativeResponse(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Image) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson220accf5DecodeGithubComVungleVungoOpenrtbNativeResponse(l, v) +} diff --git a/openrtb/native/response/link_easyjson.go b/openrtb/native/response/link_easyjson.go index 813a70c..e1c015c 100644 --- a/openrtb/native/response/link_easyjson.go +++ b/openrtb/native/response/link_easyjson.go @@ -16,3 +16,123 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson16eb09bcDecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer.Lexer, out *Link) { + 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 "url": + out.URL = string(in.String()) + case "clicktrackers": + if in.IsNull() { + in.Skip() + out.ClickTrackers = nil + } else { + in.Delim('[') + if out.ClickTrackers == nil { + if !in.IsDelim(']') { + out.ClickTrackers = make([]string, 0, 4) + } else { + out.ClickTrackers = []string{} + } + } else { + out.ClickTrackers = (out.ClickTrackers)[:0] + } + for !in.IsDelim(']') { + var v1 string + v1 = string(in.String()) + out.ClickTrackers = append(out.ClickTrackers, v1) + in.WantComma() + } + in.Delim(']') + } + case "fallback": + out.Fallback = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson16eb09bcEncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwriter.Writer, in Link) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"url\":" + out.RawString(prefix[1:]) + out.String(string(in.URL)) + } + if len(in.ClickTrackers) != 0 { + const prefix string = ",\"clicktrackers\":" + out.RawString(prefix) + { + out.RawByte('[') + for v2, v3 := range in.ClickTrackers { + if v2 > 0 { + out.RawByte(',') + } + out.String(string(v3)) + } + out.RawByte(']') + } + } + if in.Fallback != "" { + const prefix string = ",\"fallback\":" + out.RawString(prefix) + out.String(string(in.Fallback)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Link) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson16eb09bcEncodeGithubComVungleVungoOpenrtbNativeResponse(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Link) MarshalEasyJSON(w *jwriter.Writer) { + easyjson16eb09bcEncodeGithubComVungleVungoOpenrtbNativeResponse(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Link) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson16eb09bcDecodeGithubComVungleVungoOpenrtbNativeResponse(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Link) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson16eb09bcDecodeGithubComVungleVungoOpenrtbNativeResponse(l, v) +} diff --git a/openrtb/native/response/response_easyjson.go b/openrtb/native/response/response_easyjson.go index 813a70c..7a54cd9 100644 --- a/openrtb/native/response/response_easyjson.go +++ b/openrtb/native/response/response_easyjson.go @@ -16,3 +16,246 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson6ff3ac1dDecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer.Lexer, out *Response) { + 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 "ver": + out.Ver = string(in.String()) + case "assets": + if in.IsNull() { + in.Skip() + out.Assets = nil + } else { + in.Delim('[') + if out.Assets == nil { + if !in.IsDelim(']') { + out.Assets = make([]Asset, 0, 0) + } else { + out.Assets = []Asset{} + } + } else { + out.Assets = (out.Assets)[:0] + } + for !in.IsDelim(']') { + var v1 Asset + (v1).UnmarshalEasyJSON(in) + out.Assets = append(out.Assets, v1) + in.WantComma() + } + in.Delim(']') + } + case "assetsurl": + out.AssetsURL = string(in.String()) + case "dcourl": + out.DCOURL = string(in.String()) + case "link": + (out.Link).UnmarshalEasyJSON(in) + case "imptrackers": + if in.IsNull() { + in.Skip() + out.ImpTrackers = nil + } else { + in.Delim('[') + if out.ImpTrackers == nil { + if !in.IsDelim(']') { + out.ImpTrackers = make([]string, 0, 4) + } else { + out.ImpTrackers = []string{} + } + } else { + out.ImpTrackers = (out.ImpTrackers)[:0] + } + for !in.IsDelim(']') { + var v2 string + v2 = string(in.String()) + out.ImpTrackers = append(out.ImpTrackers, v2) + in.WantComma() + } + in.Delim(']') + } + case "jstracker": + out.JSTracker = string(in.String()) + case "eventtrackers": + if in.IsNull() { + in.Skip() + out.EventTrackers = nil + } else { + in.Delim('[') + if out.EventTrackers == nil { + if !in.IsDelim(']') { + out.EventTrackers = make([]EventTracker, 0, 0) + } else { + out.EventTrackers = []EventTracker{} + } + } else { + out.EventTrackers = (out.EventTrackers)[:0] + } + for !in.IsDelim(']') { + var v3 EventTracker + (v3).UnmarshalEasyJSON(in) + out.EventTrackers = append(out.EventTrackers, v3) + in.WantComma() + } + in.Delim(']') + } + case "privacy": + out.Privacy = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson6ff3ac1dEncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwriter.Writer, in Response) { + out.RawByte('{') + first := true + _ = first + if in.Ver != "" { + const prefix string = ",\"ver\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.Ver)) + } + if len(in.Assets) != 0 { + const prefix string = ",\"assets\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v4, v5 := range in.Assets { + if v4 > 0 { + out.RawByte(',') + } + (v5).MarshalEasyJSON(out) + } + out.RawByte(']') + } + } + if in.AssetsURL != "" { + const prefix string = ",\"assetsurl\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.AssetsURL)) + } + if in.DCOURL != "" { + const prefix string = ",\"dcourl\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.DCOURL)) + } + { + const prefix string = ",\"link\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + (in.Link).MarshalEasyJSON(out) + } + if len(in.ImpTrackers) != 0 { + const prefix string = ",\"imptrackers\":" + out.RawString(prefix) + { + out.RawByte('[') + for v6, v7 := range in.ImpTrackers { + if v6 > 0 { + out.RawByte(',') + } + out.String(string(v7)) + } + out.RawByte(']') + } + } + if in.JSTracker != "" { + const prefix string = ",\"jstracker\":" + out.RawString(prefix) + out.String(string(in.JSTracker)) + } + if len(in.EventTrackers) != 0 { + const prefix string = ",\"eventtrackers\":" + out.RawString(prefix) + { + out.RawByte('[') + for v8, v9 := range in.EventTrackers { + if v8 > 0 { + out.RawByte(',') + } + (v9).MarshalEasyJSON(out) + } + out.RawByte(']') + } + } + if in.Privacy != "" { + const prefix string = ",\"privacy\":" + out.RawString(prefix) + out.String(string(in.Privacy)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Response) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson6ff3ac1dEncodeGithubComVungleVungoOpenrtbNativeResponse(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Response) MarshalEasyJSON(w *jwriter.Writer) { + easyjson6ff3ac1dEncodeGithubComVungleVungoOpenrtbNativeResponse(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Response) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson6ff3ac1dDecodeGithubComVungleVungoOpenrtbNativeResponse(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Response) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson6ff3ac1dDecodeGithubComVungleVungoOpenrtbNativeResponse(l, v) +} diff --git a/openrtb/native/response/title_easyjson.go b/openrtb/native/response/title_easyjson.go index 813a70c..473a536 100644 --- a/openrtb/native/response/title_easyjson.go +++ b/openrtb/native/response/title_easyjson.go @@ -16,3 +16,86 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjsonE7952480DecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer.Lexer, out *Title) { + 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 "text": + out.Text = string(in.String()) + case "len": + out.Len = int64(in.Int64()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonE7952480EncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwriter.Writer, in Title) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"text\":" + out.RawString(prefix[1:]) + out.String(string(in.Text)) + } + if in.Len != 0 { + const prefix string = ",\"len\":" + out.RawString(prefix) + out.Int64(int64(in.Len)) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Title) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonE7952480EncodeGithubComVungleVungoOpenrtbNativeResponse(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Title) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonE7952480EncodeGithubComVungleVungoOpenrtbNativeResponse(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Title) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonE7952480DecodeGithubComVungleVungoOpenrtbNativeResponse(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Title) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonE7952480DecodeGithubComVungleVungoOpenrtbNativeResponse(l, v) +} diff --git a/openrtb/native/response/video_easyjson.go b/openrtb/native/response/video_easyjson.go index 813a70c..bf2adb0 100644 --- a/openrtb/native/response/video_easyjson.go +++ b/openrtb/native/response/video_easyjson.go @@ -16,3 +16,70 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtbNativeResponse(in *jlexer.Lexer, out *Video) { + 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 "vasttag": + out.VASTTag = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtbNativeResponse(out *jwriter.Writer, in Video) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"vasttag\":" + out.RawString(prefix[1:]) + out.String(string(in.VASTTag)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Video) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtbNativeResponse(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Video) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtbNativeResponse(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Video) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtbNativeResponse(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Video) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtbNativeResponse(l, v) +} diff --git a/openrtb/native_easyjson.go b/openrtb/native_easyjson.go index 793d66c..cba003f 100644 --- a/openrtb/native_easyjson.go +++ b/openrtb/native_easyjson.go @@ -16,3 +16,160 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson3eeb1cddDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Native) { + 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 "request": + out.Request = string(in.String()) + case "ver": + out.Version = string(in.String()) + case "api": + if in.IsNull() { + in.Skip() + out.APIFrameworks = nil + } else { + in.Delim('[') + if out.APIFrameworks == nil { + if !in.IsDelim(']') { + out.APIFrameworks = make([]APIFramework, 0, 8) + } else { + out.APIFrameworks = []APIFramework{} + } + } else { + out.APIFrameworks = (out.APIFrameworks)[:0] + } + for !in.IsDelim(']') { + var v1 APIFramework + v1 = APIFramework(in.Int()) + out.APIFrameworks = append(out.APIFrameworks, v1) + in.WantComma() + } + in.Delim(']') + } + case "battr": + if in.IsNull() { + in.Skip() + out.BlockedCreativeAttributes = nil + } else { + in.Delim('[') + if out.BlockedCreativeAttributes == nil { + if !in.IsDelim(']') { + out.BlockedCreativeAttributes = make([]CreativeAttribute, 0, 8) + } else { + out.BlockedCreativeAttributes = []CreativeAttribute{} + } + } else { + out.BlockedCreativeAttributes = (out.BlockedCreativeAttributes)[:0] + } + for !in.IsDelim(']') { + var v2 CreativeAttribute + v2 = CreativeAttribute(in.Int()) + out.BlockedCreativeAttributes = append(out.BlockedCreativeAttributes, v2) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3eeb1cddEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Native) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"request\":" + out.RawString(prefix[1:]) + out.String(string(in.Request)) + } + if in.Version != "" { + const prefix string = ",\"ver\":" + out.RawString(prefix) + out.String(string(in.Version)) + } + if len(in.APIFrameworks) != 0 { + const prefix string = ",\"api\":" + out.RawString(prefix) + { + out.RawByte('[') + for v3, v4 := range in.APIFrameworks { + if v3 > 0 { + out.RawByte(',') + } + out.Int(int(v4)) + } + out.RawByte(']') + } + } + if len(in.BlockedCreativeAttributes) != 0 { + const prefix string = ",\"battr\":" + out.RawString(prefix) + { + out.RawByte('[') + for v5, v6 := range in.BlockedCreativeAttributes { + if v5 > 0 { + out.RawByte(',') + } + out.Int(int(v6)) + } + out.RawByte(']') + } + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Native) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3eeb1cddEncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Native) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3eeb1cddEncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Native) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3eeb1cddDecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Native) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3eeb1cddDecodeGithubComVungleVungoOpenrtb(l, v) +} diff --git a/openrtb/privatemarketplace_easyjson.go b/openrtb/privatemarketplace_easyjson.go index 793d66c..b192423 100644 --- a/openrtb/privatemarketplace_easyjson.go +++ b/openrtb/privatemarketplace_easyjson.go @@ -16,3 +16,132 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjsonE1675e4eDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *PrivateMarketplace) { + 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 "private_auction": + if data := in.Raw(); in.Ok() { + in.AddError((out.IsPrivateAuction).UnmarshalJSON(data)) + } + case "deals": + if in.IsNull() { + in.Skip() + out.Deals = nil + } else { + in.Delim('[') + if out.Deals == nil { + if !in.IsDelim(']') { + out.Deals = make([]*Deal, 0, 8) + } else { + out.Deals = []*Deal{} + } + } else { + out.Deals = (out.Deals)[:0] + } + for !in.IsDelim(']') { + var v1 *Deal + if in.IsNull() { + in.Skip() + v1 = nil + } else { + if v1 == nil { + v1 = new(Deal) + } + (*v1).UnmarshalEasyJSON(in) + } + out.Deals = append(out.Deals, v1) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonE1675e4eEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in PrivateMarketplace) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"private_auction\":" + out.RawString(prefix[1:]) + out.Raw((in.IsPrivateAuction).MarshalJSON()) + } + { + const prefix string = ",\"deals\":" + out.RawString(prefix) + if in.Deals == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v2, v3 := range in.Deals { + if v2 > 0 { + out.RawByte(',') + } + if v3 == nil { + out.RawString("null") + } else { + (*v3).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v PrivateMarketplace) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonE1675e4eEncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v PrivateMarketplace) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonE1675e4eEncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *PrivateMarketplace) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonE1675e4eDecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *PrivateMarketplace) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonE1675e4eDecodeGithubComVungleVungoOpenrtb(l, v) +} diff --git a/openrtb/producer_easyjson.go b/openrtb/producer_easyjson.go index 793d66c..c9f0d7c 100644 --- a/openrtb/producer_easyjson.go +++ b/openrtb/producer_easyjson.go @@ -16,3 +16,151 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson92a4b12aDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Producer) { + 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 "id": + out.ID = string(in.String()) + case "name": + out.Name = string(in.String()) + case "cat": + if in.IsNull() { + in.Skip() + out.Cat = nil + } else { + in.Delim('[') + if out.Cat == nil { + if !in.IsDelim(']') { + out.Cat = make([]string, 0, 4) + } else { + out.Cat = []string{} + } + } else { + out.Cat = (out.Cat)[:0] + } + for !in.IsDelim(']') { + var v1 string + v1 = string(in.String()) + out.Cat = append(out.Cat, v1) + in.WantComma() + } + in.Delim(']') + } + case "domain": + out.Domain = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson92a4b12aEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Producer) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Name != "" { + const prefix string = ",\"name\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Name)) + } + if len(in.Cat) != 0 { + const prefix string = ",\"cat\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v2, v3 := range in.Cat { + if v2 > 0 { + out.RawByte(',') + } + out.String(string(v3)) + } + out.RawByte(']') + } + } + if in.Domain != "" { + const prefix string = ",\"domain\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Domain)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Producer) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson92a4b12aEncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Producer) MarshalEasyJSON(w *jwriter.Writer) { + easyjson92a4b12aEncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Producer) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson92a4b12aDecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Producer) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson92a4b12aDecodeGithubComVungleVungoOpenrtb(l, v) +} diff --git a/openrtb/publisher_easyjson.go b/openrtb/publisher_easyjson.go index 793d66c..9d8f91c 100644 --- a/openrtb/publisher_easyjson.go +++ b/openrtb/publisher_easyjson.go @@ -16,3 +16,121 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjsonE9046362DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Publisher) { + 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 "id": + out.ID = string(in.String()) + case "name": + out.Name = string(in.String()) + case "cat": + if in.IsNull() { + in.Skip() + out.Categories = nil + } else { + in.Delim('[') + if out.Categories == nil { + if !in.IsDelim(']') { + out.Categories = make([]Category, 0, 4) + } else { + out.Categories = []Category{} + } + } else { + out.Categories = (out.Categories)[:0] + } + for !in.IsDelim(']') { + var v1 Category + v1 = Category(in.String()) + out.Categories = append(out.Categories, v1) + in.WantComma() + } + in.Delim(']') + } + case "domain": + out.Domain = string(in.String()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonE9046362EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Publisher) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"id\":" + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Name != "" { + const prefix string = ",\"name\":" + out.RawString(prefix) + out.String(string(in.Name)) + } + if len(in.Categories) != 0 { + const prefix string = ",\"cat\":" + out.RawString(prefix) + { + out.RawByte('[') + for v2, v3 := range in.Categories { + if v2 > 0 { + out.RawByte(',') + } + out.String(string(v3)) + } + out.RawByte(']') + } + } + if in.Domain != "" { + const prefix string = ",\"domain\":" + out.RawString(prefix) + out.String(string(in.Domain)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Publisher) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonE9046362EncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Publisher) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonE9046362EncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Publisher) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonE9046362DecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Publisher) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonE9046362DecodeGithubComVungleVungoOpenrtb(l, v) +} diff --git a/openrtb/regulation_easyjson.go b/openrtb/regulation_easyjson.go index 793d66c..3a50ce9 100644 --- a/openrtb/regulation_easyjson.go +++ b/openrtb/regulation_easyjson.go @@ -16,3 +16,95 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson1db63384DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Regulation) { + 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 "coppa": + if in.IsNull() { + in.Skip() + out.IsCoppaCompliant = nil + } else { + if out.IsCoppaCompliant == nil { + out.IsCoppaCompliant = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.IsCoppaCompliant).UnmarshalJSON(data)) + } + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson1db63384EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Regulation) { + out.RawByte('{') + first := true + _ = first + if in.IsCoppaCompliant != nil { + const prefix string = ",\"coppa\":" + first = false + out.RawString(prefix[1:]) + out.Raw((*in.IsCoppaCompliant).MarshalJSON()) + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Regulation) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson1db63384EncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Regulation) MarshalEasyJSON(w *jwriter.Writer) { + easyjson1db63384EncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Regulation) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson1db63384DecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Regulation) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson1db63384DecodeGithubComVungleVungoOpenrtb(l, v) +} diff --git a/openrtb/seatbid_easyjson.go b/openrtb/seatbid_easyjson.go index 793d66c..f594c1b 100644 --- a/openrtb/seatbid_easyjson.go +++ b/openrtb/seatbid_easyjson.go @@ -16,3 +16,137 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson526ccff2DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *SeatBid) { + 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 "bid": + if in.IsNull() { + in.Skip() + out.Bids = nil + } else { + in.Delim('[') + if out.Bids == nil { + if !in.IsDelim(']') { + out.Bids = make([]*Bid, 0, 8) + } else { + out.Bids = []*Bid{} + } + } else { + out.Bids = (out.Bids)[:0] + } + for !in.IsDelim(']') { + var v1 *Bid + if in.IsNull() { + in.Skip() + v1 = nil + } else { + if v1 == nil { + v1 = new(Bid) + } + (*v1).UnmarshalEasyJSON(in) + } + out.Bids = append(out.Bids, v1) + in.WantComma() + } + in.Delim(']') + } + case "seat": + out.Seat = string(in.String()) + case "group": + out.Group = int(in.Int()) + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson526ccff2EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in SeatBid) { + out.RawByte('{') + first := true + _ = first + if len(in.Bids) != 0 { + const prefix string = ",\"bid\":" + first = false + out.RawString(prefix[1:]) + { + out.RawByte('[') + for v2, v3 := range in.Bids { + if v2 > 0 { + out.RawByte(',') + } + if v3 == nil { + out.RawString("null") + } else { + (*v3).MarshalEasyJSON(out) + } + } + out.RawByte(']') + } + } + if in.Seat != "" { + const prefix string = ",\"seat\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Seat)) + } + if in.Group != 0 { + const prefix string = ",\"group\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.Group)) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v SeatBid) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson526ccff2EncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v SeatBid) MarshalEasyJSON(w *jwriter.Writer) { + easyjson526ccff2EncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *SeatBid) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson526ccff2DecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *SeatBid) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson526ccff2DecodeGithubComVungleVungoOpenrtb(l, v) +} diff --git a/openrtb/segment_easyjson.go b/openrtb/segment_easyjson.go index 793d66c..6a1514e 100644 --- a/openrtb/segment_easyjson.go +++ b/openrtb/segment_easyjson.go @@ -16,3 +16,109 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson88ee421DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Segment) { + 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 "id": + out.ID = string(in.String()) + case "name": + out.Name = string(in.String()) + case "value": + out.Value = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson88ee421EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Segment) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Name != "" { + const prefix string = ",\"name\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Name)) + } + if in.Value != "" { + const prefix string = ",\"value\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Value)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Segment) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson88ee421EncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Segment) MarshalEasyJSON(w *jwriter.Writer) { + easyjson88ee421EncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Segment) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson88ee421DecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Segment) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson88ee421DecodeGithubComVungleVungoOpenrtb(l, v) +} diff --git a/openrtb/site_easyjson.go b/openrtb/site_easyjson.go index 793d66c..fb6f68c 100644 --- a/openrtb/site_easyjson.go +++ b/openrtb/site_easyjson.go @@ -16,3 +16,367 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjsonD9064c5DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Site) { + 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 "id": + out.ID = string(in.String()) + case "name": + out.Name = string(in.String()) + case "domain": + out.Domain = string(in.String()) + case "cat": + if in.IsNull() { + in.Skip() + out.Cat = nil + } else { + in.Delim('[') + if out.Cat == nil { + if !in.IsDelim(']') { + out.Cat = make([]string, 0, 4) + } else { + out.Cat = []string{} + } + } else { + out.Cat = (out.Cat)[:0] + } + for !in.IsDelim(']') { + var v1 string + v1 = string(in.String()) + out.Cat = append(out.Cat, v1) + in.WantComma() + } + in.Delim(']') + } + case "sectioncat": + if in.IsNull() { + in.Skip() + out.SectionCat = nil + } else { + in.Delim('[') + if out.SectionCat == nil { + if !in.IsDelim(']') { + out.SectionCat = make([]string, 0, 4) + } else { + out.SectionCat = []string{} + } + } else { + out.SectionCat = (out.SectionCat)[:0] + } + for !in.IsDelim(']') { + var v2 string + v2 = string(in.String()) + out.SectionCat = append(out.SectionCat, v2) + in.WantComma() + } + in.Delim(']') + } + case "pagecat": + if in.IsNull() { + in.Skip() + out.PageCat = nil + } else { + in.Delim('[') + if out.PageCat == nil { + if !in.IsDelim(']') { + out.PageCat = make([]string, 0, 4) + } else { + out.PageCat = []string{} + } + } else { + out.PageCat = (out.PageCat)[:0] + } + for !in.IsDelim(']') { + var v3 string + v3 = string(in.String()) + out.PageCat = append(out.PageCat, v3) + in.WantComma() + } + in.Delim(']') + } + case "page": + out.Page = string(in.String()) + case "ref": + out.Ref = string(in.String()) + case "search": + out.Search = string(in.String()) + case "mobile": + if in.IsNull() { + in.Skip() + out.Mobile = nil + } else { + if out.Mobile == nil { + out.Mobile = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.Mobile).UnmarshalJSON(data)) + } + } + case "privacypolicy": + if in.IsNull() { + in.Skip() + out.PrivacyPolicy = nil + } else { + if out.PrivacyPolicy == nil { + out.PrivacyPolicy = new(NumericBool) + } + if data := in.Raw(); in.Ok() { + in.AddError((*out.PrivacyPolicy).UnmarshalJSON(data)) + } + } + case "publisher": + if in.IsNull() { + in.Skip() + out.Publisher = nil + } else { + if out.Publisher == nil { + out.Publisher = new(Publisher) + } + (*out.Publisher).UnmarshalEasyJSON(in) + } + case "content": + if in.IsNull() { + in.Skip() + out.Content = nil + } else { + if out.Content == nil { + out.Content = new(Content) + } + (*out.Content).UnmarshalEasyJSON(in) + } + case "keywords": + out.Keywords = string(in.String()) + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Ext).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjsonD9064c5EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Site) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.Name != "" { + const prefix string = ",\"name\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Name)) + } + if in.Domain != "" { + const prefix string = ",\"domain\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Domain)) + } + if len(in.Cat) != 0 { + const prefix string = ",\"cat\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v4, v5 := range in.Cat { + if v4 > 0 { + out.RawByte(',') + } + out.String(string(v5)) + } + out.RawByte(']') + } + } + if len(in.SectionCat) != 0 { + const prefix string = ",\"sectioncat\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v6, v7 := range in.SectionCat { + if v6 > 0 { + out.RawByte(',') + } + out.String(string(v7)) + } + out.RawByte(']') + } + } + if len(in.PageCat) != 0 { + const prefix string = ",\"pagecat\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v8, v9 := range in.PageCat { + if v8 > 0 { + out.RawByte(',') + } + out.String(string(v9)) + } + out.RawByte(']') + } + } + if in.Page != "" { + const prefix string = ",\"page\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Page)) + } + if in.Ref != "" { + const prefix string = ",\"ref\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Ref)) + } + if in.Search != "" { + const prefix string = ",\"search\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Search)) + } + if in.Mobile != nil { + const prefix string = ",\"mobile\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.Mobile).MarshalJSON()) + } + if in.PrivacyPolicy != nil { + const prefix string = ",\"privacypolicy\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((*in.PrivacyPolicy).MarshalJSON()) + } + if in.Publisher != nil { + const prefix string = ",\"publisher\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + (*in.Publisher).MarshalEasyJSON(out) + } + if in.Content != nil { + const prefix string = ",\"content\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + (*in.Content).MarshalEasyJSON(out) + } + if in.Keywords != "" { + const prefix string = ",\"keywords\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Keywords)) + } + if len(in.Ext) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Ext).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Site) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjsonD9064c5EncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Site) MarshalEasyJSON(w *jwriter.Writer) { + easyjsonD9064c5EncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Site) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjsonD9064c5DecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Site) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjsonD9064c5DecodeGithubComVungleVungoOpenrtb(l, v) +} diff --git a/openrtb/user_easyjson.go b/openrtb/user_easyjson.go index 793d66c..5bf8ce7 100644 --- a/openrtb/user_easyjson.go +++ b/openrtb/user_easyjson.go @@ -16,3 +16,207 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson9e1087fdDecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *User) { + 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 "id": + out.ID = string(in.String()) + case "buyeruid": + out.BuyerID = string(in.String()) + case "yob": + out.BirthYear = int(in.Int()) + case "gender": + out.Gender = Gender(in.String()) + case "keywords": + out.Keywords = string(in.String()) + case "customdata": + out.CustomData = string(in.String()) + case "geo": + if in.IsNull() { + in.Skip() + out.Geo = nil + } else { + if out.Geo == nil { + out.Geo = new(Geo) + } + (*out.Geo).UnmarshalEasyJSON(in) + } + case "data": + if in.IsNull() { + in.Skip() + out.Data = nil + } else { + in.Delim('[') + if out.Data == nil { + if !in.IsDelim(']') { + out.Data = make([]Data, 0, 0) + } else { + out.Data = []Data{} + } + } else { + out.Data = (out.Data)[:0] + } + for !in.IsDelim(']') { + var v1 Data + (v1).UnmarshalEasyJSON(in) + out.Data = append(out.Data, v1) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson9e1087fdEncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in User) { + out.RawByte('{') + first := true + _ = first + if in.ID != "" { + const prefix string = ",\"id\":" + first = false + out.RawString(prefix[1:]) + out.String(string(in.ID)) + } + if in.BuyerID != "" { + const prefix string = ",\"buyeruid\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.BuyerID)) + } + if in.BirthYear != 0 { + const prefix string = ",\"yob\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Int(int(in.BirthYear)) + } + if in.Gender != "" { + const prefix string = ",\"gender\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Gender)) + } + if in.Keywords != "" { + const prefix string = ",\"keywords\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.Keywords)) + } + if in.CustomData != "" { + const prefix string = ",\"customdata\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.String(string(in.CustomData)) + } + if in.Geo != nil { + const prefix string = ",\"geo\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + (*in.Geo).MarshalEasyJSON(out) + } + if len(in.Data) != 0 { + const prefix string = ",\"data\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + { + out.RawByte('[') + for v2, v3 := range in.Data { + if v2 > 0 { + out.RawByte(',') + } + (v3).MarshalEasyJSON(out) + } + out.RawByte(']') + } + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + if first { + first = false + out.RawString(prefix[1:]) + } else { + out.RawString(prefix) + } + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v User) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson9e1087fdEncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v User) MarshalEasyJSON(w *jwriter.Writer) { + easyjson9e1087fdEncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *User) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson9e1087fdDecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *User) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson9e1087fdDecodeGithubComVungleVungoOpenrtb(l, v) +} diff --git a/openrtb/video_easyjson.go b/openrtb/video_easyjson.go index 793d66c..9194cd1 100644 --- a/openrtb/video_easyjson.go +++ b/openrtb/video_easyjson.go @@ -16,3 +16,522 @@ var ( _ *jwriter.Writer _ easyjson.Marshaler ) + +func easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtb(in *jlexer.Lexer, out *Video) { + 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 "mimes": + if in.IsNull() { + in.Skip() + out.MIMETypes = nil + } else { + in.Delim('[') + if out.MIMETypes == nil { + if !in.IsDelim(']') { + out.MIMETypes = make([]string, 0, 4) + } else { + out.MIMETypes = []string{} + } + } else { + out.MIMETypes = (out.MIMETypes)[:0] + } + for !in.IsDelim(']') { + var v1 string + v1 = string(in.String()) + out.MIMETypes = append(out.MIMETypes, v1) + in.WantComma() + } + in.Delim(']') + } + case "minduration": + if in.IsNull() { + in.Skip() + out.MinDuration = nil + } else { + if out.MinDuration == nil { + out.MinDuration = new(int) + } + *out.MinDuration = int(in.Int()) + } + case "maxduration": + if in.IsNull() { + in.Skip() + out.MaxDuration = nil + } else { + if out.MaxDuration == nil { + out.MaxDuration = new(int) + } + *out.MaxDuration = int(in.Int()) + } + case "protocols": + if in.IsNull() { + in.Skip() + out.Protocols = nil + } else { + in.Delim('[') + if out.Protocols == nil { + if !in.IsDelim(']') { + out.Protocols = make([]Protocol, 0, 8) + } else { + out.Protocols = []Protocol{} + } + } else { + out.Protocols = (out.Protocols)[:0] + } + for !in.IsDelim(']') { + var v2 Protocol + v2 = Protocol(in.Int()) + out.Protocols = append(out.Protocols, v2) + in.WantComma() + } + in.Delim(']') + } + case "protocol": + out.Protocol = Protocol(in.Int()) + case "w": + out.Width = int(in.Int()) + case "h": + out.Height = int(in.Int()) + case "startdelay": + if in.IsNull() { + in.Skip() + out.StartDelay = nil + } else { + if out.StartDelay == nil { + out.StartDelay = new(StartDelay) + } + *out.StartDelay = StartDelay(in.Int()) + } + case "placement": + out.PlacementType = VideoPlacementType(in.Int()) + case "linearity": + out.Linearity = Linearity(in.Int()) + case "skip": + out.Skippable = int(in.Int()) + case "skipmin": + out.SkipMin = int(in.Int()) + case "skipafter": + out.SkipAfter = int(in.Int()) + case "sequence": + out.Sequence = int(in.Int()) + case "battr": + if in.IsNull() { + in.Skip() + out.BlockedCreativeAttributes = nil + } else { + in.Delim('[') + if out.BlockedCreativeAttributes == nil { + if !in.IsDelim(']') { + out.BlockedCreativeAttributes = make([]CreativeAttribute, 0, 8) + } else { + out.BlockedCreativeAttributes = []CreativeAttribute{} + } + } else { + out.BlockedCreativeAttributes = (out.BlockedCreativeAttributes)[:0] + } + for !in.IsDelim(']') { + var v3 CreativeAttribute + v3 = CreativeAttribute(in.Int()) + out.BlockedCreativeAttributes = append(out.BlockedCreativeAttributes, v3) + in.WantComma() + } + in.Delim(']') + } + case "maxextended": + out.MaxExtendedDuration = int(in.Int()) + case "minbitrate": + out.MinBitRate = int(in.Int()) + case "maxbitrate": + out.MaxBitRate = int(in.Int()) + case "boxingallowed": + if data := in.Raw(); in.Ok() { + in.AddError((out.IsBoxingAllowed).UnmarshalJSON(data)) + } + case "playbackmethod": + if in.IsNull() { + in.Skip() + out.PlaybackMethods = nil + } else { + in.Delim('[') + if out.PlaybackMethods == nil { + if !in.IsDelim(']') { + out.PlaybackMethods = make([]PlaybackMethod, 0, 8) + } else { + out.PlaybackMethods = []PlaybackMethod{} + } + } else { + out.PlaybackMethods = (out.PlaybackMethods)[:0] + } + for !in.IsDelim(']') { + var v4 PlaybackMethod + v4 = PlaybackMethod(in.Int()) + out.PlaybackMethods = append(out.PlaybackMethods, v4) + in.WantComma() + } + in.Delim(']') + } + case "playbackend": + out.PlaybackEndEvent = PlaybackCessationMode(in.Int()) + case "delivery": + if in.IsNull() { + in.Skip() + out.DeliveryMethods = nil + } else { + in.Delim('[') + if out.DeliveryMethods == nil { + if !in.IsDelim(']') { + out.DeliveryMethods = make([]DeliveryMethod, 0, 8) + } else { + out.DeliveryMethods = []DeliveryMethod{} + } + } else { + out.DeliveryMethods = (out.DeliveryMethods)[:0] + } + for !in.IsDelim(']') { + var v5 DeliveryMethod + v5 = DeliveryMethod(in.Int()) + out.DeliveryMethods = append(out.DeliveryMethods, v5) + in.WantComma() + } + in.Delim(']') + } + case "pos": + out.Position = AdPosition(in.Int()) + case "companionad": + if in.IsNull() { + in.Skip() + out.CompanionAds = nil + } else { + in.Delim('[') + if out.CompanionAds == nil { + if !in.IsDelim(']') { + out.CompanionAds = make([]Banner, 0, 0) + } else { + out.CompanionAds = []Banner{} + } + } else { + out.CompanionAds = (out.CompanionAds)[:0] + } + for !in.IsDelim(']') { + var v6 Banner + (v6).UnmarshalEasyJSON(in) + out.CompanionAds = append(out.CompanionAds, v6) + in.WantComma() + } + in.Delim(']') + } + case "api": + if in.IsNull() { + in.Skip() + out.APIFrameworks = nil + } else { + in.Delim('[') + if out.APIFrameworks == nil { + if !in.IsDelim(']') { + out.APIFrameworks = make([]APIFramework, 0, 8) + } else { + out.APIFrameworks = []APIFramework{} + } + } else { + out.APIFrameworks = (out.APIFrameworks)[:0] + } + for !in.IsDelim(']') { + var v7 APIFramework + v7 = APIFramework(in.Int()) + out.APIFrameworks = append(out.APIFrameworks, v7) + in.WantComma() + } + in.Delim(']') + } + case "companiontype": + if in.IsNull() { + in.Skip() + out.CompanionTypes = nil + } else { + in.Delim('[') + if out.CompanionTypes == nil { + if !in.IsDelim(']') { + out.CompanionTypes = make([]CompanionType, 0, 8) + } else { + out.CompanionTypes = []CompanionType{} + } + } else { + out.CompanionTypes = (out.CompanionTypes)[:0] + } + for !in.IsDelim(']') { + var v8 CompanionType + v8 = CompanionType(in.Int()) + out.CompanionTypes = append(out.CompanionTypes, v8) + in.WantComma() + } + in.Delim(']') + } + case "ext": + if data := in.Raw(); in.Ok() { + in.AddError((out.Extension).UnmarshalJSON(data)) + } + default: + in.SkipRecursive() + } + in.WantComma() + } + in.Delim('}') + if isTopLevel { + in.Consumed() + } +} +func easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtb(out *jwriter.Writer, in Video) { + out.RawByte('{') + first := true + _ = first + { + const prefix string = ",\"mimes\":" + out.RawString(prefix[1:]) + if in.MIMETypes == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 { + out.RawString("null") + } else { + out.RawByte('[') + for v9, v10 := range in.MIMETypes { + if v9 > 0 { + out.RawByte(',') + } + out.String(string(v10)) + } + out.RawByte(']') + } + } + if in.MinDuration != nil { + const prefix string = ",\"minduration\":" + out.RawString(prefix) + out.Int(int(*in.MinDuration)) + } + if in.MaxDuration != nil { + const prefix string = ",\"maxduration\":" + out.RawString(prefix) + out.Int(int(*in.MaxDuration)) + } + if len(in.Protocols) != 0 { + const prefix string = ",\"protocols\":" + out.RawString(prefix) + { + out.RawByte('[') + for v11, v12 := range in.Protocols { + if v11 > 0 { + out.RawByte(',') + } + out.Int(int(v12)) + } + out.RawByte(']') + } + } + if in.Protocol != 0 { + const prefix string = ",\"protocol\":" + out.RawString(prefix) + out.Int(int(in.Protocol)) + } + if in.Width != 0 { + const prefix string = ",\"w\":" + out.RawString(prefix) + out.Int(int(in.Width)) + } + if in.Height != 0 { + const prefix string = ",\"h\":" + out.RawString(prefix) + out.Int(int(in.Height)) + } + if in.StartDelay != nil { + const prefix string = ",\"startdelay\":" + out.RawString(prefix) + out.Int(int(*in.StartDelay)) + } + if in.PlacementType != 0 { + const prefix string = ",\"placement\":" + out.RawString(prefix) + out.Int(int(in.PlacementType)) + } + if in.Linearity != 0 { + const prefix string = ",\"linearity\":" + out.RawString(prefix) + out.Int(int(in.Linearity)) + } + if in.Skippable != 0 { + const prefix string = ",\"skip\":" + out.RawString(prefix) + out.Int(int(in.Skippable)) + } + if in.SkipMin != 0 { + const prefix string = ",\"skipmin\":" + out.RawString(prefix) + out.Int(int(in.SkipMin)) + } + if in.SkipAfter != 0 { + const prefix string = ",\"skipafter\":" + out.RawString(prefix) + out.Int(int(in.SkipAfter)) + } + if in.Sequence != 0 { + const prefix string = ",\"sequence\":" + out.RawString(prefix) + out.Int(int(in.Sequence)) + } + if len(in.BlockedCreativeAttributes) != 0 { + const prefix string = ",\"battr\":" + out.RawString(prefix) + { + out.RawByte('[') + for v13, v14 := range in.BlockedCreativeAttributes { + if v13 > 0 { + out.RawByte(',') + } + out.Int(int(v14)) + } + out.RawByte(']') + } + } + if in.MaxExtendedDuration != 0 { + const prefix string = ",\"maxextended\":" + out.RawString(prefix) + out.Int(int(in.MaxExtendedDuration)) + } + if in.MinBitRate != 0 { + const prefix string = ",\"minbitrate\":" + out.RawString(prefix) + out.Int(int(in.MinBitRate)) + } + if in.MaxBitRate != 0 { + const prefix string = ",\"maxbitrate\":" + out.RawString(prefix) + out.Int(int(in.MaxBitRate)) + } + if in.IsBoxingAllowed { + const prefix string = ",\"boxingallowed\":" + out.RawString(prefix) + out.Raw((in.IsBoxingAllowed).MarshalJSON()) + } + if len(in.PlaybackMethods) != 0 { + const prefix string = ",\"playbackmethod\":" + out.RawString(prefix) + { + out.RawByte('[') + for v15, v16 := range in.PlaybackMethods { + if v15 > 0 { + out.RawByte(',') + } + out.Int(int(v16)) + } + out.RawByte(']') + } + } + if in.PlaybackEndEvent != 0 { + const prefix string = ",\"playbackend\":" + out.RawString(prefix) + out.Int(int(in.PlaybackEndEvent)) + } + if len(in.DeliveryMethods) != 0 { + const prefix string = ",\"delivery\":" + out.RawString(prefix) + { + out.RawByte('[') + for v17, v18 := range in.DeliveryMethods { + if v17 > 0 { + out.RawByte(',') + } + out.Int(int(v18)) + } + out.RawByte(']') + } + } + if in.Position != 0 { + const prefix string = ",\"pos\":" + out.RawString(prefix) + out.Int(int(in.Position)) + } + if len(in.CompanionAds) != 0 { + const prefix string = ",\"companionad\":" + out.RawString(prefix) + { + out.RawByte('[') + for v19, v20 := range in.CompanionAds { + if v19 > 0 { + out.RawByte(',') + } + (v20).MarshalEasyJSON(out) + } + out.RawByte(']') + } + } + if len(in.APIFrameworks) != 0 { + const prefix string = ",\"api\":" + out.RawString(prefix) + { + out.RawByte('[') + for v21, v22 := range in.APIFrameworks { + if v21 > 0 { + out.RawByte(',') + } + out.Int(int(v22)) + } + out.RawByte(']') + } + } + if len(in.CompanionTypes) != 0 { + const prefix string = ",\"companiontype\":" + out.RawString(prefix) + { + out.RawByte('[') + for v23, v24 := range in.CompanionTypes { + if v23 > 0 { + out.RawByte(',') + } + out.Int(int(v24)) + } + out.RawByte(']') + } + } + if len(in.Extension) != 0 { + const prefix string = ",\"ext\":" + out.RawString(prefix) + out.Raw((in.Extension).MarshalJSON()) + } + out.RawByte('}') +} + +// MarshalJSON supports json.Marshaler interface +func (v Video) MarshalJSON() ([]byte, error) { + w := jwriter.Writer{} + easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtb(&w, v) + return w.Buffer.BuildBytes(), w.Error +} + +// MarshalEasyJSON supports easyjson.Marshaler interface +func (v Video) MarshalEasyJSON(w *jwriter.Writer) { + easyjson3c9ce8c3EncodeGithubComVungleVungoOpenrtb(w, v) +} + +// UnmarshalJSON supports json.Unmarshaler interface +func (v *Video) UnmarshalJSON(data []byte) error { + r := jlexer.Lexer{Data: data} + easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtb(&r, v) + return r.Error() +} + +// UnmarshalEasyJSON supports easyjson.Unmarshaler interface +func (v *Video) UnmarshalEasyJSON(l *jlexer.Lexer) { + easyjson3c9ce8c3DecodeGithubComVungleVungoOpenrtb(l, v) +}