github.com/prebid/prebid-server/v2@v2.18.0/hooks/hookstage/bidderrequest.go (about)

     1  package hookstage
     2  
     3  import (
     4  	"context"
     5  	"github.com/prebid/prebid-server/v2/openrtb_ext"
     6  )
     7  
     8  // BidderRequest hooks are invoked for each bidder participating in auction.
     9  //
    10  // At this stage, account config is available,
    11  // so it can be configured at the account-level execution plan,
    12  // the account-level module config is passed to hooks.
    13  //
    14  // Rejection results in skipping the bidder's request.
    15  type BidderRequest interface {
    16  	HandleBidderRequestHook(
    17  		context.Context,
    18  		ModuleInvocationContext,
    19  		BidderRequestPayload,
    20  	) (HookResult[BidderRequestPayload], error)
    21  }
    22  
    23  // BidderRequestPayload consists of the openrtb2.BidRequest object
    24  // distilled for the particular bidder.
    25  // Hooks are allowed to modify openrtb2.BidRequest using mutations.
    26  type BidderRequestPayload struct {
    27  	Request *openrtb_ext.RequestWrapper
    28  	Bidder  string
    29  }
    30  
    31  func (brp *BidderRequestPayload) GetBidderRequestPayload() *openrtb_ext.RequestWrapper {
    32  	return brp.Request
    33  }
    34  
    35  func (brp *BidderRequestPayload) SetBidderRequestPayload(br *openrtb_ext.RequestWrapper) {
    36  	brp.Request = br
    37  }
    38  
    39  // RequestUpdater allows reading and writing a bid request
    40  type RequestUpdater interface {
    41  	GetBidderRequestPayload() *openrtb_ext.RequestWrapper
    42  	SetBidderRequestPayload(br *openrtb_ext.RequestWrapper)
    43  }