Documentation ¶
Index ¶
- Variables
- func MakeOpenRTBGeneric(req *pbs.PBSRequest, bidder *pbs.PBSBidder, bidderFamily string, ...) (openrtb.BidRequest, error)
- type Adapter
- type BadInputError
- type BadServerResponseError
- type Bidder
- type BidderInfo
- type BidderInfos
- func (infos BidderInfos) HasAppSupport(bidder openrtb_ext.BidderName) bool
- func (infos BidderInfos) HasSiteSupport(bidder openrtb_ext.BidderName) bool
- func (infos BidderInfos) SupportsAppMediaType(bidder openrtb_ext.BidderName, mediaType openrtb_ext.BidType) bool
- func (infos BidderInfos) SupportsWebMediaType(bidder openrtb_ext.BidderName, mediaType openrtb_ext.BidType) bool
- type BidderResponse
- type CallOneResult
- type CapabilitiesInfo
- type ExtImpBidder
- type HTTPAdapter
- type HTTPAdapterConfig
- type MaintainerInfo
- type MisconfiguredAdapter
- type PlatformInfo
- type RequestData
- type ResponseData
- type TypedBid
Constants ¶
This section is empty.
Variables ¶
var DefaultHTTPAdapterConfig = &HTTPAdapterConfig{ MaxConns: 50, MaxConnsPerHost: 10, IdleConnTimeout: 60 * time.Second, }
DefaultHTTPAdapterConfig is an HTTPAdapterConfig that chooses sensible default values.
Functions ¶
func MakeOpenRTBGeneric ¶
func MakeOpenRTBGeneric(req *pbs.PBSRequest, bidder *pbs.PBSBidder, bidderFamily string, allowedMediatypes []pbs.MediaType, singleMediaTypeImp bool) (openrtb.BidRequest, error)
adapters.MakeOpenRTBGeneric makes an openRTB request from the PBS-specific structs.
Any objects pointed to by the returned BidRequest *must not be mutated*, or we will get race conditions. The only exception is the Imp property, whose objects will be created new by this method and can be mutated freely.
Types ¶
type Adapter ¶
type Adapter interface { // Name must be identical to the BidderName. Name() string // Determines whether this adapter should get callouts if there is not a synched user ID. SkipNoCookies() bool // Call produces bids which should be considered, given the auction params. // // In practice, implementations almost always make one call to an external server here. // However, that is not a requirement for satisfying this interface. // // An error here will cause all bids to be ignored. If the error was caused by bad user input, // this should return a BadInputError. If it was caused by bad server behavior // (e.g. 500, unexpected response format, etc), this should return a BadServerResponseError. Call(ctx context.Context, req *pbs.PBSRequest, bidder *pbs.PBSBidder) (pbs.PBSBidSlice, error) }
Adapter is a deprecated interface which connects prebid-server to a demand partner. PBS is currently being rewritten to use Bidder, and this will be removed after. Their primary purpose is to produce bids in response to Auction requests.
type BadInputError ¶
type BadInputError struct {
Message string
}
BadInputError should be used when returning errors which are caused by bad input. It should _not_ be used if the error is a server-side issue (e.g. failed to send the external request).
BadInputErrors will not be written to the app log, since it's not an actionable item for the Prebid Server hosts.
func (*BadInputError) Error ¶
func (err *BadInputError) Error() string
type BadServerResponseError ¶
type BadServerResponseError struct {
Message string
}
BadServerResponseError should be used when returning errors which are caused by bad/unexpected behavior on the remote server.
For example:
- The external server responded with a 500
- The external server gave a malformed or unexpected response.
These should not be used to log _connection_ errors (e.g. "couldn't find host"), which may indicate config issues for the PBS host company
func (*BadServerResponseError) Error ¶
func (err *BadServerResponseError) Error() string
type Bidder ¶
type Bidder interface { // MakeRequests makes the HTTP requests which should be made to fetch bids. // // nil return values are acceptable, but nil elements *inside* those slices are not. // // The errors should contain a list of errors which explain why this bidder's bids will be // "subpar" in some way. For example: the request contained ad types which this bidder doesn't support. // // If the error is caused by bad user input, return a BadInputError. MakeRequests(request *openrtb.BidRequest) ([]*RequestData, []error) // MakeBids unpacks the server's response into Bids. // // The bids can be nil (for no bids), but should not contain nil elements. // // The errors should contain a list of errors which explain why this bidder's bids will be // "subpar" in some way. For example: the server response didn't have the expected format. // // If the error was caused by bad user input, return a BadInputError. // If the error was caused by a bad server response, return a BadServerResponseError MakeBids(internalRequest *openrtb.BidRequest, externalRequest *RequestData, response *ResponseData) (*BidderResponse, []error) }
Bidder describes how to connect to external demand.
type BidderInfo ¶
type BidderInfo struct { Maintainer *MaintainerInfo `yaml:"maintainer" json:"maintainer"` Capabilities *CapabilitiesInfo `yaml:"capabilities" json:"capabilities"` }
type BidderInfos ¶
type BidderInfos map[string]BidderInfo
func ParseBidderInfos ¶
func ParseBidderInfos(infoDir string, bidders []openrtb_ext.BidderName) BidderInfos
ParseBidderInfos reads all the static/bidder-info/{bidder}.yaml files from the filesystem. The map it returns will have a key for every element of the bidders array. If a {bidder}.yaml file does not exist for some bidder, it will panic.
func (BidderInfos) HasAppSupport ¶
func (infos BidderInfos) HasAppSupport(bidder openrtb_ext.BidderName) bool
func (BidderInfos) HasSiteSupport ¶
func (infos BidderInfos) HasSiteSupport(bidder openrtb_ext.BidderName) bool
func (BidderInfos) SupportsAppMediaType ¶
func (infos BidderInfos) SupportsAppMediaType(bidder openrtb_ext.BidderName, mediaType openrtb_ext.BidType) bool
func (BidderInfos) SupportsWebMediaType ¶
func (infos BidderInfos) SupportsWebMediaType(bidder openrtb_ext.BidderName, mediaType openrtb_ext.BidType) bool
type BidderResponse ¶
BidderResponse wraps the server's response with the list of bids and the currency used by the bidder.
Currency declaration is not mandatory but helps to detect an eventual currency mismatch issue. From the bid response, the bidder accepts a list of valid currencies for the bid. The currency is the same accross all bids.
func NewBidderResponse ¶
func NewBidderResponse() *BidderResponse
NewBidderResponse create a new BidderResponse initialising the bids array and the default currency value to "USD".
By default, Bids capacity will be set to 0. By default, currency is USD but this behavior might be subject to change.
func NewBidderResponseWithBidsCapacity ¶
func NewBidderResponseWithBidsCapacity(bidsCapacity int) *BidderResponse
NewBidderResponseWithBidsCapacity create a new BidderResponse initialising the bids array capacity and the default currency value to "USD".
bidsCapacity allows to set initial Bids array capacity. By default, currency is USD but this behavior might be subject to change.
type CallOneResult ¶
used for callOne (possibly pull all of the shared code here)
type CapabilitiesInfo ¶
type CapabilitiesInfo struct { App *PlatformInfo `yaml:"app" json:"app"` Site *PlatformInfo `yaml:"site" json:"site"` }
type ExtImpBidder ¶
type ExtImpBidder struct { Prebid *openrtb_ext.ExtImpPrebid `json:"prebid"` // Bidder contain the bidder-specific extension. Each bidder should unmarshal this using their // corresponding openrtb_ext.ExtImp{Bidder} struct. // // For example, the Appnexus Bidder should unmarshal this with an openrtb_ext.ExtImpAppnexus object. // // Bidder implementations may safely assume that this JSON has been validated by their // static/bidder-params/{bidder}.json file. Bidder openrtb.RawJSON `json:"bidder"` }
ExtImpBidder can be used by Bidders to unmarshal any request.imp[i].ext.
type HTTPAdapter ¶
func NewHTTPAdapter ¶
func NewHTTPAdapter(c *HTTPAdapterConfig) *HTTPAdapter
NewHTTPAdapter creates an HTTPAdapter which obeys the rules given by the config, and has all the available SSL certs available in the project.
type HTTPAdapterConfig ¶
type HTTPAdapterConfig struct { // See IdleConnTimeout on https://golang.org/pkg/net/http/#Transport IdleConnTimeout time.Duration // See MaxIdleConns on https://golang.org/pkg/net/http/#Transport MaxConns int // See MaxIdleConnsPerHost on https://golang.org/pkg/net/http/#Transport MaxConnsPerHost int }
HTTPAdapterConfig groups options which control how HTTP requests are made by adapters.
type MaintainerInfo ¶
type MaintainerInfo struct {
Email string `yaml:"email" json:"email"`
}
type MisconfiguredAdapter ¶
func (*MisconfiguredAdapter) Call ¶
func (b *MisconfiguredAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder *pbs.PBSBidder) (pbs.PBSBidSlice, error)
func (*MisconfiguredAdapter) Name ¶
func (b *MisconfiguredAdapter) Name() string
func (*MisconfiguredAdapter) SkipNoCookies ¶
func (b *MisconfiguredAdapter) SkipNoCookies() bool
type PlatformInfo ¶
type PlatformInfo struct {
MediaTypes []openrtb_ext.BidType `yaml:"mediaTypes" json:"mediaTypes"`
}
type RequestData ¶
RequestData packages together the fields needed to make an http.Request.
func (*RequestData) SetBasicAuth ¶
func (r *RequestData) SetBasicAuth(username string, password string)
type ResponseData ¶
ResponseData packages together information from the server's http.Response.
type TypedBid ¶
type TypedBid struct { Bid *openrtb.Bid BidType openrtb_ext.BidType }
TypedBid packages the openrtb.Bid with any bidder-specific information that PBS needs to populate an openrtb_ext.ExtBidPrebid.
TypedBid.Bid.Ext will become "response.seatbid[i].bid.ext.bidder" in the final OpenRTB response. TypedBid.BidType will become "response.seatbid[i].bid.ext.prebid.type" in the final OpenRTB response.