Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: release.yml
on:
release:
types:
- created
pull_request:
types:
- opened
- reopened
- synchronize

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ 1.18.x, 1.19.x ]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Golang
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}

- name: Generate msgpack files
run: make generate-msgp
8 changes: 8 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ jobs:
with:
go-version: ${{ matrix.go-version }}
cache: true

- name: Generate msgpack files
run: make generate-msgp

- run: make test
golangci:
runs-on: ubuntu-latest
Expand All @@ -27,6 +31,10 @@ jobs:
with:
go-version: 1.x
cache: true

- name: Generate msgpack files
run: make generate-msgp

- uses: golangci/golangci-lint-action@v3
with:
version: latest
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
*.makefile

.deps
*_gen.go
*_gen_test.go
#native/request/*_gen.go
#native/request/*_gen_test.go
#native/reponse/*_gen.go
#native/reponse/*_gen_test.go
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
default: test

DEPENDENCIES_FOLDER := .deps
MSGP_BIN := msgp
MSGP_VERSION := v1.3.0
MSGP := $(DEPENDENCIES_FOLDER)/$(MSGP_BIN)_$(MSGP_VERSION)


.minimal.makefile:
curl -fsSL -o $@ https://gitlab.com/bsm/misc/raw/master/make/go/minimal.makefile

include .minimal.makefile


$(MSGP):
GOBIN=$(PWD)/$(DEPENDENCIES_FOLDER) go install github.com/tinylib/msgp@$(MSGP_VERSION)
$(call clean_tool,$(MSGP_BIN),$@)


.PHONY: generate-msgp ## Generate mocks
generate-msgp:$(MSGP)
go generate ./...
42 changes: 22 additions & 20 deletions audio.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package openrtb

import (
"encoding/json"
"errors"
"github.com/tinylib/msgp/msgp"

"github.com/bytedance/sonic"
)
Expand All @@ -12,27 +12,29 @@ var (
ErrInvalidAudioNoMIMEs = errors.New("openrtb: audio has no mimes")
)

//go:generate .deps/msgp

// Audio object must be included directly in the impression object
type Audio struct {
MIMEs []string `json:"mimes"` // Content MIME types supported.
MinDuration int `json:"minduration,omitempty"` // Minimum video ad duration in seconds
MaxDuration int `json:"maxduration,omitempty"` // Maximum video ad duration in seconds
Protocols []Protocol `json:"protocols,omitempty"` // Video bid response protocols
StartDelay StartDelay `json:"startdelay,omitempty"` // Indicates the start delay in seconds
Sequence int `json:"sequence,omitempty"` // Default: 1
BlockedAttrs []CreativeAttribute `json:"battr,omitempty"` // Blocked creative attributes
MaxExtended int `json:"maxextended,omitempty"` // Maximum extended video ad duration
MinBitrate int `json:"minbitrate,omitempty"` // Minimum bit rate in Kbps
MaxBitrate int `json:"maxbitrate,omitempty"` // Maximum bit rate in Kbps
Delivery []ContentDelivery `json:"delivery,omitempty"` // List of supported delivery methods
CompanionAds []Banner `json:"companionad,omitempty"`
APIs []APIFramework `json:"api,omitempty"`
CompanionTypes []CompanionType `json:"companiontype,omitempty"`
MaxSequence int `json:"maxseq,omitempty"` // The maximumnumber of ads that canbe played in an ad pod.
Feed FeedType `json:"feed,omitempty"` // Type of audio feed.
Stitched int `json:"stitched,omitempty"` // Indicates if the ad is stitched with audio content or delivered independently
VolumeNorm VolumeNorm `json:"nvol,omitempty"` // Volume normalization mode.
Ext json.RawMessage `json:"ext,omitempty"`
MIMEs []string `json:"mimes" msgp:"mimes"` // Content MIME types supported.
MinDuration int `json:"minduration,omitempty" msgp:"minduration,omitempty"` // Minimum video ad duration in seconds
MaxDuration int `json:"maxduration,omitempty" msgp:"maxduration,omitempty"` // Maximum video ad duration in seconds
Protocols []Protocol `json:"protocols,omitempty" msgp:"protocols,omitempty"` // Video bid response protocols
StartDelay StartDelay `json:"startdelay,omitempty" msgp:"startdelay,omitempty"` // Indicates the start delay in seconds
Sequence int `json:"sequence,omitempty" msgp:"sequence,omitempty"` // Default: 1
BlockedAttrs []CreativeAttribute `json:"battr,omitempty" msgp:"battr,omitempty"` // Blocked creative attributes
MaxExtended int `json:"maxextended,omitempty" msgp:"maxextended,omitempty"` // Maximum extended video ad duration
MinBitrate int `json:"minbitrate,omitempty" msgp:"minbitrate,omitempty"` // Minimum bit rate in Kbps
MaxBitrate int `json:"maxbitrate,omitempty" msgp:"maxbitrate,omitempty"` // Maximum bit rate in Kbps
Delivery []ContentDelivery `json:"delivery,omitempty" msgp:"delivery,omitempty"` // List of supported delivery methods
CompanionAds []Banner `json:"companionad,omitempty" msgp:"companionad,omitempty"`
APIs []APIFramework `json:"api,omitempty" msgp:"api,omitempty"`
CompanionTypes []CompanionType `json:"companiontype,omitempty" msgp:"companiontype,omitempty"`
MaxSequence int `json:"maxseq,omitempty" msgp:"maxseq,omitempty"` // The maximumnumber of ads that canbe played in an ad pod.
Feed FeedType `json:"feed,omitempty" msgp:"feed,omitempty"` // Type of audio feed.
Stitched int `json:"stitched,omitempty" msgp:"stitched,omitempty"` // Indicates if the ad is stitched with audio content or delivered independently
VolumeNorm VolumeNorm `json:"nvol,omitempty" msgp:"nvol,omitempty"` // Volume normalization mode.
Ext msgp.Raw `json:"ext,omitempty" msgp:"ext,omitempty"`
}

