adtype

package
v0.0.0-...-a08dd98 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 29 Imported by: 7

Documentation

Index

Constants

View Source
const (
	NativeAssetUndefined = iota // Undefined asset
	NativeAssetTitle            // Title asset
	NativeAssetLegend           // Legend asset
	NativeAssetMainImage        // Main image asset
	NativeAssetIcon             // Icon asset
	NativeAssetRating           // Rating asset
	NativeAssetSponsored        // Sponsored asset
)

Native asset IDs enumeration for different native ad components

View Source
const (
	ContentItemLink             = "link"               // URL to which the ad redirects
	ContentItemContent          = "content"            // Main content of the ad
	ContentItemIFrameURL        = "iframe_url"         // URL for embedding the ad in an iframe
	ContentItemNotifyWinURL     = "notify_win_url"     // URL to notify when the ad wins an auction
	ContentItemNotifyDisplayURL = "notify_display_url" // URL to notify when the ad is displayed
)

Content item names represent various components of an advertisement. These constants are used as keys to retrieve specific content items from an ad response.

Variables

View Source
var (
	// For bidding validation
	ErrInvalidCur                = errors.New("bid currency is not valid")
	ErrInvalidCreativeSize       = errors.New("creative size is invalid")
	ErrInvalidViewType           = errors.New("view type is invalid")
	ErrLowPrice                  = errors.New("bid Price is lower than floor price")
	ErrResponseEmpty             = errors.New("response is empty")
	ErrResponseInvalidType       = errors.New("invalid response type")
	ErrResponseInvalidGroup      = errors.New("system not support group winners")
	ErrInvalidItemInitialisation = errors.New("invalid item initialisation")
)

Set of errors

View Source
var (
	ErrInvalidURL = errors.New("invalid URL value")
)

Errors

View Source
var (
	// ErrNewAuctionBidIsHigherThenMaxBid is returned when a new auction bid exceeds the maximum allowed bid.
	ErrNewAuctionBidIsHigherThenMaxBid = errors.New("new auction bid is higher than max bid")
)

Predefined errors used within the adtype package.

Functions

func AdjustPrice

func AdjustPrice(price billing.Money, factor float64, remove bool) billing.Money

func PrepareURL

func PrepareURL(url string, response Responser, it ResponserItem) string

PrepareURL by event

func PriceRevenueShareReduceFactors

func PriceRevenueShareReduceFactors(price billing.Money, rs revenueShareReducerFactorer, remove bool) billing.Money

PriceRevenueShareReduceFactors correction to reduce descreancy

func PriceSourceFactors

func PriceSourceFactors(price billing.Money, src Source, remove bool) billing.Money

PriceSourceFactors currection to reduce descreancy

func PriceSystemCommission

func PriceSystemCommission(price billing.Money, item systemComissionFactorer, remove bool) billing.Money

PriceSystemCommission = 1. - `TrafficSourceCommission`

func ReturnResponse

func ReturnResponse(o *Response)

ReturnResponse back to pool

Types

type AccessPoint

type AccessPoint interface {
	// ID of source
	ID() uint64
}

AccessPoint is the DSP source

type BaseFilter

type BaseFilter struct {
	Secure               int8     // 0 - any, 1 - only secure, 2 - no secure
	Adblock              int8     // 0 - any, 1 - only adblock, 2 - no adblock
	PrivateBrowsing      int8     // 0 - any, 1 - only private, 2 - no private
	IP                   int8     // 0 - any, 1 - IPv4, 2 - IPv6
	Devices              []uint64 // Devices type
	OS                   []uint64
	OSExclude            []uint64
	Browsers             []uint64
	BrowsersExclude      []uint64
	Categories           []uint64
	Countries            []string
	Applications         []uint64
	ApplicationsExclude  []uint64
	Domains              []string
	DomainsExclude       []string
	Zones                []uint64
	ZonesExclude         []uint64
	ExternalZones        []string
	ExternalZonesExclude []string
}

BaseFilter object

func (*BaseFilter) Normalise

func (f *BaseFilter) Normalise()

Normalise params

func (*BaseFilter) Test

func (f *BaseFilter) Test(request *BidRequest) bool

Test base from search request

type BidRequest

type BidRequest struct {
	Ctx context.Context `json:"-"` // Context for request handling

	ID          string                 `json:"id,omitempty"`           // Auction ID
	ExtID       string                 `json:"bidid,omitempty"`        // External Auction ID
	AccessPoint AccessPoint            `json:"-"`                      // Access point information
	Debug       bool                   `json:"debug,omitempty"`        // Debug mode flag
	AuctionType types.AuctionType      `json:"auction_type,omitempty"` // Type of auction
	RequestCtx  *fasthttp.RequestCtx   `json:"-"`                      // HTTP request context
	Request     any                    `json:"-"`                      // Original request from RTB or another protocol
	Person      personification.Person `json:"-"`                      // Personification data
	Imps        []Impression           `json:"imps,omitempty"`         // List of impressions

	AppTarget       *admodels.Application `json:"app_target,omitempty"` // Target application
	Device          *udetect.Device       `json:"device,omitempty"`     // Device information
	App             *udetect.App          `json:"app,omitempty"`        // App information
	Site            *udetect.Site         `json:"site,omitempty"`       // Site information
	User            *User                 `json:"user,omitempty"`       // User information
	Secure          int                   `json:"secure,omitempty"`     // Security flag (1 if secure)
	Adblock         int                   `json:"adb,omitempty"`        // Adblock flag (1 if adblock enabled)
	PrivateBrowsing int                   `json:"pb,omitempty"`         // Private browsing flag (1 if enabled)
	Ext             map[string]any        `json:"ext,omitempty"`        // Additional extensions
	Timemark        time.Time             `json:"timemark,omitempty"`   // Timestamp of the request
	Tracer          any                   `json:"-"`                    // Tracing information
	// contains filtered or unexported fields
}

BidRequest represents a bid request in the ad system. It contains all necessary information for processing an ad bid.

func (*BidRequest) Age

func (r *BidRequest) Age() uint

Age returns the most relevant age of the user. Returns the starting age if AgeStart <= AgeEnd, otherwise returns AgeStart.

func (*BidRequest) Ages

func (r *BidRequest) Ages() [2]uint

Ages returns a range of ages [AgeStart, AgeEnd]. If AgeStart > AgeEnd, it still returns [AgeStart, AgeEnd].

func (*BidRequest) AppID

func (r *BidRequest) AppID() uint64

AppID returns the ID of the target application. Returns 0 if the app target is unavailable.

func (*BidRequest) AppInfo

func (r *BidRequest) AppInfo() *udetect.App

AppInfo returns the application information associated with the BidRequest.

func (*BidRequest) BrowserID

func (r *BidRequest) BrowserID() uint64

BrowserID returns the ID of the user's browser. Returns 0 if device or browser information is unavailable.

func (*BidRequest) BrowserInfo

func (r *BidRequest) BrowserInfo() *udetect.Browser

BrowserInfo returns the browser information associated with the BidRequest.

func (*BidRequest) CarrierInfo

func (r *BidRequest) CarrierInfo() *udetect.Carrier

CarrierInfo returns the carrier information associated with the user's geography.

func (*BidRequest) Categories

func (r *BidRequest) Categories() []uint64

Categories returns a slice of category IDs associated with the BidRequest. Currently, it returns the cached categoryArray. (Note: The implementation is incomplete and commented out for future development.)

func (*BidRequest) City

func (r *BidRequest) City() string

City returns the city associated with the user's geography. Returns an empty string if geographical information is unavailable.

func (*BidRequest) DeviceID

func (r *BidRequest) DeviceID() uint64

DeviceID returns the ID of the device associated with the BidRequest. Returns 0 if device information is unavailable.

func (*BidRequest) DeviceInfo

func (r *BidRequest) DeviceInfo() *udetect.Device

DeviceInfo returns the device information associated with the BidRequest. It initializes default values if device, browser, or OS information is missing.

func (*BidRequest) DeviceType

func (r *BidRequest) DeviceType() uint64

DeviceType returns the type of the device as an unsigned integer. Returns 0 if device information is unavailable.

func (*BidRequest) Domain

func (r *BidRequest) Domain() []string

Domain returns a list of domains associated with the site or app. It prepares the domain list by aggregating from Site and App information.

func (*BidRequest) DomainName

func (r *BidRequest) DomainName() string

DomainName returns the primary domain name of the site or the bundle name of the app.

func (*BidRequest) ExtTargetIDs

func (r *BidRequest) ExtTargetIDs() []string

ExtTargetIDs returns a slice of external target IDs associated with the BidRequest.

func (*BidRequest) FormatBitset

func (r *BidRequest) FormatBitset() *searchtypes.NumberBitset[uint]

FormatBitset returns a bitset representing the format IDs in the BidRequest. It populates the bitset if it's currently empty.

func (*BidRequest) FormatTypeMask

func (r *BidRequest) FormatTypeMask() types.FormatTypeBitset

FormatTypeMask returns a bitmask representing the types of formats in the BidRequest. It populates the mask if it's currently empty.

func (*BidRequest) Formats

func (r *BidRequest) Formats() []*types.Format

Formats returns the list of formats associated with the BidRequest. If the formats slice is empty, it aggregates formats from all impressions.

func (*BidRequest) Gender

func (r *BidRequest) Gender() byte

Gender returns the most relevant gender as a byte. Returns '?' if gender information is unavailable or invalid.

func (*BidRequest) GeoCode

func (r *BidRequest) GeoCode() string

GeoCode returns the country code associated with the user's geography. Returns "**" if geographical information is unavailable.

func (*BidRequest) GeoID

func (r *BidRequest) GeoID() uint64

GeoID returns the geographical ID associated with the user. Returns 0 if geographical information is unavailable.

func (*BidRequest) GeoInfo

func (r *BidRequest) GeoInfo() *udetect.Geo

GeoInfo returns the geographical information associated with the BidRequest.

func (*BidRequest) Get

func (r *BidRequest) Get(key string) any

Get retrieves a value from the BidRequest's extension map by key. Returns nil if the key does not exist.

func (*BidRequest) HTTPRequest

func (r *BidRequest) HTTPRequest() *fasthttp.RequestCtx

HTTPRequest returns the underlying HTTP request context.

func (*BidRequest) Height

func (r *BidRequest) Height() int

Height returns the height of the device's browser. Returns 0 if device or browser information is unavailable.

func (*BidRequest) ImpressionByID

func (r *BidRequest) ImpressionByID(id string) *Impression

ImpressionByID returns a pointer to the Impression with the specified ID. Returns nil if no matching impression is found.

func (*BidRequest) ImpressionByIDvariation

func (r *BidRequest) ImpressionByIDvariation(id string) *Impression

ImpressionByIDvariation returns a pointer to the first Impression whose ID is a prefix of the provided ID. This allows matching impressions even if the ID contains additional postfixes. Returns nil if no matching impression is found.

func (*BidRequest) ImpressionUpdate

func (r *BidRequest) ImpressionUpdate(fn func(imp *Impression) bool)

ImpressionUpdate applies a provided function to each impression in the BidRequest. If the function returns true, the impression is updated.

func (*BidRequest) Init

func (r *BidRequest) Init(formats types.FormatsAccessor)

Init initializes the BidRequest with basic information. It resets the formats slice and format bitset, and initializes each impression using the provided formats accessor.

func (*BidRequest) IsAdblock

func (r *BidRequest) IsAdblock() bool

IsAdblock checks if the user has an ad blocker enabled.

func (*BidRequest) IsIPv6

func (r *BidRequest) IsIPv6() bool

IsIPv6 checks if the user's IP address is IPv6.

func (*BidRequest) IsPrivateBrowsing

func (r *BidRequest) IsPrivateBrowsing() bool

IsPrivateBrowsing checks if the user is in private browsing mode.

func (*BidRequest) IsProxy

func (r *BidRequest) IsProxy() bool

IsProxy checks if the user is using a proxy.

func (*BidRequest) IsRobot

func (r *BidRequest) IsRobot() bool

IsRobot checks if the user is a robot.

func (*BidRequest) IsSecure

func (r *BidRequest) IsSecure() bool

IsSecure checks if the request is made over a secure connection.

func (*BidRequest) Keywords

func (r *BidRequest) Keywords() []string

Keywords returns a slice of keywords associated with the user. Returns nil if user information is unavailable.

func (*BidRequest) LanguageID

func (r *BidRequest) LanguageID() uint64

LanguageID returns the language ID based on the primary language of the browser.

func (*BidRequest) MinECPM

func (r *BidRequest) MinECPM() (minBid billing.Money)

MinECPM calculates and returns the minimum ECPM (Effective Cost Per Mille) acceptable for the BidRequest. It iterates through all impressions and selects the highest bid floor.

func (*BidRequest) OSID

func (r *BidRequest) OSID() uint64

OSID returns the ID of the user's operating system. Returns 0 if device or OS information is unavailable.

func (*BidRequest) OSInfo

func (r *BidRequest) OSInfo() *udetect.OS

OSInfo returns the operating system information associated with the BidRequest.

func (*BidRequest) ProjectID

func (r *BidRequest) ProjectID() uint64

ProjectID returns the Project ID associated with the BidRequest. Currently returns 0 as a placeholder.

func (*BidRequest) Release

func (r *BidRequest) Release()

Release releases any resources associated with the BidRequest. If the original request implements the releaser interface, it calls the Release method.

func (*BidRequest) ServiceDomain

func (r *BidRequest) ServiceDomain() string

ServiceDomain returns the domain of the service handling the request.

func (*BidRequest) Set

func (r *BidRequest) Set(key string, val any)

Set sets a key-value pair in the BidRequest's extension map.

func (*BidRequest) SetSourceFilter

func (r *BidRequest) SetSourceFilter(ids ...uint64)

SetSourceFilter sets the source filter IDs for the BidRequest. It replaces any existing source IDs with the provided ones.

func (*BidRequest) Sex

