-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathaddress.go
35 lines (32 loc) · 1.21 KB
/
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
33
34
35
package postmaster
// Address is used in Shipment requests (as From or To fields), or in validating
// addresses.
type Address struct {
Contact string `json:"contact,omitempty"`
Company string `json:"company,omitempty"`
Line1 string `json:"line1,omitempty"`
Line2 string `json:"line2,omitempty"`
Line3 string `json:"line3,omitempty"`
City string `json:"city,omitempty"`
State string `json:"state,omitempty"`
ZipCode string `json:"zip_code,omitempty"`
Country string `json:"country,omitempty"`
Latitude string `json:"latitude,omitempty"`
Longitude string `json:"longitude,omitempty"`
Notes string `json:"notes,omitempty"`
PhoneNo string `json:"phone_no,omitempty"`
Active bool `json:"active,omitempty"`
Commercial bool `json:"commercial,omitempty"`
Residental bool `json:"residental,omitempty"`
}
// AddressResponse is being sent back from API when asking to validate an address.
type AddressResponse struct {
Status string
Addresses []Address
}
// Validate tries to validate given address.
func (p *Postmaster) Validate(addr *Address) (*AddressResponse, error) {
res := new(AddressResponse)
_, err := post(p, "v1", "validate", addr, &res)
return res, err
}