forked from seriallink/nfeio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
address.go
35 lines (30 loc) · 1.2 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 nfeio
func (c *Client) SearchAddressByPostalCode(postalCode string) (response AddressResponse, err error) {
err = c.Get("addresses/"+postalCode, nil, nil, &response)
return
}
type AddressResponse struct {
Address Address `json:"address"`
}
type Address struct {
StreetSuffix string `json:"streetSuffix,omitempty"`
Street string `json:"street,omitempty"`
Number string `json:"number,omitempty"`
NumberMin string `json:"numberMin,omitempty"`
NumberMax string `json:"numberMax,omitempty"`
AdditionalInformation string `json:"additionalInformation,omitempty"`
District string `json:"district,omitempty"`
State interface{} `json:"state,omitempty"`
City *City `json:"city,omitempty"`
PostalCode string `json:"postalCode,omitempty"`
Country string `json:"country,omitempty"`
}
type City struct {
Code string `json:"code,omitempty"`
Name string `json:"name,omitempty"`
}
type State struct {
Code string `json:"code,omitempty"`
Name string `json:"name,omitempty"`
Abbreviation string `json:"abbreviation"`
}