Added response types.

This commit is contained in:
Dave Bemiller
2017-11-13 11:26:48 -05:00
parent dacd2db5f6
commit fadacfa33e
7 changed files with 355 additions and 0 deletions
+97
View File
@@ -0,0 +1,97 @@
package response
import "github.com/mxmCherry/openrtb"
// 5.2 Object: Asset
//
// Corresponds to the Asset Object in the request. 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
// AssetObject array so that the response can be aligned.
type Asset struct {
// Field:
// id
// Scope:
// required
// Type:
// int
// Description:
// Unique asset ID, assigned by exchange, must match one of the asset IDs in request.
ID int `json:"id"`
// Field:
// required
// Scope:
// optional
// Type:
// int
// Default:
// 0
// Description:
// Set to 1 if asset is required. (bidder requires it to be displayed).
Required int `json:"required,omitempty"`
// Field:
// title
// Scope:
// optional
// Type:
// object
// Description:
// Title object for title assets.
Title *Title `json:"title,omitempty"`
// Field:
// img
// Scope:
// optional
// Type:
// object
// Description:
// Image object for image assets.
Img *Image `json:"img,omitempty"`
// Field:
// video
// Scope:
// optional
// Type:
// object
// Description:
// Video object for video assets. See Video response object definition.
// Note that in-stream video ads are not part of Native.
// Native ads may contain a video as the ad creative itself.
Video *Video `json:"video,omitempty"`
// Field:
// data
// Scope:
// optional
// Type:
// object
// Description:
// Data object for ratings, prices etc.
Data *Data `json:"data,omitempty"`
// Field:
// link
// Scope:
// optional
// Type:
// object
// Description:
// Link object for call to actions. The link object applies if the asset item is activated (clicked).
// If there is no link object on the asset, the parent link object on the bid response applies.
Link *Link `json:"link,omitempty"`
// Field:
// ext
// Scope:
// optional
// Type:
// 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
Ext openrtb.RawJSON `json:"ext,omitempty"`
}
+42
View File
@@ -0,0 +1,42 @@
package response
import "github.com/mxmCherry/openrtb"
// 5.5 Object: 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 etc. It is also generic for future native elements not
// contemplated at the time of the writing of this document.
type Data struct {
// Field:
// label
// Scope:
// optional
// Type:
// string
// Description:
// The optional formatted string name of the data type to be displayed.
Label string `json:"label,omitempty"`
// Field:
// value
// Scope:
// required
// Type:
// string
// Description:
// The formatted string of data to be displayed.
// Can contain a formatted value such as "5 stars" or "$10" or "3.4 stars out of 5".
Value string `json:"value"`
// Field:
// ext
// Scope:
// optional
// Type:
// 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
Ext openrtb.RawJSON `json:"ext,omitempty"`
}
+49
View File
@@ -0,0 +1,49 @@
package response
import "github.com/mxmCherry/openrtb"
// 5.4 Object: Image
//
// Corresponds to the Image Object in the request.
// The Image object to be used for all image elements of the Native ad such as Icons, Main Image, etc.
type Image struct {
// Field:
// url
// Scope:
// required
// Type:
// string
// Description:
// URL of the image asset
URL string `json:"url,omitempty"`
// Field:
// w
// Scope:
// recommended
// Type:
// int
// Description:
// Width of the image in pixels
W int `json:"w,omitempty"`
// Field:
// h
// Scope:
// recommended
// Type:
// int
// Description:
// Height of the image in pixels
H int `json:"h,omitempty"`
// Field:
// ext
// Scope:
// optional
// Type:
// 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
Ext openrtb.RawJSON `json:"ext,omitempty"`
}
+51
View File
@@ -0,0 +1,51 @@
package response
import "github.com/mxmCherry/openrtb"
// 5.7 Object: Link
//
// 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 location of the link.
type Link struct {
// Field:
// url
// Scope:
// required
// Type:
// string
// Description:
// Landing URL of the clickable link.
URL string `json:"url"`
// Field:
// clicktrackers
// Scope:
// optional
// Type:
// string array
// Description:
// List of third-party tracker URLs to be fired on click of the URL.
ClickTrackers []string `json:"clicktrackers"`
// Field:
// fallback
// Scope:
// optional
// Type:
// string
// Description:
// Fallback URL for deeplink. To be used if the URL given in url is not supported by the device.
Fallback string `json:"fallback,omitempty"`
// Field:
// ext
// Scope:
// optional
// Type:
// 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
Ext openrtb.RawJSON `json:"ext,omitempty"`
}
+72
View File
@@ -0,0 +1,72 @@
package response
import "github.com/mxmCherry/openrtb"
// 5.1 Object: Response
//
// The native object is the top level JSON object which identifies a native response.
type Response struct {
// Field:
// ver
// Scope:
// optional
// Type:
// string
// Description:
// Version of the Native Markup version in use.
Ver string `json:"ver,omitempty"`
// Field:
// assets
// Scope:
// required
// Type:
// object array
// Description:
// List of native ads assets.
Assets []Asset `json:"assets"`
// Field:
// link
// Scope:
// required
// Type:
// object
// Description:
// Destination Link. This is default link object for the ad.
// Individual assets can also have a link object which applies if the asset is activated(clicked).
// If the asset doesnt have a link object, the parent link object applies.
Link Link `json:"link"`
// Field:
// imptrackers
// Scope:
// optional
// Type:
// string array
// Description:
// Array of impression tracking URLs, expected to return a 1x1 image or 204 response - typically
// only passed when using 3rd party trackers.
ImpTrackers []string `json:"imptrackers,omitempty"`
// Field:
// jstracker
// Scope:
// optional
// Type:
// string
// Description:
// Optional JavaScript impression tracker. This is a valid HTML, Javascript is already wrapped in <script> tags.
// It should be executed at impression time where it can be supported.
JSTracker string `json:"jstracker,omitempty"`
// Field:
// ext
// Scope:
// optional
// Type:
// 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
Ext openrtb.RawJSON `json:"ext,omitempty"`
}
+28
View File
@@ -0,0 +1,28 @@
package response
import "github.com/mxmCherry/openrtb"
// 5.3 Object: Title
//
// Corresponds to the Title Object in the request, with the value filled in.
type Title struct {
// Field:
// text
// Scope:
// required
// Type:
// string
// Description:
// The text associated with the text element.
Text string `json:"text"`
// Field:
// ext
// Scope:
// optional
// Type:
// 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
Ext openrtb.RawJSON `json:"ext,omitempty"`
}
+16
View File
@@ -0,0 +1,16 @@
package response
// 5.6 Object: Video
//
// Corresponds to the Video Object in the request, yet containing a value of a conforming VAST tag as a value.
type Video struct {
// Field:
// vasttag
// Scope:
// required
// Type:
// string
// Description:
// VAST XML
VASTTag string `json:"vasttag"`
}