Skip to content

Commit

Permalink
prebid#4 Add ExtImpConsumable contract class
Browse files Browse the repository at this point in the history
  • Loading branch information
Neale Upstone authored and nealeu committed Feb 12, 2019
1 parent f98e84f commit a5da397
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
11 changes: 6 additions & 5 deletions openrtb_ext/imp.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package openrtb_ext

// ExtImp defines the contract for bidrequest.imp[i].ext
type ExtImp struct {
Prebid *ExtImpPrebid `json:"prebid"`
Appnexus *ExtImpAppnexus `json:"appnexus"`
Rubicon *ExtImpRubicon `json:"rubicon"`
Adform *ExtImpAdform `json:"adform"`
Rhythmone *ExtImpRhythmone `json:"rhythmone"`
Prebid *ExtImpPrebid `json:"prebid"`
Appnexus *ExtImpAppnexus `json:"appnexus"`
Consumable *ExtImpConsumable `json:"consumable"`
Rubicon *ExtImpRubicon `json:"rubicon"`
Adform *ExtImpAdform `json:"adform"`
Rhythmone *ExtImpRhythmone `json:"rhythmone"`
}

// ExtImpPrebid defines the contract for bidrequest.imp[i].ext.prebid
Expand Down
8 changes: 7 additions & 1 deletion openrtb_ext/imp_consumable.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
package openrtb_ext

// ExtImpConsumable defines the contract for bidrequest.imp[i].ext.consumable
type ExtImpConsumable struct{}
type ExtImpConsumable struct {
NetworkId int `json:"networkId,omitempty"`
SiteId int `json:"siteId,omitempty"`
UnitId int `json:"unitId,omitempty"`
/* UnitName gets used as a classname and in the URL when building the ad markup */
UnitName string `json:"unitName"`
}
29 changes: 27 additions & 2 deletions static/bidder-params/consumable.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Consumable Adapter Params",
"description": "A schema which validates params accepted by the Consumable adapter"
}
"description": "A schema which validates params accepted by the Consumable adapter",

"type": "object",
"properties": {
"siteId": {
"type": "number",
"description": "An ID which identifies the site selling the impression",
"pattern": "^[0-9]+$"
},
"networkId": {
"type": "number",
"description": "The network id",
"pattern": "^[0-9]+$"
},
"unitId": {
"type": "number",
"description": "The unit id",
"pattern": "^[0-9]+$"
},
"unitName": {
"type": "string",
"description": "The unit name (expected to be a valid CSS class name)",
"pattern": "^-?[_a-zA-Z]+[_a-zA-Z0-9-]*$"
}
},
"required": ["siteId", "unitId", "unitName"]
}

0 comments on commit a5da397

Please sign in to comment.