func (r *BidRequest) Sex() uint

Sex returns the user's sex as an unsigned integer. Returns 0 if user information is unavailable.

func (*BidRequest) SiteInfo

func (r *BidRequest) SiteInfo() *udetect.Site

SiteInfo returns the site information associated with the BidRequest. If the site is unavailable, it returns the default site information. Returns nil if neither site nor app information is available.

func (*BidRequest) Size

func (r *BidRequest) Size() (w, h int)

Size returns the width and height of the area of visibility for the ad.

func (*BidRequest) SourceFilterCheck

func (r *BidRequest) SourceFilterCheck(id uint64) bool

SourceFilterCheck checks if a given source ID is allowed by the current filter. Returns true if no filter is set or if the ID is present in the filter.

func (*BidRequest) String

func (r *BidRequest) String() (res string)

String implements the fmt.Stringer interface for BidRequest. It returns a pretty-printed JSON representation of the BidRequest. If marshalling fails, it returns an error message in JSON format.

func (*BidRequest) Tags

func (r *BidRequest) Tags() []string

Tags returns a list of tags associated with the BidRequest. It aggregates keywords from the user and site information.

func (*BidRequest) TargetID

func (r *BidRequest) TargetID() uint64

TargetID returns the target ID if there is exactly one impression with a target. Otherwise, returns 0.

func (*BidRequest) TargetIDs

func (r *BidRequest) TargetIDs() []uint64

TargetIDs returns a slice of target IDs associated with the BidRequest.

func (*BidRequest) Time

func (r *BidRequest) Time() time.Time

Time returns the timestamp of the BidRequest.

func (*BidRequest) Unset

func (r *BidRequest) Unset(keys ...string)

Unset removes one or more keys from the BidRequest's extension map.

func (*BidRequest) UserInfo

func (r *BidRequest) UserInfo() *User

UserInfo returns the user information associated with the BidRequest. It initializes default values if user or geographical information is missing.

func (*BidRequest) Validate

func (r *BidRequest) Validate() error

Validate performs validation on the BidRequest. Currently, it always returns nil, but can be extended to include validation logic.

func (*BidRequest) Width

func (r *BidRequest) Width() int

Width returns the width of the device's browser. Returns 0 if device or browser information is unavailable.

type Data

type Data struct {
	Name    string    `json:"name,omitempty"`
	Segment []Segment `json:"segment,omitempty"`
}

Data item segment

type Impression

type Impression struct {
	ID                string          `json:"id,omitempty"`                  // Internal impression ID
	ExternalID        string          `json:"extid,omitempty"`               // External impression ID (ImpID)
	ExternalTargetID  string          `json:"exttrgid"`                      // External zone ID (tagid)
	Request           any             `json:"request,omitempty"`             // Contains subrequest from RTB or another protocol
	Target            admodels.Target `json:"target,omitempty"`              //
	BidFloorCPM       billing.Money   `json:"bid_floor,omitempty"`           //
	PurchaseViewPrice billing.Money   `json:"purchase_view_price,omitempty"` //
	Pos               int             `json:"pos,omitempty"`                 // 5.4 Ad Position
	Count             int             `json:"cnt,omitempty"`                 // Count of places for multiple banners

	// Sizes and position on the screen
	X         int `json:"x,omitempty"`
	Y         int `json:"y,omitempty"`
	Width     int `json:"w,omitempty"`
	Height    int `json:"h,omitempty"`
	WidthMax  int `json:"wm,omitempty"`
	HeightMax int `json:"hm,omitempty"`

	// Additional identifiers
	SubID1 string `json:"subid1,omitempty"`
	SubID2 string `json:"subid2,omitempty"`
	SubID3 string `json:"subid3,omitempty"`
	SubID4 string `json:"subid4,omitempty"`
	SubID5 string `json:"subid5,omitempty"`

	// Format types for impression
	FormatTypes types.FormatTypeBitset `json:"-"`

	Ext map[string]any `json:"ext,omitempty"`
	// contains filtered or unexported fields
}

Impression target

func (*Impression) AccountID

func (i *Impression) AccountID() uint64

AccountID number

func (*Impression) CommissionShareFactor

func (i *Impression) CommissionShareFactor() float64

CommissionShareFactor which system get from publisher from 0 to 1

func (*Impression) FormatBitset

func (i *Impression) FormatBitset() *searchtypes.NumberBitset[uint]

FormatBitset of IDs

func (*Impression) FormatByType

func (i *Impression) FormatByType(tp types.FormatType) *types.Format

FormatByType of formats

func (*Impression) Formats

func (i *Impression) Formats() (f []*types.Format)

Formats models

func (*Impression) Get

func (i *Impression) Get(key string) any

Get context item by key

func (*Impression) IDByFormat

func (i *Impression) IDByFormat(format *types.Format) string

IDByFormat return specific ID to link format

func (*Impression) Init

func (i *Impression) Init(formats types.FormatsAccessor)

Init internal information

func (*Impression) IsDirect

func (i *Impression) IsDirect() bool

IsDirect value

func (*Impression) IsNative

func (i *Impression) IsNative() bool

IsNative target support

func (*Impression) IsStandart

func (i *Impression) IsStandart() bool

IsStandart target support

func (*Impression) PurchasePrice

func (i *Impression) PurchasePrice(action admodels.Action) billing.Money

PurchasePrice return the price of need to pay for the action to the connected network or application if price is fixed

func (*Impression) RTBNativeRequest

func (i *Impression) RTBNativeRequest() *openrtbnreq.Request

RTBNativeRequest object

func (*Impression) RTBNativeRequestV3

func (i *Impression) RTBNativeRequestV3() *openrtbnreq3.Request

RTBNativeRequestV3 object

func (*Impression) Set

func (i *Impression) Set(key string, val any)

Set context item with key

func (*Impression) TargetID

func (i *Impression) TargetID() uint

TargetID value

func (*Impression) Unset

func (i *Impression) Unset(keys ...string)

Unset context item with keys

type NoSupportError

type NoSupportError struct {
	NSField string
}

NoSupportError object

func (NoSupportError) Error

func (e NoSupportError) Error() string

Error text

type PriceFactor

type PriceFactor uint32

PriceFactor defines action to calculate the factor

const (
	NonePriceFactor            PriceFactor = 0x0000
	AllPriceFactors            PriceFactor = 0xffffffff
	SourcePriceFactor          PriceFactor = 0x0001
	SystemComissionPriceFactor PriceFactor = 0x0002
	TargetReducePriceFactor    PriceFactor = 0x0004
)

func PriceFactorFromList

func PriceFactorFromList(factors ...PriceFactor) (f PriceFactor)

PriceFactorFromList create factor from list

func (PriceFactor) AddComission

func (f PriceFactor) AddComission(price billing.Money, it ResponserItem) (comissions billing.Money)

AddComission to price and rеturns comissions with positive sign `+`

func (PriceFactor) RemoveComission

func (f PriceFactor) RemoveComission(price billing.Money, it ResponserItem) (comissions billing.Money)

RemoveComission from price and rеturns comissions with negative sign `-`

