Skip to content

Commit

Permalink
Merge pull request #827 from PubMatic-OpenWrap/ci
Browse files Browse the repository at this point in the history
Release Branch 2nd July 2024
  • Loading branch information
pm-nilesh-chate authored Jun 26, 2024
2 parents ca8f8b1 + 39b4ccb commit 95019e1
Show file tree
Hide file tree
Showing 139 changed files with 8,840 additions and 2,990 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/helpers/pull-request-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ class diffHelper {
let diff = {}
for (const { filename, patch } of files) {
if (this.fileNameFilter(filename)) {
if (!patch) {
console.log(`No patch found for file: ${filename}`)
continue
}
const lines = patch.split("\n")
if (lines.length === 1) {
continue
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ format:
formatcheck:
./scripts/format.sh -f false

mockgen: mockgeninstall mockgendb mockgencache mockgenmetrics mockgenlogger mockgenpublisherfeature
mockgen: mockgeninstall mockgendb mockgencache mockgenmetrics mockgenlogger mockgenpublisherfeature mockgenprofilemetadata

# export GOPATH=~/go ; GOBIN=~/go/bin; export PATH=$PATH:$GOBIN
mockgeninstall:
Expand Down Expand Up @@ -68,3 +68,7 @@ mockgenlogger:
mockgenpublisherfeature:
mkdir -p modules/pubmatic/openwrap/publisherfeature
mockgen github.com/PubMatic-OpenWrap/prebid-server/v2/modules/pubmatic/openwrap/publisherfeature Feature > modules/pubmatic/openwrap/publisherfeature/mock/mock.go

mockgenprofilemetadata:
mkdir -p modules/pubmatic/openwrap/profilemetadata/mock
mockgen github.com/PubMatic-OpenWrap/prebid-server/v2/modules/pubmatic/openwrap/profilemetadata ProfileMetaData > modules/pubmatic/openwrap/profilemetadata/mock/mock.go
3 changes: 1 addition & 2 deletions adapters/bidder.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type BidderResponse struct {
Currency string
Bids []*TypedBid
FledgeAuctionConfigs []*openrtb_ext.FledgeAuctionConfig
FastXMLMetrics *openrtb_ext.FastXMLMetrics
}

// NewBidderResponseWithBidsCapacity create a new BidderResponse initialising the bids array capacity and the default currency value
Expand Down Expand Up @@ -156,8 +157,6 @@ type ExtraRequestInfo struct {
PbsEntryPoint metrics.RequestType
GlobalPrivacyControlHeader string
CurrencyConversions currency.Conversions

BidderCoreName openrtb_ext.BidderName // OW specific: required for oRTB bidder
}

func NewExtraRequestInfo(c currency.Conversions) ExtraRequestInfo {
Expand Down
62 changes: 28 additions & 34 deletions adapters/ortbbidder/bidderparams/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,47 @@ package bidderparams

// BidderParamMapper contains property details like location
type BidderParamMapper struct {
location []string
Location string // do not update this parameter for each request, its being shared across all requests
}

// GetLocation returns the location of bidderParam
func (bpm *BidderParamMapper) GetLocation() []string {
return bpm.location
// Config contains mappings RequestParams and ResponseParams
type Config struct {
RequestParams map[string]BidderParamMapper
ResponseParams map[string]BidderParamMapper
}

// SetLocation sets the location in BidderParamMapper
// Do not modify the location of bidderParam unless you are writing unit test case
func (bpm *BidderParamMapper) SetLocation(location []string) {
bpm.location = location
}

// config contains mappings requestParams and responseParams
type config struct {
requestParams map[string]BidderParamMapper
responseParams map[string]BidderParamMapper
}

// BidderConfig contains map of bidderName to its requestParams and responseParams
// BidderConfig contains map of bidderName to its RequestParams and ResponseParams
type BidderConfig struct {
bidderConfigMap map[string]*config
BidderConfigMap map[string]*Config
}

// setRequestParams sets the bidder specific requestParams
func (bcfg *BidderConfig) setRequestParams(bidderName string, requestParams map[string]BidderParamMapper) {
if bcfg == nil {
return
// NewBidderConfig initializes and returns the object of BidderConfig
func NewBidderConfig() *BidderConfig {
return &BidderConfig{
BidderConfigMap: make(map[string]*Config),
}
if bcfg.bidderConfigMap == nil {
bcfg.bidderConfigMap = make(map[string]*config)
}

// GetRequestParams returns bidder specific ResponseParams
func (bcfg *BidderConfig) GetRequestParams(bidderName string) map[string]BidderParamMapper {
if len(bcfg.BidderConfigMap) == 0 {
return nil
}
if _, found := bcfg.bidderConfigMap[bidderName]; !found {
bcfg.bidderConfigMap[bidderName] = &config{}
bidderConfig := bcfg.BidderConfigMap[bidderName]
if bidderConfig == nil {
return nil
}
bcfg.bidderConfigMap[bidderName].requestParams = requestParams
return bidderConfig.RequestParams
}

// GetRequestParams returns bidder specific requestParams
func (bcfg *BidderConfig) GetRequestParams(bidderName string) (map[string]BidderParamMapper, bool) {
if bcfg == nil || len(bcfg.bidderConfigMap) == 0 {
return nil, false
// GetResponseParams returns bidder specific ResponseParams
func (bcfg *BidderConfig) GetResponseParams(bidderName string) map[string]BidderParamMapper {
if len(bcfg.BidderConfigMap) == 0 {
return nil
}
bidderConfig, _ := bcfg.bidderConfigMap[bidderName]
bidderConfig := bcfg.BidderConfigMap[bidderName]
if bidderConfig == nil {
return nil, false
return map[string]BidderParamMapper{}
}
return bidderConfig.requestParams, true
return bidderConfig.ResponseParams
}
Loading

0 comments on commit 95019e1

Please sign in to comment.