-
Notifications
You must be signed in to change notification settings - Fork 706
/
regs.go
63 lines (55 loc) · 2.21 KB
/
regs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package openrtb_ext
import (
"github.com/prebid/prebid-server/v2/util/sliceutil"
)
// ExtRegs defines the contract for bidrequest.regs.ext
type ExtRegs struct {
// DSA is an object containing DSA transparency information, see https://github.com/InteractiveAdvertisingBureau/openrtb/blob/main/extensions/community_extensions/dsa_transparency.md
DSA *ExtRegsDSA `json:"dsa,omitempty"`
// GDPR should be "1" if the caller believes the user is subject to GDPR laws, "0" if not, and undefined
// if it's unknown. For more info on this parameter, see: https://iabtechlab.com/wp-content/uploads/2018/02/OpenRTB_Advisory_GDPR_2018-02.pdf
GDPR *int8 `json:"gdpr,omitempty"`
// USPrivacy should be a four character string, see: https://iabtechlab.com/wp-content/uploads/2019/11/OpenRTB-Extension-U.S.-Privacy-IAB-Tech-Lab.pdf
USPrivacy string `json:"us_privacy,omitempty"`
}
// ExtRegsDSA defines the contract for bidrequest.regs.ext.dsa
type ExtRegsDSA struct {
Required *int8 `json:"dsarequired,omitempty"`
PubRender *int8 `json:"pubrender,omitempty"`
DataToPub *int8 `json:"datatopub,omitempty"`
Transparency []ExtBidDSATransparency `json:"transparency,omitempty"`
}
// Clone creates a deep copy of ExtRegsDSA
func (erd *ExtRegsDSA) Clone() *ExtRegsDSA {
if erd == nil {
return nil
}
clone := *erd
if erd.Required != nil {
clonedRequired := *erd.Required
clone.Required = &clonedRequired
}
if erd.PubRender != nil {
clonedPubRender := *erd.PubRender
clone.PubRender = &clonedPubRender
}
if erd.DataToPub != nil {
clonedDataToPub := *erd.DataToPub
clone.DataToPub = &clonedDataToPub
}
if erd.Transparency != nil {
clonedTransparency := make([]ExtBidDSATransparency, len(erd.Transparency))
for i, transparency := range erd.Transparency {
newTransparency := transparency
newTransparency.Params = sliceutil.Clone(transparency.Params)
clonedTransparency[i] = newTransparency
}
clone.Transparency = clonedTransparency
}
return &clone
}
// ExtBidDSATransparency defines the contract for bidrequest.regs.ext.dsa.transparency
type ExtBidDSATransparency struct {
Domain string `json:"domain,omitempty"`
Params []int `json:"dsaparams,omitempty"`
}