-
Notifications
You must be signed in to change notification settings - Fork 3
/
resources.go
33 lines (29 loc) · 930 Bytes
/
resources.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
package lob
// NamedObjectList is used to return the list of countries and states.
type NamedObjectList struct {
Object string `json:"object"`
Data []NamedObject `json:"data"`
}
// NamedObject is a datum that contains a name and short name for a state or country.
type NamedObject struct {
ID string `json:"id"`
Name string `json:"name"`
ShortName string `json:"short_name"`
Object string `json:"object"`
}
// GetStates returns a list of US States that Lob recognizes.
func (l *lob) GetStates() (*NamedObjectList, error) {
resp := new(NamedObjectList)
if err := l.get("states/", nil, resp); err != nil {
return nil, err
}
return resp, nil
}
// GetCountries returns a list of countries that Lob recognizes.
func (l *lob) GetCountries() (*NamedObjectList, error) {
resp := new(NamedObjectList)
if err := l.get("countries/", nil, resp); err != nil {
return nil, err
}
return resp, nil
}