hookstage

package
v2.25.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllProcessedBidResponses

type AllProcessedBidResponses interface {
	HandleAllProcessedBidResponsesHook(
		context.Context,
		ModuleInvocationContext,
		AllProcessedBidResponsesPayload,
	) (HookResult[AllProcessedBidResponsesPayload], error)
}

AllProcessedBidResponses hooks are invoked over a list of all processed responses received from bidders before a winner is chosen.

At this stage, account config is available, so it can be configured at the account-level execution plan, the account-level module config is passed to hooks.

Rejection has no effect and is completely ignored at this stage.

type AllProcessedBidResponsesPayload

type AllProcessedBidResponsesPayload struct {
	Responses map[openrtb_ext.BidderName]*entities.PbsOrtbSeatBid
}

AllProcessedBidResponsesPayload consists of a list of all processed responses received from bidders. Hooks are allowed to modify payload object and discard bids using mutations.

type AuctionResponse

type AuctionResponse interface {
	HandleAuctionResponseHook(
		context.Context,
		ModuleInvocationContext,
		AuctionResponsePayload,
	) (HookResult[AuctionResponsePayload], error)
}

AuctionResponse hooks are invoked at the very end of request processing. The hooks are invoked even if the request was rejected at earlier stages.

At this stage, account config is available, so it can be configured at the account-level execution plan, the account-level module config is passed to hooks.

Rejection has no effect and is completely ignored at this stage.

type AuctionResponsePayload

type AuctionResponsePayload struct {
	BidResponse *openrtb2.BidResponse
}

AuctionResponsePayload consists of a final openrtb2.BidResponse object that will be sent back to the requester. Hooks are allowed to modify openrtb2.BidResponse object.

type BidderRequest

type BidderRequest interface {
	HandleBidderRequestHook(
		context.Context,
		ModuleInvocationContext,
		BidderRequestPayload,
	) (HookResult[BidderRequestPayload], error)
}

BidderRequest hooks are invoked for each bidder participating in auction.

At this stage, account config is available, so it can be configured at the account-level execution plan, the account-level module config is passed to hooks.

Rejection results in skipping the bidder's request.

type BidderRequestPayload

type BidderRequestPayload struct {
	Request *openrtb_ext.RequestWrapper
	Bidder  string
}

BidderRequestPayload consists of the openrtb2.BidRequest object distilled for the particular bidder. Hooks are allowed to modify openrtb2.BidRequest using mutations.

func (*BidderRequestPayload) GetBidderRequestPayload added in v2.2.0

func (brp *BidderRequestPayload) GetBidderRequestPayload() *openrtb_ext.RequestWrapper

func (*BidderRequestPayload) SetBidderRequestPayload added in v2.2.0

func (brp *BidderRequestPayload) SetBidderRequestPayload(br *openrtb_ext.RequestWrapper)

type ChangeSet

type ChangeSet[T any] struct {
	// contains filtered or unexported fields
}

func (*ChangeSet[T]) AddMutation

func (c *ChangeSet[T]) AddMutation(fn MutationFunc[T], t MutationType, k ...string) *ChangeSet[T]

func (*ChangeSet[T]) BidderRequest

func (c *ChangeSet[T]) BidderRequest() ChangeSetBidderRequest[T]

func (*ChangeSet[T]) Mutations

func (c *ChangeSet[T]) Mutations() []Mutation[T]

func (*ChangeSet[T]) RawBidderResponse

func (c *ChangeSet[T]) RawBidderResponse() ChangeSetRawBidderResponse[T]

type ChangeSetBAdv

type ChangeSetBAdv[T any] struct {
	// contains filtered or unexported fields
}

func (ChangeSetBAdv[T]) Update

func (c ChangeSetBAdv[T]) Update(badv []string)

type ChangeSetBApp

type ChangeSetBApp[T any] struct {
	// contains filtered or unexported fields
}

func (ChangeSetBApp[T]) Update

func (c ChangeSetBApp[T]) Update(bapp []string)

type ChangeSetBCat

type ChangeSetBCat[T any] struct {
	// contains filtered or unexported fields
}

func (ChangeSetBCat[T]) Update

func (c ChangeSetBCat[T]) Update(bcat []string)

type ChangeSetBidderRequest

type ChangeSetBidderRequest[T any] struct {
	// contains filtered or unexported fields
}

func (ChangeSetBidderRequest[T]) BAdv

func (c ChangeSetBidderRequest[T]) BAdv() ChangeSetBAdv[T]

func (ChangeSetBidderRequest[T]) BApp

func (c ChangeSetBidderRequest[T]) BApp() ChangeSetBApp[T]

func (ChangeSetBidderRequest[T]) BCat

func (c ChangeSetBidderRequest[T]) BCat() ChangeSetBCat[T]

func (ChangeSetBidderRequest[T]) CatTax

func (c ChangeSetBidderRequest[T]) CatTax() ChangeSetCatTax[T]

type ChangeSetBids

type ChangeSetBids[T any] struct {
	// contains filtered or unexported fields
}

func (ChangeSetBids[T]) Update

func (c ChangeSetBids[T]) Update(bids []*adapters.TypedBid)

type ChangeSetCatTax

type ChangeSetCatTax[T any] struct {
	// contains filtered or unexported fields
}

func (ChangeSetCatTax[T]) Update

func (c ChangeSetCatTax[T]) Update(cattax adcom1.CategoryTaxonomy)

type ChangeSetRawBidderResponse

type ChangeSetRawBidderResponse[T any] struct {
	// contains filtered or unexported fields
}

func (ChangeSetRawBidderResponse[T]) Bids

type Entrypoint

type Entrypoint interface {
	HandleEntrypointHook(
		context.Context,
		ModuleInvocationContext,
		EntrypointPayload,
	) (HookResult[EntrypointPayload], error)
}

Entrypoint hooks are invoked at the very beginning of request processing.

At this stage, account config is not yet available, so it can only be defined as part of the host-level execution plan, the account-level module config is not available.

Rejection results in sending an empty BidResponse with the NBR code indicating the rejection reason.

type EntrypointPayload

type EntrypointPayload struct {
	Request *http.Request
	Body    []byte
}

EntrypointPayload consists of an HTTP request and a raw body of the openrtb2.BidRequest. For "/openrtb2/amp" endpoint the body is nil. Hooks are allowed to modify this data using mutations.

type HookResult

type HookResult[T any] struct {
	Reject        bool         // true value indicates rejection of the program execution at the specific stage
	NbrCode       int          // hook must provide NbrCode if the field Reject set to true
	Message       string       // holds arbitrary message added by hook
	ChangeSet     ChangeSet[T] // set of changes the module wants to apply to hook payload in case of successful execution
	Errors        []string
	Warnings      []string
	DebugMessages []string
	AnalyticsTags hookanalytics.Analytics
	ModuleContext ModuleContext // holds values that the module wants to pass to itself at later stages
}

HookResult represents the result of execution the concrete hook instance.

type ModuleContext

type ModuleContext map[string]interface{}

ModuleContext holds arbitrary data passed between module hooks at different stages. We use interface as we do not know exactly how the modules will use their inner context.

type ModuleInvocationContext

type ModuleInvocationContext struct {
	// AccountConfig represents module config rewritten at the account-level.
	AccountConfig json.RawMessage
	// Endpoint represents the path of the current endpoint.
	Endpoint string
	// ModuleContext holds values that the module passes to itself from the previous stages.
	ModuleContext ModuleContext
}

ModuleInvocationContext holds data passed to the module hook during invocation.

type Mutation

type Mutation[T any] struct {
	// contains filtered or unexported fields
}

func (Mutation[T]) Apply

func (m Mutation[T]) Apply(p T) (T, error)

func (Mutation[T]) Key

func (m Mutation[T]) Key() []string

func (Mutation[T]) Type

func (m Mutation[T]) Type() MutationType

type MutationFunc

type MutationFunc[T any] func(T) (T, error)

type MutationType

type MutationType int
const (
	MutationAdd MutationType = iota
	MutationUpdate
	MutationDelete
)

func (MutationType) String

func (mt MutationType) String() string

type ProcessedAuctionRequest

type ProcessedAuctionRequest interface {
	HandleProcessedAuctionHook(
		context.Context,
		ModuleInvocationContext,
		ProcessedAuctionRequestPayload,
	) (HookResult[ProcessedAuctionRequestPayload], error)
}

ProcessedAuctionRequest hooks are invoked after the request is parsed and enriched with additional data.

At this stage, account config is available, so it can be configured at the account-level execution plan, the account-level module config is passed to hooks.

Rejection results in sending an empty BidResponse with the NBR code indicating the rejection reason.

type ProcessedAuctionRequestPayload

type ProcessedAuctionRequestPayload struct {
	Request *openrtb_ext.RequestWrapper
}

ProcessedAuctionRequestPayload consists of the openrtb_ext.RequestWrapper object. Hooks are allowed to modify openrtb_ext.RequestWrapper using mutations.

func (*ProcessedAuctionRequestPayload) GetBidderRequestPayload added in v2.2.0

func (parp *ProcessedAuctionRequestPayload) GetBidderRequestPayload() *openrtb_ext.RequestWrapper

func (*ProcessedAuctionRequestPayload) SetBidderRequestPayload added in v2.2.0

func (parp *ProcessedAuctionRequestPayload) SetBidderRequestPayload(br *openrtb_ext.RequestWrapper)

type RawAuctionRequest

type RawAuctionRequest interface {
	HandleRawAuctionHook(
		context.Context,
		ModuleInvocationContext,
		RawAuctionRequestPayload,
	) (HookResult[RawAuctionRequestPayload], error)
}

RawAuctionRequest hooks are invoked only for "/openrtb2/auction" endpoint after retrieving the account config, but before the request is parsed and any additions are made.

At this stage, account config is available, so it can be configured at the account-level execution plan, the account-level module config is passed to hooks.

Rejection results in sending an empty BidResponse with the NBR code indicating the rejection reason.

type RawAuctionRequestPayload

type RawAuctionRequestPayload []byte

RawAuctionRequestPayload represents a raw body of the openrtb2.BidRequest. Hooks are allowed to modify body using mutations.

type RawBidderResponse

type RawBidderResponse interface {
	HandleRawBidderResponseHook(
		context.Context,
		ModuleInvocationContext,
		RawBidderResponsePayload,
	) (HookResult[RawBidderResponsePayload], error)
}

RawBidderResponse hooks are invoked for each bidder participating in auction.

At this stage, account config is available, so it can be configured at the account-level execution plan, the account-level module config is passed to hooks.

Rejection results in ignoring the bidder's response.

type RawBidderResponsePayload

type RawBidderResponsePayload struct {
	Bids   []*adapters.TypedBid
	Bidder string
}

RawBidderResponsePayload consists of a list of adapters.TypedBid objects representing bids returned by a particular bidder. Hooks are allowed to modify bids using mutations.

type RequestUpdater added in v2.2.0

type RequestUpdater interface {
	GetBidderRequestPayload() *openrtb_ext.RequestWrapper
	SetBidderRequestPayload(br *openrtb_ext.RequestWrapper)
}

RequestUpdater allows reading and writing a bid request

Jump to

Keyboard shortcuts

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