prebid / openrtb

Go (Golang) OpenRTB 2.x, 3.0 / AdCOM 1.0 / Native 1.2 types/enums
Apache License 2.0
43 stars 22 forks source link
adcom go golang native openrtb

openrtb Go Reference Test

OpenRTB, AdCOM and OpenRTB Dynamic Native Ads types for Go programming language

Requires Go 1.16+

This library uses Go modules (tl;dr) and requires Go 1.16+ for the ability to issue release retractions.

Using

go get -u "github.com/prebid/openrtb/v20/..."
import (
    openrtb2 "github.com/prebid/openrtb/v20/openrtb2"

    openrtb3 "github.com/prebid/openrtb/v20/openrtb3"
    adcom1 "github.com/prebid/openrtb/v20/adcom1"

    native1 "github.com/prebid/openrtb/v20/native1"
    nreq "github.com/prebid/openrtb/v20/native1/request"
    nres "github.com/prebid/openrtb/v20/native1/response"
)

This repo follows semver - see releases. The main branch always contains latest code, so better use some package manager to vendor specific version.

Guidelines

Naming convention

Types

Pointers/omitempty

Pointer Omitempty When to use Example
no no required in spec Audio.MIMEs
yes yes required in spec, but is a part of mutually-exclusive group Imp.{Banner,Video,Audio,Native}
no yes zero value ("", 0) has no meaning, is defined in the spec as the default value, or represents time / duration Device.UA
yes yes zero value ("", 0) or value absence (null) has special meaning Device.{DNT,Lmt}

Using both pointer and omitempty is mostly just to save traffic / generate more "canonical" (strict) JSON.

Documentation (pkg.go.dev)

Code organization

Acknowledgments

This library was originally developed by mxmCherry under The Unlicense license, still available at https://github.com/mxmCherry/openrtb but no longer maintained. Prebid.org's efforts to continue development are offered under the Apache 2.0 license.