type RequestStrategy

type RequestStrategy int

RequestStrategy defines politics of request sending

const (
	// AsynchronousRequestStrategy is default strategy implies
	// requesting all auction participants and choising the most
	// profitable variant of all
	AsynchronousRequestStrategy RequestStrategy = iota

	// SingleRequestStrategy tells that if response was
	// received it should be performed
	SingleRequestStrategy
)

func (RequestStrategy) IsAsynchronous

func (rs RequestStrategy) IsAsynchronous() bool

func (RequestStrategy) IsSingle

func (rs RequestStrategy) IsSingle() bool

type Response

type Response struct {
	// contains filtered or unexported fields
}

Response from different sources

func BorrowResponse

func BorrowResponse(request *BidRequest, source Source, items []ResponserItemCommon, err error) *Response

BorrowResponse object

func NewErrorResponse

func NewErrorResponse(request *BidRequest, err error) *Response

NewErrorResponse object

func NewResponse

func NewResponse(request *BidRequest, source Source, items []ResponserItemCommon, err error) *Response

NewResponse common object

func (*Response) AddItem

func (r *Response) AddItem(it ResponserItemCommon)

AddItem to response

func (*Response) Ads

func (r *Response) Ads() []ResponserItemCommon

Ads list

func (*Response) AuctionID

func (r *Response) AuctionID() string

AuctionID response

func (*Response) AuctionType

func (r *Response) AuctionType() types.AuctionType

AuctionType of request

func (*Response) Context

func (r *Response) Context(ctx ...context.Context) context.Context

Context value

func (*Response) Count

func (r *Response) Count() int

Count of response items

func (*Response) Error

func (r *Response) Error() error

Error of the response

func (*Response) Get

func (r *Response) Get(key string) any

Get context item by key

func (*Response) Item

func (r *Response) Item(impid string) ResponserItemCommon

Item by impression code

func (*Response) Release

func (r *Response) Release()

Release response and all linked objects

func (*Response) Request

func (r *Response) Request() *BidRequest

Request information

func (*Response) Source

func (r *Response) Source() Source

Source of response

func (*Response) Validate

func (r *Response) Validate() (err error)

Validate response

type ResponseEmpty

type ResponseEmpty struct {
	ItemID string
	Req    *BidRequest
	Src    Source
	Imp    *Impression
	Bid    *openrtb.Bid
	Err    error
	// contains filtered or unexported fields
}

ResponseEmpty object represents empty response and response item

func NewEmptyResponse

func NewEmptyResponse(request *BidRequest, src Source, err error) *ResponseEmpty

NewEmptyResponse by bid request

func (ResponseEmpty) Ads

Ads list

func (ResponseEmpty) AuctionID

func (r ResponseEmpty) AuctionID() string

AuctionID returns ID of the current auction

func (ResponseEmpty) AuctionType

func (r ResponseEmpty) AuctionType() types.AuctionType

AuctionType returns type of the auction (first price, second price, etc)

func (*ResponseEmpty) Context

func (r *ResponseEmpty) Context(ctx ...context.Context) context.Context

Context value

func (ResponseEmpty) Count

func (r ResponseEmpty) Count() int

Count of response items

func (ResponseEmpty) Error

func (r ResponseEmpty) Error() error

Error of the response

func (ResponseEmpty) ExtImpressionID

func (r ResponseEmpty) ExtImpressionID() string

ExtImpressionID it's unique code of the auction bid impression

func (ResponseEmpty) ExtTargetID

func (r ResponseEmpty) ExtTargetID() string

ExtTargetID of the external network

func (*ResponseEmpty) Get

func (r *ResponseEmpty) Get(key string) (res any)

Get ext field

func (ResponseEmpty) ID

func (r ResponseEmpty) ID() string

ID of current response item (unique code of current response)

func (ResponseEmpty) Impression

func (r ResponseEmpty) Impression() *Impression

Impression place object

func (ResponseEmpty) ImpressionID

func (r ResponseEmpty) ImpressionID() string

ImpressionID unique code string

func (ResponseEmpty) InternalAuctionCPMBid

func (r ResponseEmpty) InternalAuctionCPMBid() billing.Money

InternalAuctionCPMBid value provides maximal possible price without any comission According to this value the system can choice the best item for the auction

func (ResponseEmpty) Item

Item by impression code

func (ResponseEmpty) PriorityFormatType

func (r ResponseEmpty) PriorityFormatType() types.FormatType

PriorityFormatType from current Ad

func (*ResponseEmpty) Release

func (r *ResponseEmpty) Release()

Release response and all linked objects

func (ResponseEmpty) Request

func (r ResponseEmpty) Request() *BidRequest

Request returns the original request object

func (ResponseEmpty) Source

func (r ResponseEmpty) Source() Source

Source returns source of the response

func (ResponseEmpty) Validate

func (r ResponseEmpty) Validate() error

Validate response

type ResponseItemBlank

type ResponseItemBlank struct {
	ItemID string
	Imp    *Impression
	Src    Source

	FormatVal *types.Format

	PricingModelVal types.PricingModel
	PriceScope      price.PriceScope
}

ResponseItemBlank value

func (*ResponseItemBlank) AccountID

func (*ResponseItemBlank) AccountID() uint64

AccountID number

func (*ResponseItemBlank) ActionURL

func (*ResponseItemBlank) ActionURL() string

ActionURL returns target resource link for direct and banner click as well

func (*ResponseItemBlank) AdID

func (*ResponseItemBlank) AdID() uint64

AdID number

func (*ResponseItemBlank) Asset

func (*ResponseItemBlank) Asset(name string) *admodels.AdAsset

Asset by name

func (*ResponseItemBlank) Assets

Assets list

func (*ResponseItemBlank) BidPrice

func (it *ResponseItemBlank) BidPrice() billing.Money

BidPrice returns bid price for the external auction source. The current bid price will be adjusted according to the source correction factor and the commission share factor

func (*ResponseItemBlank) CampaignID

func (*ResponseItemBlank) CampaignID() uint64

CampaignID number

func (*ResponseItemBlank) ClickTrackerLinks() []string

ClickTrackerLinks returns traking links for click action

func (*ResponseItemBlank) CommissionShareFactor

func (it *ResponseItemBlank) CommissionShareFactor() float64

CommissionShareFactor returns the commission share percentage which system gets from publisher.

func (*ResponseItemBlank) ContentFields

func (*ResponseItemBlank) ContentFields() map[string]any

ContentFields from advertisement object

func (*ResponseItemBlank) ContentItem

func (*ResponseItemBlank) ContentItem(name string) any

ContentItem returns the ad response data

func (*ResponseItemBlank) ContentItemString

func (*ResponseItemBlank) ContentItemString(name string) string

ContentItemString from the ad

func (*ResponseItemBlank) Context

func (*ResponseItemBlank) Context(ctx ...context.Context) context.Context

Context value

func (*ResponseItemBlank) ECPM

func (it *ResponseItemBlank) ECPM() billing.Money

ECPM returns the effective cost per mille of the item.

