Skip to content

Commit

Permalink
Updata MediaType supports for video
Browse files Browse the repository at this point in the history
  • Loading branch information
benben2001 committed Jul 9, 2024
1 parent ef24067 commit 1f345e9
Show file tree
Hide file tree
Showing 2 changed files with 146 additions and 2 deletions.
11 changes: 9 additions & 2 deletions adapters/melozen/melozen.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.R
}

func splitImpressionsByMediaType(impression *openrtb2.Imp) ([]openrtb2.Imp, error) {
if impression.Banner == nil && impression.Native == nil {
return nil, &errortypes.BadInput{Message: "Invalid MediaType. MeloZen only supports Banner and Native."}
if impression.Banner == nil && impression.Native == nil && impression.Video == nil {
return nil, &errortypes.BadInput{Message: "Invalid MediaType. MeloZen only supports Banner, Video and Native."}
}

if impression.Audio != nil {
Expand All @@ -168,6 +168,13 @@ func splitImpressionsByMediaType(impression *openrtb2.Imp) ([]openrtb2.Imp, erro
impressions = append(impressions, impCopy)
}

if impression.Video != nil {
impCopy := *impression
impCopy.Banner = nil
impCopy.Native = nil
impressions = append(impressions, impCopy)
}

if impression.Native != nil {
impCopy := *impression
impCopy.Banner = nil
Expand Down
137 changes: 137 additions & 0 deletions adapters/melozen/melozentest/exemplary/app-video.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
{
"mockBidRequest": {
"id": "web-video",
"tmax": 3000,
"imp": [
{
"id": "video-imp-id",
"ext": {
"bidder": {
"pubId": "386276e072"
}
},
"video": {
"w": 640,
"h": 480,
"mimes": [
"video/mp4"
],
"placement": 1
}
}
],
"app": {
"bundle": "com.fake.app",
"publisher": {
"id": "42",
"name": "whatever.pub"
}
},
"device": {
"w": 1200,
"h": 900
}
},
"httpCalls": [
{
"expectedRequest": {
"uri": "https://example.com/rtb/v2/bid?publisher_id=386276e072",
"headers": {
"Content-Type": [
"application/json;charset=utf-8"
],
"Accept": [
"application/json"
]
},
"body": {
"id": "web-video",
"tmax": 3000,
"imp": [
{
"id": "video-imp-id",
"ext": {
"bidder": {
"pubId": "386276e072"
}
},
"video": {
"w": 640,
"h": 480,
"mimes": [
"video/mp4"
],
"placement": 1
}
}
],
"app": {
"bundle": "com.fake.app",
"publisher": {
"id": "42",
"name": "whatever.pub"
}
},
"device": {
"w": 1200,
"h": 900
}
},
"impIDs": [
"video-imp-id"
]
},
"mockResponse": {
"status": 200,
"body": {
"id": "web-video",
"cur": "USD",
"seatbid": [
{
"bid": [
{
"id": "web-video",
"impid": "video-imp-id",
"crid": "some-creative-id",
"adm": "<VAST>TAG</VAST>",
"price": 20,
"w": 640,
"h": 480,
"ext": {
"prebid": {
"type": "video"
}
}
}
]
}
]
}
}
}
],
"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"id": "web-video",
"impid": "video-imp-id",
"crid": "some-creative-id",
"adm": "<VAST>TAG</VAST>",
"price": 20,
"w": 640,
"h": 480,
"ext": {
"prebid": {
"type": "video"
}
}
},
"type": "video"
}
]
}
]
}

0 comments on commit 1f345e9

Please sign in to comment.