Documentation
¶
Index ¶
- Constants
- Variables
- type Account
- func (c *Account) Balance() billing.Money
- func (c *Account) CommissionShareFactor() float64
- func (c *Account) DailyBudget() billing.Money
- func (c *Account) ID() uint64
- func (c *Account) ObjectKey() uint64
- func (c *Account) RemainingSpendBalance() billing.Money
- func (c *Account) Spend() billing.Money
- func (c *Account) TestBudgetValue() bool
- func (c *Account) TestRequest(accessPointID uint64) error
- type AccountBalanceState
- type AdFileAsset
- type AdFileAssetThumb
- type AdFileAssets
- func (assets AdFileAssets) HasAsset(name string, assetType types.AdFileAssetType) bool
- func (assets AdFileAssets) Len() int
- func (assets AdFileAssets) RandomAsset(name string, assetType types.AdFileAssetType) *AdFileAsset
- func (assets AdFileAssets) RandomAssetWithSize(name string, assetType types.AdFileAssetType, w, h int) *AdFileAsset
- func (assets AdFileAssets) RandomMain(assetType types.AdFileAssetType) *AdFileAsset
- func (assets AdFileAssets) RandomMainAsset(assetType types.AdFileAssetType) *AdFileAsset
- type Application
- type RTBRequestType
- type RTBSource
- type RTBSourceConfig
- type RTBSourceFlags
- type State
- type TrafficRouter
Constants ¶
const ( RTBRequestTypeUndefined = types.RTBRequestTypeUndefined RTBRequestTypeJSON = types.RTBRequestTypeJSON RTBRequestTypeXML = types.RTBRequestTypeXML RTBRequestTypeProtoBUFF = types.RTBRequestTypeProtoBUFF RTBRequestTypePOSTFormEncoded = types.RTBRequestTypePOSTFormEncoded RTBRequestTypePLAINTEXT = types.RTBRequestTypePLAINTEXT )
Request types
Variables ¶
var (
ErrAccessPointNotAllowed = errtype.Error("access point not allowed")
)
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
IDval uint64 // Authoincrement key
MaxDaily billing.Money
CurrentState AccountBalanceState
// AccessPointsAllowed is a list of access points allowed for the account
AccessPointsAllowed gosql.OrderedNumberArray[uint64]
// For example:
// Displayed ads for 100$
// Account revenue share 60%
// In such case the ad network have 40$
// The publisher have 60$
RevenueShare float64 // % 1.0 -> 100%, 0.655 -> 65.5%
}
Account model
func (*Account) CommissionShareFactor ¶
CommissionShareFactor which system get from publisher 0..1
func (*Account) DailyBudget ¶
DailyBudget of the account
func (*Account) RemainingSpendBalance ¶
RemainingSpendBalance returns the remaining spend balance for the account.
func (*Account) TestBudgetValue ¶
TestBudgetValue tests if the account has enough balance to spend
func (*Account) TestRequest ¶
TestRequest tests if the account has access to the access point
type AccountBalanceState ¶
type AdFileAsset ¶
type AdFileAsset struct {
ID uint64 `json:"id,omitempty"`
ExternalID string `json:"external_id,omitempty"` // ID of the asset in the source system, like VAST media file ID
Name string `json:"name,omitempty"` // Name of the asset, like "main", "banner", "icon", etc.
AltText string `json:"alt_text,omitempty"` // Alternative text for the asset, used for accessibility and as a fallback
URL string `json:"url,omitempty"` // In case of HTML5, here must be the path to directory on CDN
Type types.AdFileAssetType `json:"type,omitempty"`
ContentType string `json:"content_type,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Duration int `json:"duration,omitempty"` // Duration in seconds, for video assets
Thumbs []AdFileAssetThumb `json:"thumbs,omitempty"`
FocalPoint *types.FocalPoint `json:"focal_point,omitempty"`
}
AdFileAsset information
func (*AdFileAsset) ClosestThumbBy ¶
func (f *AdFileAsset) ClosestThumbBy(w, h, wmin, hmin int) *AdFileAssetThumb
ClosestThumbBy returns the thumb nearest to (w, h). Thumbs that fit the size borders (IsSuits) are preferred; if none fit, the closest of all thumbs is returned. w or h <= 0 leaves that axis unbounded for the fit check and measures closeness against wmin or hmin. Equal distance keeps the smaller thumb.
func (*AdFileAsset) ThumbBy ¶
func (f *AdFileAsset) ThumbBy(w, h, wmin, hmin int) (th *AdFileAssetThumb)
ThumbBy size borders and specific type
type AdFileAssetThumb ¶
type AdFileAssetThumb struct {
URL string `json:"url"`
Width int `json:"w"`
Height int `json:"h"`
Type types.AdFileAssetType `json:"type,omitempty"`
}
AdFileAssetThumb of the file
func (AdFileAssetThumb) IsSuits ¶
func (th AdFileAssetThumb) IsSuits(w, h, wmin, hmin int) bool
IsSuits thumb by size
type AdFileAssets ¶
type AdFileAssets []*AdFileAsset
AdFileAssets contains the list of file assets
func (AdFileAssets) HasAsset ¶
func (assets AdFileAssets) HasAsset(name string, assetType types.AdFileAssetType) bool
HasAsset returns true if the assets list has an asset with the given name
func (AdFileAssets) Len ¶
func (assets AdFileAssets) Len() int
Len returns the length of the assets list
func (AdFileAssets) RandomAsset ¶
func (assets AdFileAssets) RandomAsset(name string, assetType types.AdFileAssetType) *AdFileAsset
RandomAsset returns a random asset by name (main or other)
func (AdFileAssets) RandomAssetWithSize ¶
func (assets AdFileAssets) RandomAssetWithSize(name string, assetType types.AdFileAssetType, w, h int) *AdFileAsset
RandomAssetWithSize returns a random asset by name and size (main or other)
func (AdFileAssets) RandomMain ¶
func (assets AdFileAssets) RandomMain(assetType types.AdFileAssetType) *AdFileAsset
RandomMain returns a random main asset
func (AdFileAssets) RandomMainAsset ¶
func (assets AdFileAssets) RandomMainAsset(assetType types.AdFileAssetType) *AdFileAsset
RandomMainAsset returns a random main asset
type Application ¶
type Application struct {
ID uint64 // Authoincrement key
Account *Account // Account which application belongs to
AccountID uint64 //
URI string // Unical application identificator
Type types.ApplicationType `gorm:"type:ApplicationType" json:"type"`
Platform types.PlatformType `gorm:"type:PlatformType" json:"platform"`
Premium bool `json:"premium"`
Categories []uint
}
Application model
func ApplicationFromModel ¶
func ApplicationFromModel(app *models.Application) Application
ApplicationFromModel convert database model to specified model
func (*Application) CommissionShareFactor ¶
func (a *Application) CommissionShareFactor() float64
CommissionShareFactor which system get from publisher
func (*Application) ObjectKey ¶
func (a *Application) ObjectKey() string
ObjectKey of the application
type RTBRequestType ¶
type RTBRequestType = types.RTBRequestType
RTBRequestType contains type of representation of request information
type RTBSource ¶
type RTBSource struct {
ID uint64
Account *Account
Protocol string // rtb as default
URL string // RTB client request URL
Method string // HTTP method GET, POST, ect; Default POST
RequestType RTBRequestType // 1 - json, 2 - xml, 3 - ProtoBUFF, 4 - MultipleFormaData, 5 - PLAINTEXT
Headers gosql.NullableJSON[map[string]string]
Options RTBSourceFlags
Filter basefilter.BaseFilter
AuctionType types.AuctionType // default: 0 – first price type, 1 – second price type
RPS int // 0 – unlimit
Timeout int // In milliseconds
Accuracy float64 // Price accuracy for auction in percentages
PriceCorrectionReduce float64 // % 100, 80%, 65.5% - 0 .. 1
MinimalWeight float64
// Price limits
MinBid billing.Money // Minimal bid value
MaxBid billing.Money // Maximal bid value
// TODO
Budget billing.Money // Budget for this source
DailyBudget billing.Money // Daily budget for this source
Config RTBSourceConfig
}
RTBSource describe the source of external DSP platform or similar exchange protocol. All that sources have similar options and very common prefilter configurations
func RTBSourceFromModel ¶
RTBSourceFromModel convert database model to specified model
func (*RTBSource) PriceCorrectionReduceFactor ¶
PriceCorrectionReduceFactor which is a potential Returns percent from 0 to 1 for reducing of the value If there is 10% of price correction, it means that 10% of the final price must be ignored
func (*RTBSource) TestFormat ¶
TestFormat available in filter
type RTBSourceConfig ¶
type RTBSourceConfig = models.RTBSourceConfig
RTBSourceConfig contains configuration for the RTB source
type RTBSourceFlags ¶
type RTBSourceFlags = models.RTBSourceFlags
RTBSourceFlags contains flags for the RTB source
type TrafficRouter ¶
type TrafficRouter struct {
ID uint64
// IDs of RTB sources to which the traffic should be routed
RTBSourceIDs []uint64
// Percentage of traffic to be routed
Percent float32
// Filter criteria for routing traffic
Filter basefilter.BaseFilter
}
TrafficRouter represents a traffic router in the system.
func (*TrafficRouter) ObjectKey ¶
func (d *TrafficRouter) ObjectKey() uint64
ObjectKey of the router
func (*TrafficRouter) Test ¶
func (d *TrafficRouter) Test(target types.TargetPointer) error
Test checks if the target matches the filter criteria.