func (*ResponseItemBlank) ExtImpressionID

func (it *ResponseItemBlank) ExtImpressionID() string

ExtImpressionID it's unique code of the auction bid impression

func (*ResponseItemBlank) ExtTargetID

func (it *ResponseItemBlank) ExtTargetID() string

ExtTargetID of the external network

func (*ResponseItemBlank) FinalPrice

func (it *ResponseItemBlank) FinalPrice(action admodels.Action) billing.Money

FinalPrice returns final price for the item which is including all possible commissions with all corrections

func (*ResponseItemBlank) FixedPurchasePrice

func (it *ResponseItemBlank) FixedPurchasePrice(action admodels.Action) billing.Money

FixedPurchasePrice returns the fixed price of the action

func (*ResponseItemBlank) Format

func (it *ResponseItemBlank) Format() *types.Format

Format object

func (*ResponseItemBlank) Get

func (*ResponseItemBlank) Get(key string) any

Get ext field

func (*ResponseItemBlank) Height

func (*ResponseItemBlank) Height() int

Height of item

func (*ResponseItemBlank) ID

func (it *ResponseItemBlank) ID() string

ID of current response item (unique code of current response)

func (*ResponseItemBlank) Impression

func (it *ResponseItemBlank) Impression() *Impression

Impression place object

func (*ResponseItemBlank) ImpressionID

func (it *ResponseItemBlank) ImpressionID() string

ImpressionID unique code string

func (*ResponseItemBlank) ImpressionTrackerLinks() []string

ImpressionTrackerLinks returns traking links for impression action

func (*ResponseItemBlank) InternalAuctionCPMBid

func (it *ResponseItemBlank) InternalAuctionCPMBid() billing.Money

InternalAuctionCPMBid value provides maximal possible price without any comission According to this value the system can choice the best item for the auction

func (*ResponseItemBlank) IsBackup

func (*ResponseItemBlank) IsBackup() bool

IsBackup indicates whether the advertisement is a backup ad type.

func (*ResponseItemBlank) IsDirect

func (*ResponseItemBlank) IsDirect() bool

IsDirect AD type

func (*ResponseItemBlank) MainAsset

func (*ResponseItemBlank) MainAsset() *admodels.AdAsset

MainAsset from response

func (*ResponseItemBlank) NetworkName

func (*ResponseItemBlank) NetworkName() string

NetworkName by source

func (*ResponseItemBlank) PotentialPrice

func (it *ResponseItemBlank) PotentialPrice(action admodels.Action) billing.Money

PotentialPrice wich can be received from source but was marked as descrepancy

func (*ResponseItemBlank) Price

func (it *ResponseItemBlank) Price(action admodels.Action) billing.Money

Price per specific action type (view, click, lead, etc)

func (*ResponseItemBlank) PriceTestMode

func (it *ResponseItemBlank) PriceTestMode() bool

PriceTestMode returns true if the price is in test mode

func (*ResponseItemBlank) PricingModel

func (it *ResponseItemBlank) PricingModel() types.PricingModel

PricingModel of advertisement

func (*ResponseItemBlank) PriorityFormatType

func (it *ResponseItemBlank) PriorityFormatType() types.FormatType

PriorityFormatType from current Ad

func (*ResponseItemBlank) PurchasePrice

func (it *ResponseItemBlank) PurchasePrice(action admodels.Action) billing.Money

PurchasePrice gives the price of view from external resource. The cost of this request.

func (*ResponseItemBlank) Second

func (*ResponseItemBlank) Second() *SecondAd

Second campaigns

func (*ResponseItemBlank) SetAuctionCPMBid

func (it *ResponseItemBlank) SetAuctionCPMBid(price billing.Money, includeFactors ...PriceFactor) error

SetAuctionCPMBid value for external sources auction the system will pay

func (*ResponseItemBlank) SetBidPrice

func (it *ResponseItemBlank) SetBidPrice(bid billing.Money) error

SetBidPrice value for external sources auction the system will pay

func (*ResponseItemBlank) Source

func (it *ResponseItemBlank) Source() Source

Source of response

func (*ResponseItemBlank) SourceCorrectionFactor

func (it *ResponseItemBlank) SourceCorrectionFactor() float64

SourceCorrectionFactor value for the source

func (*ResponseItemBlank) TargetCorrectionFactor

func (it *ResponseItemBlank) TargetCorrectionFactor() float64

TargetCorrectionFactor value for the target

func (*ResponseItemBlank) Validate

func (*ResponseItemBlank) Validate() error

Validate item

func (*ResponseItemBlank) ViewTrackerLinks() []string

ViewTrackerLinks returns traking links for view action

func (*ResponseItemBlank) Width

func (*ResponseItemBlank) Width() int

Width of item

type ResponseItemBlock

type ResponseItemBlock struct {
	Items []ResponserItem
	// contains filtered or unexported fields
}

ResponseItemBlock group of simple items

func (*ResponseItemBlock) Ads

func (i *ResponseItemBlock) Ads() []ResponserItem

Ads list

func (*ResponseItemBlock) Context

func (i *ResponseItemBlock) Context(ctx ...context.Context) context.Context

Context value

func (*ResponseItemBlock) Count

func (i *ResponseItemBlock) Count() int

Count of response items

func (*ResponseItemBlock) ExtImpressionID

func (i *ResponseItemBlock) ExtImpressionID() string

ExtImpressionID it's unique code of the auction bid impression

func (*ResponseItemBlock) ExtTargetID

func (i *ResponseItemBlock) ExtTargetID() string

ExtTargetID of the external network

func (*ResponseItemBlock) Get

func (i *ResponseItemBlock) Get(key string) any

Get ext field

func (*ResponseItemBlock) ID

func (i *ResponseItemBlock) ID() string

ID of current response item (unique code of current response)

func (*ResponseItemBlock) Impression

func (i *ResponseItemBlock) Impression() *Impression

Impression place object

func (*ResponseItemBlock) ImpressionID

func (i *ResponseItemBlock) ImpressionID() string

ImpressionID code

func (*ResponseItemBlock) InternalAuctionCPMBid

func (i *ResponseItemBlock) InternalAuctionCPMBid() (bid billing.Money)

InternalAuctionCPMBid value provides maximal possible price without any comission According to this value the system can choice the best item for the auction

func (*ResponseItemBlock) Price

func (i *ResponseItemBlock) Price(action admodels.Action) (price billing.Money)

Price of whole response

func (*ResponseItemBlock) PriorityFormatType

func (i *ResponseItemBlock) PriorityFormatType() types.FormatType

PriorityFormatType from current Ad

func (*ResponseItemBlock) Validate

func (i *ResponseItemBlock) Validate() (err error)

Validate response

type ResponseItemEmpty

type ResponseItemEmpty struct{}

ResponseItemEmpty value

func (*ResponseItemEmpty) AccountID

func (*ResponseItemEmpty) AccountID() uint64

AccountID number

func (*ResponseItemEmpty) ActionURL

func (*ResponseItemEmpty) ActionURL() string

ActionURL returns target resource link for direct and banner click as well

