response

package
v9.2.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2017 License: Unlicense Imports: 1 Imported by: 0

README

native/response GoDoc

Go implementation of OpenRTB Dynamic Native Ads API Specification Version 1.1 section 5 Native Ad Response Markup Details types.

Documentation

Overview

Package response provides OpenRTB Dynamic Native Ads API Specification Version 1.1 section 5 Native Ad Response Markup Details types: https://www.iab.com/guidelines/real-time-bidding-rtb-project/ https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-Native-Ads-Specification-1-1_2016.pdf

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

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 int64 `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 int8 `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 RawJSON `json:"ext,omitempty"`
}

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 Data

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 RawJSON `json:"ext,omitempty"`
}

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 Image

type Image struct {
	// Field:
	//   url
	// Scope:
	//   required
	// Type:
	//   string
	// Description:
	//   URL of the image asset
	URL string `json:"url"`

	// Field:
	//   w
	// Scope:
	//   recommended
	// Type:
	//   int
	// Description:
	//   Width of the image in pixels
	W uint64 `json:"w,omitempty"`

	// Field:
	//   h
	// Scope:
	//   recommended
	// Type:
	//   int
	// Description:
	//   Height of the image in pixels
	H uint64 `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 RawJSON `json:"ext,omitempty"`
}

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 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,omitempty"`

	// 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 RawJSON `json:"ext,omitempty"`
}

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 RawJSON

type RawJSON []byte

RawJSON is a raw encoded JSON value. It implements encoding/json.Marshaler and encoding/json.Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.

Basically, it's just a copy of encoding/json.RawMessage type, but with more convenient non-pointer encoding.

HEADS UP: this will be replaced with json.RawMessage when Go 1.10 is out.

func (RawJSON) MarshalJSON

func (m RawJSON) MarshalJSON() ([]byte, error)

MarshalJSON returns m as the JSON encoding of m.

func (*RawJSON) UnmarshalJSON

func (m *RawJSON) UnmarshalJSON(data []byte) error

UnmarshalJSON sets *m to a copy of data.

type Response

type Response struct {
	// Field:
	//   ver
	// Scope:
	//   optional
	// Type:
	//   string
	// Default:
	//   1.1
	// 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 ad’s 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 doesn’t 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 RawJSON `json:"ext,omitempty"`
}

5.1 Object: Response

The native object is the top level JSON object which identifies a native response.

type Title

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 RawJSON `json:"ext,omitempty"`
}

5.3 Object: Title

Corresponds to the Title Object in the request, with the value filled in.

type Video

type Video struct {
	// Field:
	//   vasttag
	// Scope:
	//   required
	// Type:
	//   string
	// Description:
	//   VAST XML
	VASTTag string `json:"vasttag"`
}

5.6 Object: Video

Corresponds to the Video Object in the request, yet containing a value of a conforming VAST tag as a value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL