github.com/prebid/prebid-server/v2@v2.18.0/adapters/yieldlab/types.go (about)

     1  package yieldlab
     2  
     3  import (
     4  	"github.com/prebid/prebid-server/v2/openrtb_ext"
     5  	"strconv"
     6  	"time"
     7  )
     8  
     9  type bidResponse struct {
    10  	ID         uint64       `json:"id"`
    11  	Price      uint         `json:"price"`
    12  	Advertiser string       `json:"advertiser"`
    13  	Adsize     string       `json:"adsize"`
    14  	Pid        uint64       `json:"pid"`
    15  	Did        uint64       `json:"did"`
    16  	Pvid       string       `json:"pvid"`
    17  	DSA        *dsaResponse `json:"dsa,omitempty"`
    18  }
    19  
    20  // dsaResponse defines Digital Service Act (DSA) parameters from Yieldlab yieldprobe response.
    21  type dsaResponse struct {
    22  	Behalf       string            `json:"behalf,omitempty"`
    23  	Paid         string            `json:"paid,omitempty"`
    24  	Adrender     *int              `json:"adrender,omitempty"`
    25  	Transparency []dsaTransparency `json:"transparency,omitempty"`
    26  }
    27  
    28  // openRTBExtRegsWithDSA defines the contract for bidrequest.regs.ext with the missing DSA property.
    29  //
    30  // The openrtb_ext.ExtRegs needs to be extended on yieldlab adapter level until DSA has been implemented
    31  // by the prebid server team (https://github.com/prebid/prebid-server/issues/3424).
    32  type openRTBExtRegsWithDSA struct {
    33  	openrtb_ext.ExtRegs
    34  	DSA *dsaRequest `json:"dsa,omitempty"`
    35  }
    36  
    37  // responseExtWithDSA defines seatbid.bid.ext with the DSA object.
    38  type responseExtWithDSA struct {
    39  	DSA dsaResponse `json:"dsa"`
    40  }
    41  
    42  // dsaRequest defines Digital Service Act (DSA) parameter
    43  // as specified by the OpenRTB 2.X DSA Transparency community extension.
    44  //
    45  // Should rather come from openrtb_ext package but will be defined here until DSA has been
    46  // implemented by the prebid server team (https://github.com/prebid/prebid-server/issues/3424).
    47  type dsaRequest struct {
    48  	Required     *int              `json:"dsarequired"`
    49  	PubRender    *int              `json:"pubrender"`
    50  	DataToPub    *int              `json:"datatopub"`
    51  	Transparency []dsaTransparency `json:"transparency"`
    52  }
    53  
    54  // dsaTransparency Digital Service Act (DSA) transparency object
    55  type dsaTransparency struct {
    56  	Domain string `json:"domain,omitempty"`
    57  	Params []int  `json:"dsaparams,omitempty"`
    58  }
    59  
    60  type cacheBuster func() string
    61  
    62  type weekGenerator func() string
    63  
    64  var defaultCacheBuster cacheBuster = func() string {
    65  	return strconv.FormatInt(time.Now().Unix(), 10)
    66  }
    67  
    68  var defaultWeekGenerator weekGenerator = func() string {
    69  	_, week := time.Now().ISOWeek()
    70  	return strconv.Itoa(week)
    71  }