From 576d9f1aea6eb97360fc5dd13f4b92309a7c0e5b Mon Sep 17 00:00:00 2001 From: mxmCherry Date: Thu, 19 May 2022 14:08:58 +0300 Subject: [PATCH] openrtb2: extract AdInsertion enum from Bid.ssai prop --- openrtb2/ad_insertion.go | 15 +++++++++++++++ openrtb2/imp.go | 2 +- openrtb2/markup_type.go | 13 ++++++++----- 3 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 openrtb2/ad_insertion.go diff --git a/openrtb2/ad_insertion.go b/openrtb2/ad_insertion.go new file mode 100644 index 0000000..6d11ebc --- /dev/null +++ b/openrtb2/ad_insertion.go @@ -0,0 +1,15 @@ +package openrtb2 + +// SSAI indicates if server-side ad insertion (e.g., stitching an ad into an +// audio or video stream) is in use and the impact of this on asset +// and tracker retrieval. +// +// Originates from Imp.ssai property, not a separately-defined enum. +type AdInsertion int8 + +const ( + AdInsertUnknown AdInsertion = 0 // status unknown + AdInsertClient AdInsertion = 1 // all client-side (i.e., not server-side) + AdInsertServerStitchClientTrack AdInsertion = 2 // assets stitched server-side but tracking pixels fired client-side + AdInsertServer AdInsertion = 3 // all server-side +) diff --git a/openrtb2/imp.go b/openrtb2/imp.go index 3b5976b..9e0f3d0 100644 --- a/openrtb2/imp.go +++ b/openrtb2/imp.go @@ -188,7 +188,7 @@ type Imp struct { // 1 = all client-side (i.e., not server-side), // 2 = assets stitched server-side but tracking pixels fired client-side, // 3 = all server-side. - SSAI int8 `json:"ssai,omitempty"` + SSAI AdInsertion `json:"ssai,omitempty"` // Attribute: // exp diff --git a/openrtb2/markup_type.go b/openrtb2/markup_type.go index 76d7100..77c89f8 100644 --- a/openrtb2/markup_type.go +++ b/openrtb2/markup_type.go @@ -1,11 +1,14 @@ package openrtb2 -// MarkupType defines enum for creative markup type (Bid.mtype property). +// MarkupType defines the type of the creative markup so that it can properly be +// associated with the right sub-object of the BidRequest.Imp. +// +// Originates from Bid.mtype property, not a separately-defined enum. type MarkupType int8 const ( - MarkupBanner = 1 - MarkupVideo = 2 - MarkupAudio = 3 - MarkupNative = 4 + MarkupBanner MarkupType = 1 + MarkupVideo MarkupType = 2 + MarkupAudio MarkupType = 3 + MarkupNative MarkupType = 4 )