Library with OpenRTB spec types which allows to build and validate OpenRTB objects
npm install @clearcodehq/openrtbThis is a Node.js library with OpenRTB v2.5 and v3.0 types. Library allows to build and validate OpenRTB objects.
npm i @clearcodehq/openrtb --save-devFor yarn:
* yarn add @clearcodehq/openrtb --dev
``typescript
import { OpenRTB25 } from '@clearcodehq/openrtb'
const request: OpenRTB25.BidRequest = {
id: '0123456789ABCDEF',
imp: [],
}
const response: OpenRTB25.BidResponse = {
id: '0123456789ABCDEF',
seatbid: [
{
bid:[
{
id: "3388668784683234620",
impid: "1234",
price: 0.01594973499743546,
adm: "
The same with OpenRTB v3.0 types:
`typescript
import { OpenRTB30 } from '@clearcodehq/openrtb'const request: OpenRTB30.BidRequest = {
openrtb: {
ver: '3.0',
domainspec: 'adcom',
domainver: '1.0',
request: {
id: "0123456789ABCDEF",
},
}
}
const response: OpenRTB30.BidResponse = {
openrtb: {
ver: '3.0',
domainspec: 'adcom',
domainver: '1.0',
response: {
id: "0123456789ABCDEF",
bidid: "0011223344AABBCC",
seatbid: [
{
seat: "XYZ",
bid: [
{
id: "yaddayadda",
item: "1",
deal: "1234",
price: 1.50,
macro: [
{
key: "TIMESTAMP",
value: "1127987134"
},
{
key: "CLICKTOKEN",
value: "A7D800F2716DB"
}
],
}
]
}
]
}
}
}
``