func (*ResponseItemEmpty) AdID

func (*ResponseItemEmpty) AdID() uint64

AdID number

func (*ResponseItemEmpty) Asset

func (*ResponseItemEmpty) Asset(name string) *admodels.AdAsset

Asset by name

func (*ResponseItemEmpty) Assets

Assets list

func (*ResponseItemEmpty) BidPrice

func (*ResponseItemEmpty) BidPrice() billing.Money

BidPrice returns bid price for the external auction source. The current bid price will be adjusted according to the source correction factor and the commission share factor

func (*ResponseItemEmpty) CampaignID

func (*ResponseItemEmpty) CampaignID() uint64

CampaignID number

func (*ResponseItemEmpty) ClickTrackerLinks() []string

ClickTrackerLinks returns traking links for click action

func (*ResponseItemEmpty) CommissionShareFactor

func (*ResponseItemEmpty) CommissionShareFactor() float64

CommissionShareFactor returns the multipler for commission calculation which system get from user revenue from 0 to 1

func (*ResponseItemEmpty) ContentFields

func (*ResponseItemEmpty) ContentFields() map[string]any

ContentFields from advertisement object

func (*ResponseItemEmpty) ContentItem

func (*ResponseItemEmpty) ContentItem(name string) any

ContentItem returns the ad response data

func (*ResponseItemEmpty) ContentItemString

func (*ResponseItemEmpty) ContentItemString(name string) string

ContentItemString from the ad

func (*ResponseItemEmpty) Context

func (*ResponseItemEmpty) Context(ctx ...context.Context) context.Context

Context value

func (*ResponseItemEmpty) ECPM

ECPM item value

func (*ResponseItemEmpty) ExtImpressionID

func (*ResponseItemEmpty) ExtImpressionID() string

ExtImpressionID it's unique code of the auction bid impression

func (*ResponseItemEmpty) ExtTargetID

func (*ResponseItemEmpty) ExtTargetID() string

ExtTargetID of the external network

func (*ResponseItemEmpty) FinalPrice

func (*ResponseItemEmpty) FinalPrice(action admodels.Action) billing.Money

FinalPrice returns final price for the item which is including all possible commissions with all corrections

func (*ResponseItemEmpty) Format

func (*ResponseItemEmpty) Format() *types.Format

Format object

func (*ResponseItemEmpty) Get

func (*ResponseItemEmpty) Get(key string) any

Get ext field

func (*ResponseItemEmpty) Height

func (*ResponseItemEmpty) Height() int

Height of item

func (*ResponseItemEmpty) ID

func (*ResponseItemEmpty) ID() string

ID of current response item (unique code of current response)

func (*ResponseItemEmpty) Impression

func (*ResponseItemEmpty) Impression() *Impression

Impression place object

func (*ResponseItemEmpty) ImpressionID

func (*ResponseItemEmpty) ImpressionID() string

ImpressionID unique code string

func (*ResponseItemEmpty) ImpressionTrackerLinks() []string

ImpressionTrackerLinks returns traking links for impression action

func (*ResponseItemEmpty) InternalAuctionCPMBid

func (*ResponseItemEmpty) InternalAuctionCPMBid() billing.Money

InternalAuctionCPMBid value provides maximal possible price without any comission According to this value the system can choice the best item for the auction

func (*ResponseItemEmpty) IsBackup

func (*ResponseItemEmpty) IsBackup() bool

IsBackup indicates whether the advertisement is a backup ad type.

func (*ResponseItemEmpty) IsDirect

func (*ResponseItemEmpty) IsDirect() bool

IsDirect AD type

func (*ResponseItemEmpty) MainAsset

func (*ResponseItemEmpty) MainAsset() *admodels.AdAsset

MainAsset from response

func (*ResponseItemEmpty) NetworkName

func (*ResponseItemEmpty) NetworkName() string

NetworkName by source

func (*ResponseItemEmpty) PotentialPercent

func (*ResponseItemEmpty) PotentialPercent() float64

PotentialPercent money

func (*ResponseItemEmpty) PotentialPrice

func (*ResponseItemEmpty) PotentialPrice(action admodels.Action) billing.Money

PotentialPrice wich can be received from source but was marked as descrepancy

func (*ResponseItemEmpty) Price

Price per specific action type (view, click, lead, etc)

func (*ResponseItemEmpty) PriceTestMode

func (*ResponseItemEmpty) PriceTestMode() bool

PriceTestMode returns true if the price is in test mode

func (*ResponseItemEmpty) PricingModel

func (*ResponseItemEmpty) PricingModel() types.PricingModel

PricingModel of advertisement

func (*ResponseItemEmpty) PriorityFormatType

func (*ResponseItemEmpty) PriorityFormatType() types.FormatType

PriorityFormatType from current Ad

func (*ResponseItemEmpty) PurchasePrice

func (*ResponseItemEmpty) PurchasePrice(action admodels.Action) billing.Money

PurchasePrice gives the price of view from external resource. The cost of this request.

func (*ResponseItemEmpty) Second

func (*ResponseItemEmpty) Second() *SecondAd

Second campaigns

func (*ResponseItemEmpty) SetAuctionCPMBid

func (*ResponseItemEmpty) SetAuctionCPMBid(price billing.Money, includeFactors ...PriceFactor) error

SetAuctionCPMBid value for external sources auction the system will pay

func (*ResponseItemEmpty) SetBidPrice

func (*ResponseItemEmpty) SetBidPrice(price billing.Money) error

SetBidPrice value for external sources auction the system will pay

func (*ResponseItemEmpty) Source

func (*ResponseItemEmpty) Source() Source

Source of response

func (*ResponseItemEmpty) SourceCorrectionFactor

func (it *ResponseItemEmpty) SourceCorrectionFactor() float64

SourceCorrectionFactor value for the source

func (*ResponseItemEmpty) TargetCorrectionFactor

func (it *ResponseItemEmpty) TargetCorrectionFactor() float64

TargetCorrectionFactor value for the target

func (*ResponseItemEmpty) Validate

func (*ResponseItemEmpty) Validate() error

Validate item

func (*ResponseItemEmpty) ViewTrackerLinks() []string

ViewTrackerLinks returns traking links for view action

func (*ResponseItemEmpty) Width

func (*ResponseItemEmpty) Width() int

Width of item

type Responser

type Responser interface {
	// AuctionID response
	AuctionID() string

	// AuctionType of request
	AuctionType() types.AuctionType

	// Source of response
	Source() Source

	// Request information
	Request() *BidRequest

	// Ads list
	Ads() []ResponserItemCommon

	// Item by impression code
	Item(impid string) ResponserItemCommon

	// Count of response items
	Count() int

	// Validate response
	Validate() error

	// Error of the response
	Error() error

	// Context value
	Context(ctx ...context.Context) context.Context

	// Get context item by key
	Get(key string) any

	// Release response and all linked objects
	Release()
}

Responser type

type ResponserItem

