From 7b1a4ea9d4a14ac2c5879cf8c8b00cae7d8b62ec Mon Sep 17 00:00:00 2001 From: mxmCherry Date: Thu, 19 May 2022 15:45:45 +0300 Subject: [PATCH] adcom1: rename StartDelayMode -> StartDelay --- adcom1/audio_placement.go | 2 +- adcom1/start_delay.go | 25 +++++++++++++++++++++++++ adcom1/start_delay_mode.go | 25 ------------------------- adcom1/video_placement.go | 2 +- openrtb2/audio.go | 2 +- openrtb2/video.go | 2 +- 6 files changed, 29 insertions(+), 29 deletions(-) create mode 100644 adcom1/start_delay.go delete mode 100644 adcom1/start_delay_mode.go diff --git a/adcom1/audio_placement.go b/adcom1/audio_placement.go index e12e4c7..85ee02d 100644 --- a/adcom1/audio_placement.go +++ b/adcom1/audio_placement.go @@ -11,7 +11,7 @@ type AudioPlacement struct { // Definition: // Indicates the start delay in seconds for pre-roll, mid-roll, or post-roll placements. // For additional generic values, refer to List: Start Delay Modes. - Delay StartDelayMode `json:"delay,omitempty"` + Delay StartDelay `json:"delay,omitempty"` // Attribute: // skip diff --git a/adcom1/start_delay.go b/adcom1/start_delay.go new file mode 100644 index 0000000..f8d08dd --- /dev/null +++ b/adcom1/start_delay.go @@ -0,0 +1,25 @@ +package adcom1 + +// StartDelay represents video or audio start delay. +type StartDelay int64 + +// Options for the video or audio start delay. +// If the start delay value is greater than 0, then the position is mid-roll and the value indicates the start delay. +const ( + StartPreRoll StartDelay = 0 // Pre-Roll + StartMidRoll StartDelay = -1 // Generic Mid-Roll + StartPostRoll StartDelay = -2 // Generic Post-Roll +) + +// Ptr returns pointer to own value. +func (d StartDelay) Ptr() *StartDelay { + return &d +} + +// Val safely dereferences pointer, returning default value (StartDelayPreRoll) for nil. +func (d *StartDelay) Val() StartDelay { + if d == nil { + return StartPreRoll + } + return *d +} diff --git a/adcom1/start_delay_mode.go b/adcom1/start_delay_mode.go deleted file mode 100644 index 4c30cad..0000000 --- a/adcom1/start_delay_mode.go +++ /dev/null @@ -1,25 +0,0 @@ -package adcom1 - -// StartDelayMode represents video or audio start delay. -type StartDelayMode int64 - -// Options for the video or audio start delay. -// If the start delay value is greater than 0, then the position is mid-roll and the value indicates the start delay. -const ( - StartDelayPreRoll StartDelayMode = 0 // Pre-Roll - StartDelayGenericMidRoll StartDelayMode = -1 // Generic Mid-Roll - StartDelayGenericPostRoll StartDelayMode = -2 // Generic Post-Roll -) - -// Ptr returns pointer to own value. -func (s StartDelayMode) Ptr() *StartDelayMode { - return &s -} - -// Val safely dereferences pointer, returning default value (StartDelayPreRoll) for nil. -func (s *StartDelayMode) Val() StartDelayMode { - if s == nil { - return StartDelayPreRoll - } - return *s -} diff --git a/adcom1/video_placement.go b/adcom1/video_placement.go index c9d6d12..e21bea7 100644 --- a/adcom1/video_placement.go +++ b/adcom1/video_placement.go @@ -31,7 +31,7 @@ type VideoPlacement struct { // Definition: // Indicates the start delay in seconds for pre-roll, mid-roll, or post-roll placements. // For additional generic values, refer to List: Start Delay Modes. - Delay StartDelayMode `json:"delay,omitempty"` + Delay StartDelay `json:"delay,omitempty"` // Attribute: // skip diff --git a/openrtb2/audio.go b/openrtb2/audio.go index 7eaf906..ba6681c 100644 --- a/openrtb2/audio.go +++ b/openrtb2/audio.go @@ -74,7 +74,7 @@ type Audio struct { // Indicates the start delay in seconds for pre-roll, mid-roll, or // post-roll ad placements. Refer to List: Start Delay Modes in // AdCOM 1.0. - StartDelay *adcom1.StartDelayMode `json:"startdelay,omitempty"` + StartDelay *adcom1.StartDelay `json:"startdelay,omitempty"` // Attribute: // rqddurs diff --git a/openrtb2/video.go b/openrtb2/video.go index 2b98c0a..113ac67 100644 --- a/openrtb2/video.go +++ b/openrtb2/video.go @@ -55,7 +55,7 @@ type Video struct { // Indicates the start delay in seconds for pre-roll, mid-roll, or // post-roll ad placements. Refer to List: Start Delay Modes // in AdCOM 1.0. - StartDelay *adcom1.StartDelayMode `json:"startdelay,omitempty"` + StartDelay *adcom1.StartDelay `json:"startdelay,omitempty"` // Attribute: // maxseq