OpenRTB protocol defintions for Go
Go Makefile
Latest commit 7b145eb Nov 3, 2017 @dim dim Merge pull request #46 from vanilla-rtb/master
fix StringOrNumber for empty strings
Permalink
Failed to load latest commit information.
native Better fix for bad exchanges Apr 16, 2017
testdata OpenRTB 2.5 Source object added (BidRequest.source) Jun 12, 2017
.editorconfig Draft of v2 Aug 25, 2015
.travis.yml Updated CI build Jan 13, 2017
Makefile Fix test, always rebuild in tests Oct 26, 2016
README.md Updated README Aug 22, 2016
audio.go Fixed up audio object from openrtb2.4 Jan 26, 2017
audio_test.go Use constants and remove magic numbers on tests Mar 3, 2017
banner.go Changed format to be an array instead of a single object Jan 27, 2017
banner_test.go Change Banner for Creative due Dim's Feedback Mar 3, 2017
bench_test.go Fix JSON tag, added benchmark Sep 15, 2016
bid.go Better fix for bad exchanges Apr 16, 2017
bid_test.go Fix field name Jan 12, 2016
bidrequest.go OpenRTB 2.5 Source object added (BidRequest.source) Jun 12, 2017
bidrequest_test.go Better fix for bad exchanges Apr 16, 2017
bidresponse.go Use custom Extension type instead of json.RawMessage for "ext" fields Dec 22, 2016
bidresponse_test.go Draft of v2 Aug 25, 2015
content.go Added fields for OpenRTB 2.4 Jan 13, 2017
content_test.go Draft of v2 Aug 25, 2015
device.go device: Add MCCMNC field from 2.5 spec Mar 15, 2017
device_test.go device: Add MCCMNC field from 2.5 spec Mar 15, 2017
doc.go Draft of v2 Aug 25, 2015
extension.go Use custom Extension type instead of json.RawMessage for "ext" fields Dec 22, 2016
extension_test.go Use custom Extension type instead of json.RawMessage for "ext" fields Dec 22, 2016
impression.go Better fix for bad exchanges Apr 16, 2017
impression_test.go Removed check for empty assets to support another formats like onclic… Feb 28, 2017
inventory.go inventory: fixed typo in inventory model. Apr 3, 2017
inventory_test.go Draft of v2 Aug 25, 2015
native.go Use custom Extension type instead of json.RawMessage for "ext" fields Dec 22, 2016
native_test.go Use custom Extension type instead of json.RawMessage for "ext" fields Dec 22, 2016
numbers.go fix StringOrNumber for empty strings Nov 2, 2017
numbers_test.go add test for empty StringOrNumber encoder/decoder Nov 2, 2017
openrtb.go Enumerate video placement constants. Mar 9, 2017
openrtb_test.go Added benchmark Sep 15, 2016
pmp.go Use custom Extension type instead of json.RawMessage for "ext" fields Dec 22, 2016
pmp_test.go Draft of v2 Aug 25, 2015
seatbid.go Use custom Extension type instead of json.RawMessage for "ext" fields Dec 22, 2016
seatbid_test.go Draft of v2 Aug 25, 2015
source.go OpenRTB 2.5 Source object added (BidRequest.source) Jun 12, 2017
source_test.go OpenRTB 2.5 Source object added (BidRequest.source) Jun 12, 2017
video.go Include Video placement. Mar 9, 2017
video_test.go Use placement constant in test. Mar 9, 2017

README.md

Go OpenRTB v2.x

Build Status

OpenRTB implementation for Go

Installation

To install, use go get:

go get github.com/bsm/openrtb

Usage

Import the package:

package main

import (
  "log"
  "github.com/bsm/openrtb"
)

func main() {
  file, err := os.Open("stored.json")
  if err != nil {
    log.Fatal(err)
  }
  defer file.Close()

  var req *openrtb.BidRequest
  err = json.NewDecoder(file).Decode(&req)
  if err != nil {
    log.Fatal(err)
  }

  log.Printf("%+v\n", req)
}

Licence

Copyright (c) 2015 Black Square Media Ltd. All rights reserved.
(The MIT License)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Some test examples were taken from:
https://code.google.com/p/openrtb/wiki/OpenRTB_Examples