forked from emiddleton/gads
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbiddable_ad_group_criterion.go
122 lines (115 loc) · 3.85 KB
/
biddable_ad_group_criterion.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
package gads
import (
"encoding/xml"
"fmt"
)
type BiddableAdGroupCriterion struct {
Type string `xml:"xsi:type,attr,omitempty"`
AdGroupId int64 `xml:"adGroupId"`
Criterion Criterion `xml:"criterion"`
// BiddableAdGroupCriterion
UserStatus string `xml:"userStatus,omitempty"`
SystemServingStatus string `xml:"systemServingStatus,omitempty"`
ApprovalStatus string `xml:"approvalStatus,omitempty"`
DisapprovalReasons []string `xml:"disapprovalReasons,omitempty"`
FirstPageCpc *Cpc `xml:"firstPageCpc>amount,omitempty"`
TopOfPageCpc *Cpc `xml:"topOfPageCpc>amount,omitempty"`
QualityInfo *QualityInfo `xml:"qualityInfo,omitempty"`
BiddingStrategyConfiguration *BiddingStrategyConfiguration `xml:"biddingStrategyConfiguration,omitempty"`
BidModifier float64 `xml:"bidModifier,omitempty"`
FinalUrls *FinalURLs `xml:"finalUrls,omitempty"`
FinalMobileUrls []string `xml:"finalMobileUrls,omitempty"`
FinalAppUrls []string `xml:"finalAppUrls,omitempty"`
TrackingUrlTemplate *string `xml:"trackingUrlTemplate"`
UrlCustomParameters *CustomParameters `xml:"urlCustomParameters,omitempty"`
}
func (bagc *BiddableAdGroupCriterion) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error {
for token, err := dec.Token(); err == nil; token, err = dec.Token() {
if err != nil {
return err
}
switch start := token.(type) {
case xml.StartElement:
tag := start.Name.Local
switch tag {
case "adGroupId":
if err := dec.DecodeElement(&bagc.AdGroupId, &start); err != nil {
return err
}
case "criterion":
criterion, err := criterionUnmarshalXML(dec, start)
if err != nil {
return err
}
bagc.Criterion = criterion
case "userStatus":
if err := dec.DecodeElement(&bagc.UserStatus, &start); err != nil {
return err
}
case "systemServingStatus":
if err := dec.DecodeElement(&bagc.SystemServingStatus, &start); err != nil {
return err
}
case "approvalStatus":
if err := dec.DecodeElement(&bagc.ApprovalStatus, &start); err != nil {
return err
}
case "disapprovalReasons":
if err := dec.DecodeElement(&bagc.DisapprovalReasons, &start); err != nil {
return err
}
case "firstPageCpc":
if err := dec.DecodeElement(&bagc.FirstPageCpc, &start); err != nil {
return err
}
case "topOfPageCpc":
if err := dec.DecodeElement(&bagc.TopOfPageCpc, &start); err != nil {
return err
}
case "qualityInfo":
if err := dec.DecodeElement(&bagc.QualityInfo, &start); err != nil {
return err
}
case "biddingStrategyConfiguration":
if err := dec.DecodeElement(&bagc.BiddingStrategyConfiguration, &start); err != nil {
return err
}
case "bidModifier":
if err := dec.DecodeElement(&bagc.BidModifier, &start); err != nil {
return err
}
case "finalUrls":
if err := dec.DecodeElement(&bagc.FinalUrls, &start); err != nil {
return err
}
case "finalMobileUrls":
if err := dec.DecodeElement(&bagc.FinalMobileUrls, &start); err != nil {
return err
}
case "finalAppUrls":
if err := dec.DecodeElement(&bagc.FinalAppUrls, &start); err != nil {
return err
}
case "trackingUrlTemplate":
if err := dec.DecodeElement(&bagc.TrackingUrlTemplate, &start); err != nil {
return err
}
case "urlCustomParameters":
if err := dec.DecodeElement(&bagc.UrlCustomParameters, &start); err != nil {
return err
}
case "AdGroupCriterion.Type":
bagc.Type = "BiddableAdGroupCriterion"
case "labels":
continue
default:
if StrictMode {
return fmt.Errorf("unknown BiddableAdGroupCriterion field %s", tag)
} else {
continue
}
}
}
}
return nil
}