type ResponserItem interface {
	ResponserItemCommon

	// NetworkName returns the name of the ad network that provided the response.
	NetworkName() string

	// AdID returns the unique identifier of the advertisement.
	AdID() uint64

	// AccountID returns the unique identifier of the advertiser's account.
	AccountID() uint64

	// CampaignID returns the unique identifier of the advertising campaign.
	CampaignID() uint64

	// Format returns the format information of the advertisement.
	Format() *types.Format

	// PricingModel returns the pricing model used for the advertisement (e.g., CPC, CPM).
	PricingModel() types.PricingModel

	// ContentItem retrieves the ad response data for a given content item name.
	// It returns the content in its original type.
	ContentItem(name string) any

	// ContentItemString retrieves the ad response data for a given content item name as a string.
	ContentItemString(name string) string

	// ContentFields returns a map of all content fields associated with the advertisement.
	ContentFields() map[string]any

	// MainAsset returns the primary asset of the advertisement (e.g., image, video).
	MainAsset() *admodels.AdAsset

	// Assets returns a list of all assets associated with the advertisement.
	Assets() admodels.AdAssets

	// Source returns the source information of the advertisement response.
	Source() Source

	// ImpressionTrackerLinks returns traking links for impression action
	ImpressionTrackerLinks() []string

	// ViewTrackerLinks returns a slice of tracking URLs for view actions.
	ViewTrackerLinks() []string

	// ClickTrackerLinks returns a slice of tracking URLs for click actions.
	ClickTrackerLinks() []string

	// IsDirect indicates whether the advertisement is a direct ad type.
	IsDirect() bool

	// IsBackup indicates whether the advertisement is a backup ad type.
	IsBackup() bool

	// ActionURL returns the target URL for direct and banner click actions.
	ActionURL() string

	// Width returns the width of the advertisement in pixels.
	Width() int

	// Height returns the height of the advertisement in pixels.
	Height() int

	// ECPM returns the Effective Cost Per Mille (thousand impressions) value of the advertisement.
	ECPM() billing.Money

	// PriceTestMode indicates whether the price is in test mode.
	PriceTestMode() bool

	// Price returns the total price for a specific action (e.g., click, lead, view).
	Price(action admodels.Action) billing.Money

	// BidPrice returns the bid price for the external auction source.
	// The bid price is adjusted according to the source correction factor and the commission share factor.
	BidPrice() billing.Money

	// SetBidPrice sets the bid price value for external sources in an auction.
	// The system will pay this bid price.
	SetBidPrice(price billing.Money) error

	// PurchasePrice returns the price of a specific action from an external resource (e.g., site, app, RTB).
	// This represents the cost of the request for the network.
	PurchasePrice(action admodels.Action) billing.Money

	// PotentialPrice returns the potential price that could be received from the source but was marked as a discrepancy.
	PotentialPrice(action admodels.Action) billing.Money

	// FinalPrice returns the final price for the advertisement item, including all possible commissions and corrections.
	// This is the price that will be charged to the advertiser.
	FinalPrice(action admodels.Action) billing.Money

	// Second returns a pointer to the SecondAd, representing secondary campaigns.
	Second() *SecondAd

	// CommissionShareFactor returns the multiplier used for commission calculations.
	// It represents the portion of user revenue the system receives, ranging from 0 to 1.
	CommissionShareFactor() float64

	// SourceCorrectionFactor returns the correction factor applied to the source.
	SourceCorrectionFactor() float64

	// TargetCorrectionFactor returns the correction factor applied to the target.
	TargetCorrectionFactor() float64
}

ResponserItem defines the interface for a single advertisement response item. It extends ResponserItemCommon by adding methods specific to individual ads.

type ResponserItemCommon

type ResponserItemCommon interface {
	// ID returns the unique identifier of the current response item.
	ID() string

	// Impression returns the Impression object associated with this response item.
	Impression() *Impression

	// ImpressionID returns the unique identifier string of the Impression.
	ImpressionID() string

	// ExtImpressionID returns the external unique identifier of the auction bid impression.
	ExtImpressionID() string

	// ExtTargetID returns the external target identifier from the external network.
	ExtTargetID() string

	// InternalAuctionCPMBid provides the maximum possible CPM (Cost Per Mille) bid without any commission.
	// This value is used by the system to select the best item for the auction.
	InternalAuctionCPMBid() billing.Money

	// PriorityFormatType returns the format type that has priority in the current ad.
	PriorityFormatType() types.FormatType

	// Validate checks the validity of the response item.
	// It returns an error if the item is invalid.
	Validate() error

	// Context returns the contextual information associated with the response item.
	// It can accept additional contexts to merge with the existing one.
	Context(ctx ...context.Context) context.Context

	// Get retrieves a value from the response item's extension map by the provided key.
	// It returns nil if the key does not exist.
	Get(key string) any
}

ResponserItemCommon defines the common interface for response items in an ad auction. It includes methods to access identification, pricing, validation, and contextual data.

type ResponserMultipleItem

type ResponserMultipleItem interface {
	ResponserItemCommon

	// Ads returns a slice of ResponserItem interfaces representing individual ads within the response.
	Ads() []ResponserItem

	// Count returns the total number of response items (ads) in the response.
	Count() int
}

ResponserMultipleItem defines the interface for handling multiple advertisement response items. It is typically used for complex banners that contain multiple ads.

type SecondAd

type SecondAd struct {
	ID         string        `json:"id,omitempty"`
	Network    string        `json:"network,omitempty"`
	SourceID   uint64        `json:"source_id,omitempty"`
	CampaignID uint64        `json:"campaign_id,omitempty"`
	Price      billing.Money `json:"price,omitempty"`
}

SecondAd description

func (*SecondAd) GetCampaignID

func (s *SecondAd) GetCampaignID() uint64

GetCampaignID value

func (*SecondAd) GetECPM

func (s *SecondAd) GetECPM() billing.Money

GetECPM value

func (*SecondAd) GetPrice

func (s *SecondAd) GetPrice() billing.Money

GetPrice value

func (*SecondAd) GetSourceID

func (s *SecondAd) GetSourceID() uint64

GetSourceID value

type Segment

type Segment struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}

Segment item value

type Source

type Source interface {
	SourceMinimal

	// ID of the source driver
	ID() uint64

	// ObjectKey of the source driver
	ObjectKey() uint64

	// Protocol of the source driver
	Protocol() string

	// Test request before processing
	Test(request *BidRequest) bool

	// 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
	PriceCorrectionReduceFactor() float64

	// RequestStrategy description
	RequestStrategy() RequestStrategy
}

Source of advertisement and where will be selled the traffic

func ToSource

func ToSource(val SourceMinimal) Source

ToSource interface from different types of interfaces with the implementation of unsupported methods

type SourceAccessor

type SourceAccessor interface {
	// Iterator returns the configured queue accessor
	Iterator(request *BidRequest) SourceIterator

	// SourceByID returns source instance
	SourceByID(id uint64) (Source, error)

	// SetTimeout for sourcer
	SetTimeout(timeout time.Duration)
}

SourceAccessor preoritise the source access

type SourceEmpty

type SourceEmpty struct {
	PriceCorrectionReduce float64 // from 0 to 1
}

