Skip to content

Commit

Permalink
make getting media type steps lean.
Browse files Browse the repository at this point in the history
  • Loading branch information
product-trustedstack committed Apr 26, 2024
1 parent 542fc21 commit 42a6a00
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions adapters/trustedstack/trustedstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"github.com/prebid/openrtb/v20/openrtb2"
"github.com/prebid/prebid-server/v2/adapters"
"github.com/prebid/prebid-server/v2/config"
"github.com/prebid/prebid-server/v2/errortypes"
"github.com/prebid/prebid-server/v2/openrtb_ext"
)

Expand Down Expand Up @@ -57,7 +56,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest

for _, sb := range bidResp.SeatBid {
for i := range sb.Bid {
bidType, err := getMediaTypeForImp(&sb.Bid[i], internalRequest.Imp)
bidType, err := getBidMediaTypeFromMtype(&sb.Bid[i])
if err != nil {
errs = append(errs, err)
} else {
Expand All @@ -80,16 +79,6 @@ func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server co
}, nil
}

func getMediaTypeForImp(bid *openrtb2.Bid, imps []openrtb2.Imp) (openrtb_ext.BidType, error) {
mediaType, err := getBidMediaTypeFromMtype(bid)
if err != nil {
return "", &errortypes.BadInput{
Message: err.Error(),
}
}
return mediaType, nil
}

func getBidMediaTypeFromMtype(bid *openrtb2.Bid) (openrtb_ext.BidType, error) {
switch bid.MType {
case openrtb2.MarkupBanner:
Expand Down

0 comments on commit 42a6a00

Please sign in to comment.