type jsonAudio Audio
Expand Down
41 changes: 23 additions & 18 deletions banner.go
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
package openrtb

import "encoding/json"
import (
"github.com/tinylib/msgp/msgp"
)

// Banner object must be included directly in the impression object if the impression offered
// for auction is display or rich media, or it may be optionally embedded in the video object to
// describe the companion banners available for the linear or non-linear video ad. The banner
// object may include a unique identifier; this can be useful if these IDs can be leveraged in the
// VAST response to dictate placement of the companion creatives when multiple companion ad
// opportunities of the same size are available on a page.

//go:generate .deps/msgp

type Banner struct {
Width int `json:"w,omitempty"` // Width
Height int `json:"h,omitempty"` // Height
Formats []Format `json:"format,omitempty"` // Array of format objects representing the banner sizes permitted.
WidthMax int `json:"wmax,omitempty"` // Width maximum DEPRECATED
HeightMax int `json:"hmax,omitempty"` // Height maximum DEPRECATED
WidthMin int `json:"wmin,omitempty"` // Width minimum DEPRECATED
HeightMin int `json:"hmin,omitempty"` // Height minimum DEPRECATED
ID string `json:"id,omitempty"` // A unique identifier
BlockedTypes []BannerType `json:"btype,omitempty"` // Blocked banner types
BlockedAttrs []CreativeAttribute `json:"battr,omitempty"` // Blocked creative attributes
Position AdPosition `json:"pos,omitempty"` // Ad Position
MIMEs []string `json:"mimes,omitempty"` // Whitelist of content MIME types supported
TopFrame int `json:"topframe,omitempty"` // Default: 0 ("1": Delivered in top frame, "0": Elsewhere)
ExpDirs []ExpDir `json:"expdir,omitempty"` // Specify properties for an expandable ad
APIs []APIFramework `json:"api,omitempty"` // List of supported API frameworks
VCM int `json:"vcm,omitempty"` // Represents the relationship with video. 0 = concurrent, 1 = end-card
Ext json.RawMessage `json:"ext,omitempty"`
Width int `json:"w,omitempty" msgp:"w,omitempty"` // Width
Height int `json:"h,omitempty" msgp:"h,omitempty"` // Height
Formats []Format `json:"format,omitempty" msgp:"format,omitempty"` // Array of format objects representing the banner sizes permitted.
WidthMax int `json:"wmax,omitempty" msgp:"wmax,omitempty"` // Width maximum DEPRECATED
HeightMax int `json:"hmax,omitempty" msgp:"hmax,omitempty"` // Height maximum DEPRECATED
WidthMin int `json:"wmin,omitempty" msgp:"wmin,omitempty"` // Width minimum DEPRECATED
HeightMin int `json:"hmin,omitempty" msgp:"hmin,omitempty"` // Height minimum DEPRECATED
ID string `json:"id,omitempty" msgp:"id,omitempty"` // A unique identifier
BlockedTypes []BannerType `json:"btype,omitempty" msgp:"btype,omitempty"` // Blocked banner types
BlockedAttrs []CreativeAttribute `json:"battr,omitempty" msgp:"battr,omitempty"` // Blocked creative attributes
Position AdPosition `json:"pos,omitempty" msgp:"pos,omitempty"` // Ad Position
MIMEs []string `json:"mimes,omitempty" msgp:"mimes,omitempty"` // Whitelist of content MIME types supported
TopFrame int `json:"topframe,omitempty" msgp:"topframe,omitempty"` // Default: 0 ("1": Delivered in top frame, "0": Elsewhere)
ExpDirs []ExpDir `json:"expdir,omitempty" msgp:"expdir,omitempty"` // Specify properties for an expandable ad
APIs []APIFramework `json:"api,omitempty" msgp:"api,omitempty"` // List of supported API frameworks
VCM int `json:"vcm,omitempty" msgp:"vcm,omitempty"` // Represents the relationship with video. 0 = concurrent, 1 = end-card
Ext msgp.Raw `json:"ext,omitempty" msgp:"ext,omitempty"`
}
68 changes: 36 additions & 32 deletions content.go
Original file line number Diff line number Diff line change
@@ -1,42 +1,46 @@
package openrtb