SourceEmpty abstraction

func (*SourceEmpty) Bid

func (*SourceEmpty) Bid(request *BidRequest) Responser

Bid request for standart system filter

func (*SourceEmpty) ID

func (*SourceEmpty) ID() uint64

ID of the source driver

func (*SourceEmpty) ObjectKey

func (*SourceEmpty) ObjectKey() uint64

ObjectKey of the source driver

func (*SourceEmpty) PriceCorrectionReduceFactor

func (s *SourceEmpty) PriceCorrectionReduceFactor() float64

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 (*SourceEmpty) ProcessResponseItem

func (*SourceEmpty) ProcessResponseItem(Responser, ResponserItem)

ProcessResponseItem result or error

func (*SourceEmpty) Protocol

func (*SourceEmpty) Protocol() string

Protocol of the source driver

func (*SourceEmpty) RequestStrategy

func (*SourceEmpty) RequestStrategy() RequestStrategy

RequestStrategy description

func (*SourceEmpty) Test

func (*SourceEmpty) Test(request *BidRequest) bool

Test request before processing

type SourceIterator

type SourceIterator interface {
	// Next returns source interface according to strategy
	Next() Source
}

SourceIterator returns next source from the scope

type SourceMinimal

type SourceMinimal interface {
	// Bid request for standart system filter
	Bid(request *BidRequest) Responser

	// ProcessResponseItem result or error
	ProcessResponseItem(Responser, ResponserItem)
}

SourceMinimal contains only minimal set of methods

type SourceTesteChecker

type SourceTesteChecker interface {
	// Test current request for compatibility
	Test(request *BidRequest) bool
}

SourceTesteChecker checker

type SourceTester

type SourceTester interface {
	Source
	SourceTesteChecker
}

SourceTester interface

type SourceTimeoutSetter

type SourceTimeoutSetter interface {
	// SetTimeout for sourcer
	SetTimeout(timeout time.Duration)
}

SourceTimeoutSetter interface

type TypeSex

type TypeSex uint8

TypeSex type

const (
	UserSexUndefined TypeSex = 0
	UserSexMale      TypeSex = 1
	UserSexFemale    TypeSex = 2
)

User sex enum

func SexByString

func SexByString(sex string) (t TypeSex)

SexByString returns the type Sex

func (TypeSex) Code

func (s TypeSex) Code() string

Code from the sex

func (TypeSex) String

func (s TypeSex) String() string

type URLGenerator

type URLGenerator interface {
	// CDNURL returns full URL to path
	CDNURL(path string) string

	// LibURL returns full URL to lib file path
	LibURL(path string) string

	// PixelURL generator from response of item
	// @param js generates the JavaScript pixel type
	PixelURL(event events.Type, status uint8, item ResponserItem, response Responser, js bool) (string, error)

	// PixelDirectURL generator from response of item
	PixelDirectURL(event events.Type, status uint8, item ResponserItem, response Responser, direct string) (string, error)

	// PixelLead URL
	PixelLead(item ResponserItem, response Responser, js bool) (string, error)

	// MustClickURL generator from response of item
	MustClickURL(item ResponserItem, response Responser) string

	// ClickURL generator from response of item
	ClickURL(item ResponserItem, response Responser) (string, error)

	// ClickRouterURL returns router pattern
	ClickRouterURL() string

	// DirectURL generator from response of item
	DirectURL(event events.Type, item ResponserItem, response Responser) (string, error)

	// DirectRouterURL returns router pattern
	DirectRouterURL() string

	// WinURL generator from response of item
	WinURL(event events.Type, status uint8, item ResponserItem, response Responser) (string, error)

	// BillingNoticeURL generator from response of item
	BillingNoticeURL(event events.Type, status uint8, item ResponserItem, response Responser) (string, error)

	// WinRouterURL returns router pattern
	WinRouterURL() string
}

URLGenerator of advertisement

type User

type User struct {
	ID            string       `json:"id,omitempty"`        // Unique User ID
	Email         string       `json:"email,omitempty"`     // In some cases it's able the use email, and we are gonna use it
	Username      string       `json:"username,omitempty"`  // User profile name from the external service or potentional username
	SessionID     string       `json:"sessid,omitempty"`    // Unique session ID
	FingerPrintID string       `json:"fpid,omitempty"`      //
	ETag          string       `json:"etag,omitempty"`      //
	Birthday      string       `json:"birthday,omitempty"`  // * Prefer do not use such personal information in alghoritm
	AgeStart      int          `json:"age_start,omitempty"` // Year of birth from
	AgeEnd        int          `json:"age_end,omitempty"`   // Year of birth from
	Gender        string       `json:"gender,omitempty"`    // Gender ("M": male, "F" female, "O" Other)
	Keywords      string       `json:"keywords,omitempty"`  // Comma separated list of keywords, interests, or intent
	Geo           *udetect.Geo `json:"geo,omitempty"`
	Data          []Data       `json:"data,omitempty"`
	// contains filtered or unexported fields
}

User information

func (User) AvgAge

func (u User) AvgAge() byte

AvgAge number

func (*User) BirthdayTime

func (u *User) BirthdayTime() time.Time

BirthdayTime parsed by Birthday string

func (*User) GetDataItem

func (u *User) GetDataItem(name string) (v string, ok bool)

GetDataItem simple value by key

func (*User) GetDataItemOrDefault

func (u *User) GetDataItemOrDefault(name, def string) string

GetDataItemOrDefault item

func (User) RTBObject

func (u User) RTBObject() *openrtb.User

RTBObject of User

func (*User) SetDataItem

func (u *User) SetDataItem(name, value string)

SetDataItem with simple *key*, *value*

func (*User) SetSexByString

func (u *User) SetSexByString(sex string)

SetSexByString text value

func (User) Sex

func (u User) Sex() TypeSex

Sex constant

type WinEvent

type WinEvent struct {
	Time     time.Time `json:"t,omitempty"`
	Counter  int       `json:"c,omitempty"`
	URL      string    `json:"u"`
	Data     any       `json:"d,omitempty"`
	Response string    `json:"-"`
	Error    error     `json:"-"`
	Status   int       `json:"-"`
}

WinEvent models

func WinEventDecode

func WinEventDecode(data string, ext ...any) (*WinEvent, error)

WinEventDecode from bytes

func (*WinEvent) CanContinue

func (e *WinEvent) CanContinue() bool

CanContinue try

func (*WinEvent) Decode

func (e *WinEvent) Decode(data string) error

Decode URL object

func (*WinEvent) Encode

func (e *WinEvent) Encode() (string, error)

Encode URL object

func (*WinEvent) Inc

func (e *WinEvent) Inc() *WinEvent

Inc event counter

func (*WinEvent) Ping

func (e *WinEvent) Ping() bool

Ping client server request about win

func (*WinEvent) Reset

func (e *WinEvent) Reset() *WinEvent

Reset event counter

func (*WinEvent) Validate

func (e *WinEvent) Validate() error

Validate event object

Jump to

Keyboard shortcuts

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