-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiab
31 lines (26 loc) · 831 Bytes
/
iab
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
package main
import(
"encoding/json"
)
type IabVendor struct {
Id int `json:"id"`
Name string `json:"name"`
PolicyUrl string `json:"policyUrl"`
PurposeIds []int `json:"purposeIds"`
LegitimateInterestPurposeIds []int `json:"legIntPurposeIds"`
FeatureIds []int `json:"featureIds"`
}
type IabJson struct {
// Version uint16 `json:"vendorListVersion"`
Vendors []IabVendor `json:"vendors"`
}
type DomainToIabVendorMap map[string]IabVendor
func generateIabMap(aJsonString string) (DomainToIabVendorMap) {
aDomainToIabVendorMap := make(DomainToIabVendorMap)
var iabJson IabJson
json.Unmarshal([]byte(aJsonString), &iabJson)
for _, iabVendor := range iabJson.Vendors {
aDomainToIabVendorMap[ getDomainFromUrl(iabVendor.PolicyUrl) ] = iabVendor
}
return aDomainToIabVendorMap
}