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

RPRD-1638: Add support for Native media type and multi-format bid req… #42

Closed
wants to merge 8 commits into from

Conversation

michachen
Copy link

@michachen michachen commented Dec 10, 2024

Type of change

  • Bugfix

  • Feature

  • New bidder adapter

  • Updated bidder adapter

  • Code style update (formatting, local variables)

  • Refactoring (no functional changes, no api changes)

  • Build related changes

  • CI related changes

  • Does this change affect user-facing APIs or examples documented on http://prebid.org?

  • Other

Description of change

  • Add support for Native media type and multi-format bid requests in index.js,.
  • Populate the changes on rise/minutemedia/openweb/shinez/stn/BidAdapter.js.
  • Update all relevant ***BidAdapter_spec.js.
  • Update all relevant ***BidAdapter.md.
  • Keep backwards compatibility, Move mimes and api determination to VIDEO media type as its only relevant to video.
  • Move all spec code duplication to index.js and populate across all maintained adapters via makeBaseSpec factory function.
  • Move all rise related constants to constants.js.

…uests in `index.js`, Populate the changes on `rise/minutemedia/openweb/shinez/stn/BidAdapter.js`, Update all relevant `***BidAdapter_spec.js`, Update all relevant `***BidAdapter.md`, Keep backwards compatibility, Move `mimes` and `api` determination to VIDEO media type as its only relevant to video.
@michachen
Copy link
Author

Copy link

Whoa there, partner! 🌵🤠 We wrangled some duplicated code in your PR:

Reducing code duplication by importing common functions from a library not only makes our code cleaner but also easier to maintain. Please move the common code from both files into a library and import it in each. We hate that we have to mention this, however, commits designed to hide from this utility by renaming variables or reordering an object are poor conduct. We will not look upon them kindly! Keep up the great work! 🚀

@michachen
Copy link
Author

As i see here the threshold is 20. This tool was created on 08/06/2024. We have 5 adapters to maintain which will for-sure have duplicate code. Do you guys have any suggestions how to proceed? @lasloche @innay @george14051 @Gershon-Brainin @Dedis23

…e across all maintained adapters via `makeBaseSpec` factory function, Move all rise related constants to `constants.js`.
bidId: getBidIdParameter('bidId', bid),
loop: bid.bidderRequestsCount || 0,
bidderRequestId: getBidIdParameter('bidderRequestId', bid),
transactionId: bid.ortb2Imp?.ext?.tid || '',
coppa: 0,
};

const pos = deepAccess(bid, `mediaTypes.${mediaType}.pos`);
const pos = getPos(bid)

Choose a reason for hiding this comment

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

add the ; syntax on each end of line please.

if (pos) {
bidObject.pos = pos;
bidObject.pos = pos

Choose a reason for hiding this comment

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

pos can be zero value, fix the if condition to pass also pos=0 (unknown position)


export const ALIASES = [
{ code: 'risexchange', gvlid: DEFAULT_GVLID },
{ code: 'openwebxchange', gvlid: 280 }

Choose a reason for hiding this comment

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

Could you set it as a constant variable like const OW_GVLID = 280;?

Comment on lines 93 to 94
const mediaTypes = getBidRequestMediaTypes(bidRequest)
const firstMediaType = mediaTypes[0]

Choose a reason for hiding this comment

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

Please add the ; at the end of the lines.

const mediaTypes = getBidRequestMediaTypes(bidRequest)
const firstMediaType = mediaTypes[0]
if (mediaTypes.length === 1) {
return deepAccess(bidRequest, `mediaTypes.${firstMediaType}.name`)

Choose a reason for hiding this comment

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

Please add the ; at the end of the line.

Comment on lines 13 to 15
...makeBaseSpec(BASE_URL, MODES),
code: BIDDER_CODE,
gvlid: 918,

Choose a reason for hiding this comment

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

Could you set it as a constant variable like const MM_GVLID = 918;?

Comment on lines 113 to 114
const mediaTypes = getBidRequestMediaTypes(bid)
const firstMediaType = mediaTypes[0]

Choose a reason for hiding this comment

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

Please add the ; at the end of the lines.

Comment on lines 127 to 128
const mediaTypes = getBidRequestMediaTypes(bid)
const firstMediaType = mediaTypes[0]

Choose a reason for hiding this comment

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

Please add the ; at the end of the lines.

bidId: getBidIdParameter('bidId', bid),
loop: bid.bidderRequestsCount || 0,
bidderRequestId: getBidIdParameter('bidderRequestId', bid),
transactionId: bid.ortb2Imp?.ext?.tid || '',
coppa: 0,
};

const pos = deepAccess(bid, `mediaTypes.${mediaType}.pos`);
const pos = getPos(bid)

Choose a reason for hiding this comment

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

Please add the ; at the end of the line.

if (mediaTypes.includes(NATIVE)) {
const nativeOrtbRequest = deepAccess(bid, `nativeOrtbRequest`);
if (nativeOrtbRequest) {
bidObject.nativeOrtbRequest = nativeOrtbRequest

Choose a reason for hiding this comment

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

Please add the ; at the end of the line.

const BASE_URL = 'https://hb.openwebmp.com/';
const MODES = {
PRODUCTION: 'hb-multi',
TEST: 'hb-multi-test'
};

export const spec = {
...makeBaseSpec(BASE_URL, MODES),
code: BIDDER_CODE,
gvlid: 280,

Choose a reason for hiding this comment

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

Could you set it as a constant variable like const OW_GVLID = 280;?

@michachen
Copy link
Author

Prebid repo PR prebid#12653

@michachen michachen closed this Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants