-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathaccount.go
40 lines (36 loc) · 899 Bytes
/
account.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
package golinode
type Account struct {
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Email string
Company string
Address1 string
Address2 string
Balance float32
City string
State string
Zip string
Country string
TaxID string `json:"tax_id"`
CreditCard *CreditCard `json:"credit_card"`
}
type CreditCard struct {
LastFour string `json:"last_four"`
Expiry string
}
// fixDates converts JSON timestamps to Go time.Time values
func (v *Account) fixDates() *Account {
return v
}
// GetAccountEvents gets the template with the provided ID
func (c *Client) GetAccount() (*Account, error) {
e, err := c.Account.Endpoint()
if err != nil {
return nil, err
}
r, err := coupleAPIErrors(c.R().SetResult(&Account{}).Get(e))
if err != nil {
return nil, err
}
return r.Result().(*Account).fixDates(), nil
}