Naked Panda Meditations

    @clearcodehq/openrtb
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.1 • Public • Published

    OpenRTB

    Overview

    This is a Node.js library with OpenRTB v2.5 and v3.0 types. Library allows to build and validate OpenRTB objects.

    Installation

    For npm:

    • npm i @clearcodehq/openrtb --save-dev

    For yarn:

    • yarn add @clearcodehq/openrtb --dev

    Usage

    To use the OpenRTB v2.5 types, import the package into your file:

    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: "<div>test</div>",
              adid: "1234",
              adomain: [
                "https://example.com"
              ],
              iurl: "https://example.com/cr?id=1234",
              cid: "1234",
              crid: "1234",
              w: 160,
              h: 600,
            }
          ],
          seat: "bidder"
        }
      ],
      cur: "EUR"
    }

    The same with OpenRTB v3.0 types:

    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"
                    }
                  ],
                }
              ]
            }
          ]
        }
      }
    }

    Install

    npm i @clearcodehq/openrtb

    DownloadsWeekly Downloads

    15

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    47.7 kB

    Total Files

    86

    Last publish

    Collaborators

    • l.szajner
    • madecki_clearcode
    • jakubziebik