import "encoding/json"
import (
"github.com/tinylib/msgp/msgp"
)

//go:generate .deps/msgp

// Content object describes the content in which the impression will appear, which may be syndicated or nonsyndicated
// content. This object may be useful when syndicated content contains impressions and does
// not necessarily match the publisher's general content. The exchange might or might not have
// knowledge of the page where the content is running, as a result of the syndication method. For
// example might be a video impression embedded in an iframe on an unknown web property or device.
type Content struct {
ID string `json:"id,omitempty"` // ID uniquely identifying the content.
Episode int `json:"episode,omitempty"` // Episode number (typically applies to video content).
Title string `json:"title,omitempty"` // Content title.
Series string `json:"series,omitempty"` // Content series.
Season string `json:"season,omitempty"` // Content season.
Artist string `json:"artist,omitempty"` // Artist credited with the content.
Genre string `json:"genre,omitempty"` // Genre that best describes the content
Album string `json:"album,omitempty"` // Album to which the content belongs; typically for audio.
ISRC string `json:"isrc,omitempty"` // International Standard Recording Code conforming to ISO - 3901.
Producer *Producer `json:"producer,omitempty"` // The producer.
URL string `json:"url,omitempty"` // URL of the content, for buy-side contextualization or review.
CategoryTaxonomy CategoryTaxonomy `json:"cattax,omitempty"` // Defines the taxonomy in use.
Categories []ContentCategory `json:"cat,omitempty"` // Array of IAB content categories that describe the content.
ProductionQuality ProductionQuality `json:"prodq,omitempty"` // Production quality per IAB's classification.
VideoQuality ProductionQuality `json:"videoquality,omitempty"` // DEPRECATED. Video quality per IAB's classification.
Context ContentContext `json:"context,omitempty"` // Type of content (game, video, text, etc.).
ContentRating string `json:"contentrating,omitempty"` // Content rating (e.g., MPAA).
UserRating string `json:"userrating,omitempty"` // User rating of the content (e.g., number of stars, likes, etc.).
MediaRating IQGRating `json:"qagmediarating,omitempty"` // Media rating per QAG guidelines.
Keywords string `json:"keywords,omitempty"` // Comma separated list of keywords describing the content.
LiveStream int `json:"livestream,omitempty"` // 0 = not live, 1 = content is live (e.g., stream, live blog).
SourceRelationship int `json:"sourcerelationship,omitempty"` // 0 = indirect, 1 = direct.
Length int `json:"len,omitempty"` // Length of content in seconds; appropriate for video or audio.
Language string `json:"language,omitempty"` // Content language using ISO-639-1-alpha-2.
LanguageB string `json:"langb,omitempty"` // Content language using IETF BCP 47. Only one of language or langb should be present.
Embeddable int `json:"embeddable,omitempty"` // Indicator of whether or not the content is embeddable (e.g., an embeddable video player), where 0 = no, 1 = yes.
Data []Data `json:"data,omitempty"` // Additional content data.
Network *ChannelEntity `json:"network,omitempty"` // Details about the network the content is on.
Channel *ChannelEntity `json:"channel,omitempty"` // Details about the channel the content is on.
KwArray []string `json:"kwarray,omitempty"` // Array of keywords about the site. Only one of ‘keywords’ or‘kwarray’ may be present.
Ext json.RawMessage `json:"ext,omitempty"`
ID string `json:"id,omitempty" msgp:"id,omitempty"` // ID uniquely identifying the content.
Episode int `json:"episode,omitempty" msgp:"episode,omitempty"` // Episode number (typically applies to video content).
Title string `json:"title,omitempty" msgp:"title,omitempty"` // Content title.
Series string `json:"series,omitempty" msgp:"series,omitempty"` // Content series.
Season string `json:"season,omitempty" msgp:"season,omitempty"` // Content season.
Artist string `json:"artist,omitempty" msgp:"artist,omitempty"` // Artist credited with the content.
Genre string `json:"genre,omitempty" msgp:"genre,omitempty"` // Genre that best describes the content
Album string `json:"album,omitempty" msgp:"album,omitempty"` // Album to which the content belongs; typically for audio.
ISRC string `json:"isrc,omitempty" msgp:"isrc,omitempty"` // International Standard Recording Code conforming to ISO - 3901.
Producer *Producer `json:"producer,omitempty" msgp:"producer,omitempty"` // The producer.
URL string `json:"url,omitempty" msgp:"url,omitempty"` // URL of the content, for buy-side contextualization or review.
CategoryTaxonomy CategoryTaxonomy `json:"cattax,omitempty" msgp:"cattax,omitempty"` // Defines the taxonomy in use.
Categories []ContentCategory `json:"cat,omitempty" msgp:"cat,omitempty"` // Array of IAB content categories that describe the content.
ProductionQuality ProductionQuality `json:"prodq,omitempty" msgp:"prodq,omitempty"` // Production quality per IAB's classification.
VideoQuality ProductionQuality `json:"videoquality,omitempty" msgp:"videoquality,omitempty"` // DEPRECATED. Video quality per IAB's classification.
Context ContentContext `json:"context,omitempty" msgp:"context,omitempty"` // Type of content (game, video, text, etc.).
ContentRating string `json:"contentrating,omitempty" msgp:"contentrating,omitempty"` // Content rating (e.g., MPAA).
UserRating string `json:"userrating,omitempty" msgp:"userrating,omitempty"` // User rating of the content (e.g., number of stars, likes, etc.).
MediaRating IQGRating `json:"qagmediarating,omitempty" msgp:"qagmediarating,omitempty"` // Media rating per QAG guidelines.
Keywords string `json:"keywords,omitempty" msgp:"keywords,omitempty"` // Comma separated list of keywords describing the content.
LiveStream int `json:"livestream,omitempty" msgp:"livestream,omitempty"` // 0 = not live, 1 = content is live (e.g., stream, live blog).
SourceRelationship int `json:"sourcerelationship,omitempty" msgp:"sourcerelationship,omitempty"` // 0 = indirect, 1 = direct.
Length int `json:"len,omitempty" msgp:"len,omitempty"` // Length of content in seconds; appropriate for video or audio.
Language string `json:"language,omitempty" msgp:"language,omitempty"` // Content language using ISO-639-1-alpha-2.
LanguageB string `json:"langb,omitempty" msgp:"langb,omitempty"` // Content language using IETF BCP 47. Only one of language or langb should be present.
Embeddable int `json:"embeddable,omitempty" msgp:"embeddable,omitempty"` // Indicator of whether or not the content is embeddable (e.g., an embeddable video player), where 0 = no, 1 = yes.
Data []Data `json:"data,omitempty" msgp:"data,omitempty"` // Additional content data.
Network *ChannelEntity `json:"network,omitempty" msgp:"network,omitempty"` // Details about the network the content is on.
Channel *ChannelEntity `json:"channel,omitempty" msgp:"channel,omitempty"` // Details about the channel the content is on.
KwArray []string `json:"kwarray,omitempty" msgp:"kwarray,omitempty"` // Array of keywords about the site. Only one of ‘keywords’ or‘kwarray’ may be present.
Ext msgp.Raw `json:"ext,omitempty" msgp:"ext,omitempty"`
}
Loading
Loading