mirror of
https://github.com/cubixle/iabtcfv2.git
synced 2026-04-24 18:34:43 +01:00
Add RestrictionType type
This commit is contained in:
@@ -17,3 +17,12 @@ const (
|
||||
TcfVersion1 TcfVersion = 1
|
||||
TcfVersion2 TcfVersion = 2
|
||||
)
|
||||
|
||||
type RestrictionType int
|
||||
|
||||
const (
|
||||
RestrictionTypeNotAllowed RestrictionType = 0
|
||||
RestrictionTypeRequireConsent RestrictionType = 1
|
||||
RestrictionTypeRequireLI RestrictionType = 2
|
||||
RestrictionTypeUndefined RestrictionType = 3
|
||||
)
|
||||
|
||||
@@ -82,7 +82,7 @@ func (r *TCEncoder) readRangeEntries(n uint) []*RangeEntry {
|
||||
func (r *TCEncoder) writePubRestrictions(entries []*PubRestriction) {
|
||||
for _, entry := range entries {
|
||||
r.writeInt(entry.PurposeId, 6)
|
||||
r.writeInt(entry.RestrictionType, 2)
|
||||
r.writeInt(int(entry.RestrictionType), 2)
|
||||
r.writeInt(len(entry.RangeEntries), 12)
|
||||
r.writeRangeEntries(entry.RangeEntries)
|
||||
}
|
||||
@@ -96,7 +96,7 @@ func (r *TCEncoder) readPubRestrictions(n uint) []*PubRestriction {
|
||||
var numEntries = r.readInt(12)
|
||||
var rangeEntries = r.readRangeEntries(uint(numEntries))
|
||||
ret = append(ret, &PubRestriction{PurposeId: purposeId,
|
||||
RestrictionType: restrictionType,
|
||||
RestrictionType: RestrictionType(restrictionType),
|
||||
NumEntries: numEntries,
|
||||
RangeEntries: rangeEntries,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user