Dropped constants (if constants will ever return - they should be kept outside of main 'rtb' package, which should be as minimalistic as possible)

This commit is contained in:
Max Cherry
2015-05-17 14:32:56 +03:00
parent 609449f547
commit 768e1b1875
26 changed files with 4 additions and 351 deletions
-21
View File
@@ -1,21 +0,0 @@
package rtb
// 5.4 Ad Position
//
// The following table specifies the position of the ad as a relative measure of visibility or prominence.
//
// This OpenRTB table has values derived from the IAB Quality Assurance Guidelines (QAG). Practitioners
// should keep in sync with updates to the QAG values as published on IAB.net. Values “3” “6” apply to
// apps per the mobile addendum to QAG version 1.5.
//
// TODO: review and rename
const (
AdPositionUnknown uint8 = 0 // 0 Unknown
AdPositionAboveTheFold uint8 = 1 // 1 Above the Fold
AdPositionMayBeInitiallyVisible uint8 = 2 // 2 DEPRECATED - May or may not be initially visible depending on screen size/resolution.
AdPositionBelowTheFold uint8 = 3 // 3 Below the Fold
AdPositionHeader uint8 = 4 // 4 Header
AdPositionFooter uint8 = 5 // 5 Footer
AdPositionSidebar uint8 = 6 // 6 Sidebar
AdPositionFullScreen uint8 = 7 // 7 Full Screen
)
-15
View File
@@ -1,15 +0,0 @@
package rtb
// 5.6 API Frameworks
//
// The following table is a list of API frameworks supported by the publisher. Note that MRAID-1 is a
// subset of MRAID-2. In OpenRTB 2.1 and prior, value “3” was “MRAID”. However, not all MRAID capable
// APIs understand MRAID-2 features and as such the only safe interpretation of value “3” is MRAID-1. In
// OpenRTB 2.2, this was made explicit and MRAID-2 has been added as value “5”.
const (
APIFrameworkVPAID10 = 1 // 1 VPAID 1.0
APIFrameworkVPAID20 = 2 // 2 VPAID 2.0
APIFrameworkMRAID1 = 3 // 3 MRAID-1
APIFrameworkORMMA = 4 // 4 ORMMA
APIFrameworkMRAID2 = 5 // 5 MRAID-2
)
-6
View File
@@ -1,11 +1,5 @@
package rtb
// Indicates if the app has a privacy policy, where 0 = no, 1 = yes.
const (
AppPrivacyPolicyNo uint8 = 0 // 0 = no
AppPrivacyPolicyYes uint8 = 1 // 1 = yes
)
// 3.2.7 Object: App
//
// This object should be included if the ad supported content is a non-browser application (typically in
-7
View File
@@ -1,12 +1,5 @@
package rtb
// Indicates if the banner is in the top frame as opposed to an
// iframe, where 0 = no, 1 = yes.
const (
BannerTopFrameNo uint8 = 0 // 0 = no
BannerTopFrameYes uint8 = 1 // 1 = yes
)
// 3.2.3 Object: Banner
//
// This object represents the most general type of impression. Although the term “banner” may have very
-12
View File
@@ -1,12 +0,0 @@
package rtb
// 5.2 Banner Ad Types
//
// The following table indicates the types of ads that can be accepted by the exchange unless restricted by
// publisher site settings.
const (
BannerAdTypeXHTMLText uint8 = 1 // 1 XHTML Text Ad (usually mobile)
BannerAdTypeXHTMLBanner uint8 = 2 // 2 XHTML Banner Ad. (usually mobile)
BannerAdTypeJavaScript uint8 = 3 // 3 JavaScript Ad; must be valid XHTML (i.e., Script Tags Included)
BannerAdTypeIframe uint8 = 4 // 4 iframe
)
-24
View File
@@ -1,29 +1,5 @@
package rtb
// Indicator of test mode in which auctions are not billable, where 0 = live mode, 1 = test mode.
const (
BidRequestTestLive = 0 // 0 = live mode
BidRequestTestTest = 1 // 1 = test mode
)
// Auction type, where 1 = First Price, 2 = Second Price Plus.
// Exchange-specific auction types can be defined using values
// greater than 500.
const (
BidRequestATFirstPrice uint8 = 1 // 1 = First Price
BidRequestATSecondPricePlus uint8 = 2 // 2 = Second Price Plus (default)
)
// Flag to indicate if Exchange can verify that the impressions
// offered represent all of the impressions available in context
// (e.g., all on the web page, all video spots such as pre/mid/post
// roll) to support road-blocking. 0 = no or unknown, 1 = yes, the
// impressions offered represent all that are available.
const (
BidRequestAllImpsNo uint8 = 0 // 0 = no or unknown
BidRequestAllImpsYes uint8 = 1 // 1 = yes, the impressions offered represent all that are available.
)
// 3.2.1 Object: BidRequest
//
// The top-level bid request object contains a globally unique bid request or auction ID. This id attribute is
-19
View File
@@ -1,24 +1,5 @@
package rtb
// 0 = not live, 1 = content is live (e.g., stream, live blog).
const (
ContentLiveStreamNo uint8 = 0 // 0 = not live
ContentLiveStreamYes uint8 = 1 // 1 = content is live (e.g., stream, live blog)
)
// 0 = indirect, 1 = direct.
const (
ContentSourceRelationshipIndirect uint8 = 0 // 0 = indirect
ContentSourceRelationshipDirect uint8 = 1 // 1 = direct
)
// Indicator of whether or not the content is embeddable (e.g.,
// an embeddable video player), where 0 = no, 1 = yes.
const (
ContentEmbeddableNo uint8 = 0 // 0 = no
ContentEmbeddableYes uint8 = 1 // 1 = yes
)
// 3.2.9 Object: Content
//
// This object describes the content in which the impression will appear, which may be syndicated or nonsyndicated
-26
View File
@@ -1,26 +0,0 @@
package rtb
// 5.3 Creative Attributes
//
// The following table specifies a standard list of creative attributes that can describe an ad being served or
// serve as restrictions of thereof.
//
// TODO: review and rename
const (
CreativeAttributeAudioAutoPlay uint8 = 1 // 1 Audio Ad (Auto-Play)
CreativeAttributeAudioUserInitiated uint8 = 2 // 2 Audio Ad (User Initiated)
CreativeAttributeExpandableAutomatic uint8 = 3 // 3 Expandable (Automatic)
CreativeAttributeExpandableUserInitiatedClick uint8 = 4 // 4 Expandable (User Initiated - Click)
CreativeAttributeExpandableUserInitiatedRollover uint8 = 5 // 5 Expandable (User Initiated - Rollover)
CreativeAttributeInBannerVideoAutoPlay uint8 = 6 // 6 In-Banner Video Ad (Auto-Play)
CreativeAttributeInBannerVideoUserInitiated uint8 = 7 // 7 In-Banner Video Ad (User Initiated)
CreativeAttributePop uint8 = 8 // 8 Pop (e.g., Over, Under, or Upon Exit)
CreativeAttributeProvocative uint8 = 9 // 9 Provocative or Suggestive Imagery
CreativeAttributeExtremeAnimation uint8 = 10 // 10 Shaky, Flashing, Flickering, Extreme Animation, Smileys
CreativeAttributeSurvey uint8 = 11 // 11 Surveys
CreativeAttributeTextOnly uint8 = 12 // 12 Text Only
CreativeAttributeUserInteractive uint8 = 13 // 13 User Interactive (e.g., Embedded Games)
CreativeAttributeNativeStyle uint8 = 14 // 14 Windows Dialog or Alert Style
CreativeAttributeHasAudioOnOffButton uint8 = 15 // 15 Has Audio On/Off Button
CreativeAttributeCanBeSkipped uint8 = 16 // 16 Ad Can be Skipped (e.g., Skip Button on Pre-Roll Video)
)
-9
View File
@@ -1,14 +1,5 @@
package rtb
// Optional override of the overall auction type of the bid request, where 1 = First Price,
// 2 = Second Price Plus, 3 = the value passed in bidfloor is the agreed upon deal price. Additional
// auction types can be defined by the exchange.
const (
DealATFirstPrice uint8 = 1 // 1 = First Price
DealATSecondPricePlus uint8 = 2 // 2 = Second Price Plus
DealATAgreed uint8 = 3 // 3 = the value passed in bidfloor is the agreed upon deal price
)
// 3.2.18 Object: Deal
//
// This object constitutes a specific deal that was struck a priori between a buyer and a seller. Its presence
-21
View File
@@ -1,26 +1,5 @@
package rtb
// Standard “Do Not Track” flag as set in the header by the
// browser, where 0 = tracking is unrestricted, 1 = do not track.
const (
DeviceDNTUnrestricted uint8 = 0 // 0 = tracking is unrestricted
DeviceDNT uint8 = 1 // 1 = do not track
)
// “Limit Ad Tracking” signal commercially endorsed (e.g., iOS,
// Android), where 0 = tracking is unrestricted, 1 = tracking must
// be limited per commercial guidelines.
const (
DeviceLmtUnrestricted uint8 = 0 // 0 = tracking is unrestricted
DeviceLmtLimited uint8 = 1 // 1 = tracking must be limited per commercial guidelines.
)
// Support for JavaScript, where 0 = no, 1 = yes.
const (
DeviceJSNo uint8 = 0 // 0 = no
DeviceJSYes uint8 = 1 // 1 = yes
)
// 3.2.11 Object: Device
//
// This object provides information pertaining to the device through which the user is interacting. Device
-13
View File
@@ -1,13 +0,0 @@
package rtb
// 5.5 Expandable Direction
//
// The following table lists the directions in which an expandable ad may expand, given the positioning of
// the ad unit on the page and constraints imposed by the content.
const (
ExpandableDirectionLeft uint8 = 1 // 1 Left
ExpandableDirectionRight uint8 = 2 // 2 Right
ExpandableDirectionUp uint8 = 3 // 3 Up
ExpandableDirectionDown uint8 = 4 // 4 Down
ExpandableDirectionFullScreen uint8 = 5 // 5 Full Screen
)
-8
View File
@@ -1,13 +1,5 @@
package rtb
// 5.16 Location Type
// The following table lists the options to indicate how the geographic information was determined.
const (
GeoTypeGPS uint8 = 1 // 1 GPS/Location Services
GeoTypeIP uint8 = 2 // 2 IP Address
GeoTypeUserProvided uint8 = 3 // 3 User provided (e.g., registration data)
)
// 3.2.12 Object: Geo
//
// This object encapsulates various methods for specifying a geographic location. When subordinate to a
-15
View File
@@ -1,20 +1,5 @@
package rtb
// 1 = the ad is interstitial or full screen, 0 = not interstitial.
const (
ImpInstlNo uint8 = 0 // 0 = not interstitial
ImpInstlYes uint8 = 1 // 1 = the ad is interstitial or full screen
)
// Flag to indicate if the impression requires secure HTTPS URL
// creative assets and markup, where 0 = non-secure, 1 = secure.
// If omitted, the secure state is unknown, but non-secure HTTP
// support can be assumed.
const (
ImpSecureNo uint8 = 0 // 0 = non-secure
ImpSecureYes uint8 = 1 // 1 = secure
)
// 3.2.2 Object: Imp
//
// This object describes an ad placement or impression being auctioned. A single bid request can include
-7
View File
@@ -1,12 +1,5 @@
package rtb
// Indicator of auction eligibility to seats named in the Direct Deals object, where 0 = all bids are accepted,
// 1 = bids are restricted to the deals specified and the terms thereof.
const (
PMPPrivateAuctionUnrestricted uint8 = 0 // 0 = all bids are accepted
PMPPrivateAuctionRestricted uint8 = 1 // 1 = bids are restricted to the deals specified and the terms thereof
)
// 3.2.17 Object: Pmp
//
// This object is the private marketplace container for direct deals between buyers and sellers that may pertain
-7
View File
@@ -1,12 +1,5 @@
package rtb
// Flag indicating if this request is subject to the COPPA
// regulations established by the USA FTC, where 0 = no, 1 = yes.
const (
RegsCOPPANo int8 = 0 // 0 = no
RegsCOPPAYes int8 = 1 // 1 = yes
)
// 3.2.16 Object: Regs
//
// This object contains any legal, governmental, or industry regulations that apply to the request. The coppa flag
+1 -1
View File
@@ -1,4 +1,4 @@
// rtb package provides common OpenRTB's Object types and constants,
// rtb package provides common OpenRTB's Object types,
// according to OpenRTB API Specification Version 2.3:
// http://openrtb.github.io/OpenRTB/
package rtb
-7
View File
@@ -1,12 +1,5 @@
package rtb
// 0 = impressions can be won individually; 1 = impressions must
// be won or lost as a group.
const (
SeatBidGroupNo uint8 = 0 // 0 = impressions can be won individually
SeatBidGroupYes uint8 = 1 // 1 = impressions must be won or lost as a group
)
// 4.2.2 Object: SeatBid
//
// A bid response can contain multiple SeatBid objects, each on behalf of a different bidder seat and each
-12
View File
@@ -1,17 +1,5 @@
package rtb
// Mobile-optimized signal, where 0 = no, 1 = yes.
const (
SiteMobileNo uint8 = 0 // 0 = no
SiteMobileYes uint8 = 1 // 1 = yes
)
// Indicates if the site has a privacy policy, where 0 = no, 1 = yes.
const (
SitePrivacyPolicyNo uint8 = 0 // 0 = no
SitePrivacyPolicyYes uint8 = 1 // 1 = yes
)
// 3.2.6 Object: Site
//
// This object should be included if the ad supported content is a website as opposed to a non-browser
-9
View File
@@ -1,14 +1,5 @@
package rtb
// Gender, where “M” = male, “F” = female, “O” = known to be
// other (i.e., omitted is unknown).
const (
UserGenderMale string = "M" // “M” = male
UserGenderFemale string = "F" // “F” = female
UserGenderOther string = "O" // “O” = known to be other
UserGenderUnknown string = "" // omitted is unknown
)
// 3.2.13 Object: User
//
// This object contains information known or derived about the human user of the device (i.e., the
-17
View File
@@ -1,22 +1,5 @@
package rtb
// Maximum extended video ad duration if extension is allowed.
// If blank or 0, extension is not allowed. If -1, extension is
// allowed, and there is no time limit imposed. If greater than 0,
// then the value represents the number of seconds of extended
// play supported beyond the maxduration value.
const (
VideoMaxExtendedUnlimited int64 = -1 // If -1, extension is allowed, and there is no time limit imposed
VideoMaxExtendedNotAllowed int64 = 0 // If blank or 0, extension is not allowed
)
// Indicates if letter-boxing of 4:3 content into a 16:9 window is
// allowed, where 0 = no, 1 = yes.
const (
VideoBoxingAllowedNo uint8 = 0 // 0 = no
VideoBoxingAllowedYes uint8 = 1 // 1 = yes
)
// 3.2.4 Object: Video
//
// This object represents an in-stream video impression. Many of the fields are non-essential for minimally
-14
View File
@@ -1,14 +0,0 @@
package rtb
// 5.8 Video Bid Response Protocols
//
// The following table lists the options for video bid response protocols that could be supported by an
// exchange.
const (
VideoBidResponseProtocolVAST10 uint8 = 1 // 1 VAST 1.0
VideoBidResponseProtocolVAST20 uint8 = 2 // 2 VAST 2.0
VideoBidResponseProtocolVAST30 uint8 = 3 // 3 VAST 3.0
VideoBidResponseProtocolVAST10Wrapper uint8 = 4 // 1 VAST 1.0 Wrapper
VideoBidResponseProtocolVAST20Wrapper uint8 = 5 // 2 VAST 2.0 Wrapper
VideoBidResponseProtocolVAST30Wrapper uint8 = 6 // 3 VAST 3.0 Wrapper
)
-19
View File
@@ -1,19 +0,0 @@
package rtb
// 5.7 Video Linearity
//
// The following table indicates the options for video linearity. “In-stream” or “linear” video refers to preroll,
// post-roll, or mid-roll video ads where the user is forced to watch ad in order to see the video
// content. “Overlay” or “non-linear” refer to ads that are shown on top of the video content.
//
// This field is optional. The following is the interpretation of the bidder based upon the presence or
// absence of the field in the bid request:
// - If no value is set, any ad (linear or not) can be present in the response.
// - If a value is set, only ads of the corresponding type can be present in the response.
//
// Note to the reader: This OpenRTB table has values derived from the IAB Quality Assurance Guidelines
// (QAG). Practitioners should keep in sync with updates to the QAG values as published on IAB.net.
const (
VideoLinearityLinear = 1 // 1 Linear / In-Stream
VideoLinearityNonLinear = 2 // 2 Non-Linear / Overlay
)
-11
View File
@@ -1,11 +0,0 @@
package rtb
// 5.9 Video Playback Methods
//
// The following table lists the various video playback methods.
const (
VideoPlaybackMethodAutoPlaySoundOn uint8 = 1 // 1 Auto-Play Sound On
VideoPlaybackMethodAutoPlaySoundOff uint8 = 2 // 2 Auto-Play Sound Off
VideoPlaybackMethodClickToPlay uint8 = 3 // 3 Click-to-Play
VideoPlaybackMethodMouseOver uint8 = 4 // 4 Mouse-Over
)
-12
View File
@@ -1,12 +0,0 @@
package rtb
// 5.11 Video Quality
//
// The following table lists the options for the video quality. These values are defined by the IAB
// http://www.iab.net/media/file/long-form-video-final.pdf.
const (
VideoQualityUnknown uint8 = 0 // 0 Unknown
VideoQualityProfessionallyProduced uint8 = 1 // 1 Professionally Produced
VideoQualityProsumer uint8 = 2 // 2 Prosumer
VideoQualityUserGenerated uint8 = 3 // 3 User Generated (UGC)
)
-12
View File
@@ -1,12 +0,0 @@
package rtb
// 5.10 Video Start Delay
//
// The following table lists the various options for the video 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 (
// > 0 Mid-Roll (value indicates start delay in second)
VideoStartDelayPreRoll int64 = 0 // 0 Pre-Roll
VideoStartDelayGenericMidRoll int64 = -1 // -1 Generic Mid-Roll
VideoStartDelayGenericPostRoll int64 = -2 // -2 Generic Post-Roll
)
+3 -27
View File
@@ -2,7 +2,7 @@
[![GoDoc](https://godoc.org/github.com/mxmCherry/go-rtb/2.3/rtb?status.svg)](https://godoc.org/github.com/mxmCherry/go-rtb/2.3/rtb)
Common [OpenRTB](//github.com/openrtb/OpenRTB) [v2.3](//github.com/openrtb/OpenRTB/blob/master/OpenRTB-API-Specification-Version-2-3-FINAL.pdf) Object types and constants for Go programming language
Common [OpenRTB](//github.com/openrtb/OpenRTB) [v2.3](//github.com/openrtb/OpenRTB/blob/master/OpenRTB-API-Specification-Version-2-3-FINAL.pdf) Object types for Go programming language
**Warning!** Currently, this package is quite unstable (types and names may change). Also, even after v1.0 this repo will contain only recent version (v1+). So, if you need to use this code in production, take a look on [godep](//github.com/tools/godep).
@@ -31,32 +31,10 @@ Common [OpenRTB](//github.com/openrtb/OpenRTB) [v2.3](//github.com/openrtb/OpenR
- [x] 4.2.1 Object: BidResponse
- [x] 4.2.2 Object: SeatBid
- [x] 4.2.3 Object: Bid
- [ ] 5. Enumerated Lists Specification
- [ ] 5.1 Content Categories
- [x] 5.2 Banner Ad Types
- [x] 5.3 Creative Attributes
- [x] 5.4 Ad Position
- [x] 5.5 Expandable Direction
- [x] 5.6 API Frameworks
- [x] 5.7 Video Linearity
- [x] 5.8 Video Bid Response Protocols
- [x] 5.9 Video Playback Methods
- [x] 5.10 Video Start Delay
- [x] 5.11 Video Quality
- [ ] 5.12 VAST Companion Types
- [ ] 5.13 Content Delivery Methods
- [ ] 5.14 Content Context
- [ ] 5.15 QAG Media Ratings
- [ ] 5.16 Location Type
- [ ] 5.17 Device Type
- [ ] 5.18 Connection Type
- [ ] 5.19 No-Bid Reason Codes
- [ ] Code quality/review
- [ ] Review constants for section "5. Enumerated Lists Specification"
- [ ] Review struct key types, which refer to section "5. Enumerated Lists Specification"
- [ ] Check types for struct keys (see Guidelines - Types)
- [ ] Use struct pointers for optional keys (e.g., App.Content)
- [ ] Review and rename constants for types, if needed (see Guidelines - Naming convention)
- [ ] Add json directive "omitempty" for optional keys
@@ -66,7 +44,6 @@ Common [OpenRTB](//github.com/openrtb/OpenRTB) [v2.3](//github.com/openrtb/OpenR
- [UpperCamelCase](http://en.wikipedia.org/wiki/CamelCase)
- Capitalized abbreviations (e.g., AT, COPPA, PMP etc.)
- Capitalized ID keys
- Constants are named after type and key like ```TypeName``` + ```KeyName``` + ```ValueDescription```, e.g., constant for ```type BidRequest``` with key ```AT``` will look like ```const BidRequestATFirstPrice```
## Types
- Key types should be chosen according to OpenRTB specification (attribute types)
@@ -78,11 +55,10 @@ Common [OpenRTB](//github.com/openrtb/OpenRTB) [v2.3](//github.com/openrtb/OpenR
## Documentation
- [Godoc: documenting Go code](http://blog.golang.org/godoc-documenting-go-code)
- Each entity (type, constant or struct key) should be documented
- Each entity (type or struct key) should be documented
- Comments for entities should be copy-pasted "as-is" from OpenRTB specification
- For struct keys, section "Notes" may be added at the very bottom of key comment - it may contain some recommendations for developers (constants reference etc.)
## Code organization
- Each RTB type and its related constants should be kept in its own file, named after type
- Each RTB type should be kept in its own file, named after type
- File names are in underscore_case, e.g., ```type BidRequest``` should be declared in ```bid_request.go```
- [go fmt your code](https://blog.golang.org/go-fmt-your-code)