ssp

package
v0.0.0-...-fa2b1a7 Latest Latest
Warning

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

Go to latest
Published: May 6, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Currency = "USD"
)

Variables

View Source
var (
	ErrNoBid = errors.New("no bid")
)

Functions

func RandomID

func RandomID(n int) string

Types

type Auction

type Auction struct {
	ID              string
	PlacementID     string
	PlacementType   Type
	UserID          string
	FloorCPM        float64
	Width, Height   int
	UserAgent       string
	IP              string
	PriceCPM        float64
	AdMarkup        string
	NotificationURL string
}

func NewAuction

func NewAuction() *Auction

func (*Auction) Won

func (a *Auction) Won()

Won will call the notication callback, if any

type Bid

type Bid struct {
	SSPID           string
	PriceCPM        float64
	NotificationURL string
	Type            Type
	AdMarkup        string // VAST also goes here
}

func RunAuction

func RunAuction(ctx context.Context, dsps []DSP, a *Auction) (*Bid, error)

type DSP

type DSP struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	BidURL string `json:"bid_url"`
}

func RunDSP

func RunDSP(id, name string, campaigns ...dsplib.Campaign) (DSP, *dsplib.DSP)

RunDSP returns a http server you need to Close() when done

func (*DSP) Bid

func (d *DSP) Bid(ctx context.Context, a *Auction) ([]Bid, error)

type Placement

type Placement struct {
	ID       string  `json:"id"`
	Name     string  `json:"name"`
	FloorCPM float64 `json:"floor_cpm"`
	Width    int     `json:"width"`
	Height   int     `json:"height"`
	Type     Type    `json:"type"`
}

func (Placement) Code

func (p Placement) Code(base string) (string, error)

func (Placement) Iframe

func (p Placement) Iframe(au *Auction) (string, error)

type Type

type Type string
const (
	Video  Type = "video"
)

Jump to

Keyboard shortcuts

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