Skip to content

Commit

Permalink
Revert "InMobi: mtype support (prebid#3921)"
Browse files Browse the repository at this point in the history
This reverts commit 9740a91.
  • Loading branch information
krdzo authored Oct 30, 2024
1 parent 4d0d8e0 commit 831d1a4
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 133 deletions.
28 changes: 13 additions & 15 deletions adapters/inmobi/inmobi.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,7 @@ func (a *InMobiAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalR

for _, sb := range serverBidResponse.SeatBid {
for i := range sb.Bid {
mediaType, err := getMediaTypeForImp(sb.Bid[i])
if err != nil {
return nil, []error{err}
}
mediaType := getMediaTypeForImp(sb.Bid[i].ImpID, internalRequest.Imp)
bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{
Bid: &sb.Bid[i],
BidType: mediaType,
Expand Down Expand Up @@ -121,17 +118,18 @@ func preprocess(imp *openrtb2.Imp) error {
return nil
}

func getMediaTypeForImp(bid openrtb2.Bid) (openrtb_ext.BidType, error) {
switch bid.MType {
case openrtb2.MarkupBanner:
return openrtb_ext.BidTypeBanner, nil
case openrtb2.MarkupVideo:
return openrtb_ext.BidTypeVideo, nil
case openrtb2.MarkupNative:
return openrtb_ext.BidTypeNative, nil
default:
return "", &errortypes.BadServerResponse{
Message: fmt.Sprintf("Unsupported mtype %d for bid %s", bid.MType, bid.ID),
func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType {
mediaType := openrtb_ext.BidTypeBanner
for _, imp := range imps {
if imp.ID == impId {
if imp.Video != nil {
mediaType = openrtb_ext.BidTypeVideo
}
if imp.Native != nil {
mediaType = openrtb_ext.BidTypeNative
}
break
}
}
return mediaType
}
4 changes: 1 addition & 3 deletions adapters/inmobi/inmobitest/exemplary/simple-app-banner.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@
"price": 2.0,
"id": "1234",
"adm": "bannerhtml",
"impid": "imp-id",
"mtype": 1
"impid": "imp-id"
}
]
}
Expand All @@ -95,7 +94,6 @@
"adm": "bannerhtml",
"crid": "123456789",
"nurl": "https://some.event.url/params",
"mtype": 1,
"ext": {
"prebid": {
"meta": {
Expand Down
4 changes: 1 addition & 3 deletions adapters/inmobi/inmobitest/exemplary/simple-app-native.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@
"price": 2.0,
"id": "1234",
"adm": "native-json",
"impid": "imp-id",
"mtype": 4
"impid": "imp-id"
}
]
}
Expand All @@ -93,7 +92,6 @@
"adm": "native-json",
"crid": "123456789",
"nurl": "https://some.event.url/params",
"mtype": 4,
"ext": {
"prebid": {
"meta": {
Expand Down
4 changes: 1 addition & 3 deletions adapters/inmobi/inmobitest/exemplary/simple-app-video.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@
"price": 2.0,
"id": "1234",
"adm": "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <VAST version=\"3.0\"></VAST>",
"impid": "imp-id",
"mtype": 2
"impid": "imp-id"
}
]
}
Expand All @@ -97,7 +96,6 @@
"adm": "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <VAST version=\"3.0\"></VAST>",
"crid": "123456789",
"nurl": "https://some.event.url/params",
"mtype": 2,
"ext": {
"prebid": {
"meta": {
Expand Down
4 changes: 1 addition & 3 deletions adapters/inmobi/inmobitest/exemplary/simple-web-banner.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@
"price": 2.0,
"id": "1234",
"adm": "bannerhtml",
"impid": "imp-id",
"mtype": 1
"impid": "imp-id"
}
]
}
Expand All @@ -93,7 +92,6 @@
"adm": "bannerhtml",
"crid": "123456789",
"nurl": "https://some.event.url/params",
"mtype": 1,
"ext": {
"prebid": {
"meta": {
Expand Down
4 changes: 1 addition & 3 deletions adapters/inmobi/inmobitest/exemplary/simple-web-native.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@
"price": 2.0,
"id": "1234",
"adm": "native-json",
"impid": "imp-id",
"mtype": 4
"impid": "imp-id"
}
]
}
Expand All @@ -91,7 +90,6 @@
"adm": "native-json",
"crid": "123456789",
"nurl": "https://some.event.url/params",
"mtype": 4,
"ext": {
"prebid": {
"meta": {
Expand Down
4 changes: 1 addition & 3 deletions adapters/inmobi/inmobitest/exemplary/simple-web-video.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@
"price": 2.0,
"id": "1234",
"adm": "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <VAST version=\"3.0\"></VAST>",
"impid": "imp-id",
"mtype": 2
"impid": "imp-id"
}
]
}
Expand All @@ -95,7 +94,6 @@
"adm": "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <VAST version=\"3.0\"></VAST>",
"crid": "123456789",
"nurl": "https://some.event.url/params",
"mtype": 2,
"ext": {
"prebid": {
"meta": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@
"price": 2.0,
"id": "1234",
"adm": "bannerhtml",
"impid": "imp-id",
"mtype": 1
"impid": "imp-id"
}
]
}
Expand All @@ -101,7 +100,6 @@
"adm": "bannerhtml",
"crid": "123456789",
"nurl": "https://some.event.url/params",
"mtype": 1,
"ext": {
"prebid": {
"meta": {
Expand Down
97 changes: 0 additions & 97 deletions adapters/inmobi/inmobitest/supplemental/invalid-mtype.json

This file was deleted.

0 comments on commit 831d1a4

Please sign in to comment.