github.com/prebid/prebid-server@v0.275.0/macros/macros.go (about) 1 package macros 2 3 import ( 4 "bytes" 5 "text/template" 6 ) 7 8 // EndpointTemplateParams specifies macros for bidder endpoints. 9 type EndpointTemplateParams struct { 10 Host string 11 PublisherID string 12 ZoneID string 13 SourceId string 14 AccountID string 15 AdUnit string 16 MediaType string 17 GvlID string 18 } 19 20 // UserSyncPrivacy specifies privacy policy macros, represented as strings, for user sync urls. 21 type UserSyncPrivacy struct { 22 GDPR string 23 GDPRConsent string 24 USPrivacy string 25 GPP string 26 GPPSID string 27 } 28 29 // ResolveMacros resolves macros in the given template with the provided params 30 func ResolveMacros(aTemplate *template.Template, params interface{}) (string, error) { 31 strBuf := bytes.Buffer{} 32 33 if err := aTemplate.Execute(&strBuf, params); err != nil { 34 return "", err 35 } 36 37 res := strBuf.String() 38 return res, nil 39 }