-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddress.go
32 lines (27 loc) · 922 Bytes
/
address.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
package adf
type Street struct {
// The actual value of the xml tag
Value string `xml:",chardata"`
// An attribute of the xml tag
// Valid values are 1-5.
// "Street name. Allowed up to 5 lines"
Line int `xml:"line,attr"`
}
// ADF representation of an address
type Address struct {
// An attribute of the xml
// Valid values are work, home, and delivery
Type string `xml:"type,attr,omitempty"`
Streets []Street `xml:"street,omitempty"`
Apartment string `xml:"apartment,omitempty"`
City string `xml:"city,omitempty"`
// Valid values: "Free-form, 2-char code recommended for N. America"
RegionCode string `xml:"regioncode,omitempty"`
PostalCode string `xml:"postalcode,omitempty"`
// Valid values: ISO 3166 2-letter code
Country string `xml:"country,omitempty"`
}
// TODO: should there be a RemoveStreet?
func (a *Address) AddStreet(newStreet Street) {
a.Streets = append(a.Streets, newStreet)
}