Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OMS: add video support #3779

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

przemkaczmarek
Copy link
Collaborator

🔧 Type of changes

  • bid adapter update

✨ What's the context?

#3770

@osulzhenko osulzhenko linked an issue Feb 25, 2025 that may be closed by this pull request
@osulzhenko osulzhenko changed the title OMS: Video support #3770 OMS: add video support Feb 28, 2025
@CTMBNara CTMBNara requested a review from AntoxaAntoxic March 4, 2025 17:19

String pid;

Integer publisherId;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add JsonProperty

also I would change the integration test payload to cover publisherId parameter

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have cheanged pid to publisherId but IMO its indifferent

Comment on lines 42 to 61
public Result<List<HttpRequest<BidRequest>>> makeHttpRequests(BidRequest request) {
String uri = endpointUrl;

if (!request.getImp().isEmpty()) {
try {
final ExtImpOms impExt = parseImpExt(request.getImp().get(0));
if (impExt != null) {
if (impExt.getPid() != null && !impExt.getPid().isEmpty()) {
uri = String.format("%s?publisherId=%s", endpointUrl, impExt.getPid());
} else if (impExt.getPublisherId() != null && impExt.getPublisherId() > 0) {
uri = String.format("%s?publisherId=%d", endpointUrl, impExt.getPublisherId());
}
}
} catch (PreBidException e) {
return Result.withError(BidderError.badInput(e.getMessage()));
}
}

return Result.withValue(BidderUtil.defaultRequest(request, uri, mapper));
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it can work this way

            try {
                final ExtImpOms impExt = parseImpExt(request.getImp().getFirst());
                final String publisherId = impExt.getPid() == null && impExt.getPublisherId() != null && impExt.getPublisherId() > 0
                        ? String.valueOf(impExt.getPublisherId())
                        : impExt.getPid();
                final String url = "%s?publisherId=%s".formatted(endpointUrl, publisherId);
                return Result.withValue(BidderUtil.defaultRequest(request, url, mapper));
            } catch (PreBidException e) {
                return Result.withError(BidderError.badInput(e.getMessage()));
            }

@@ -59,7 +91,15 @@ private static List<BidderBid> bidsFromResponse(BidResponse bidResponse) {
.map(SeatBid::getBid)
.filter(Objects::nonNull)
.flatMap(Collection::stream)
.map(bid -> BidderBid.of(bid, BidType.banner, bidResponse.getCur()))
.map(bid -> BidderBid.of(bid, getBidType(bid.getMtype()), bidResponse.getCur()))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the following is not ported

func getBidVideo(bidType openrtb_ext.BidType, bid *openrtb2.Bid) *openrtb_ext.ExtBidPrebidVideo {
	if bidType != openrtb_ext.BidTypeVideo {
		return nil
	}

	var primaryCategory string
	if len(bid.Cat) > 0 {
		primaryCategory = bid.Cat[0]
	}

	return &openrtb_ext.ExtBidPrebidVideo{
		Duration:        int(bid.Dur),
		PrimaryCategory: primaryCategory,
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port PR from PBS-Go: OMS: Video support
2 participants