1package linodego
2
3import "context"
4
5// Account associated with the token in use.
6type Account struct {
7	FirstName         string      `json:"first_name"`
8	LastName          string      `json:"last_name"`
9	Email             string      `json:"email"`
10	Company           string      `json:"company"`
11	Address1          string      `json:"address_1"`
12	Address2          string      `json:"address_2"`
13	Balance           float32     `json:"balance"`
14	BalanceUninvoiced float32     `json:"balance_uninvoiced"`
15	City              string      `json:"city"`
16	State             string      `json:"state"`
17	Zip               string      `json:"zip"`
18	Country           string      `json:"country"`
19	TaxID             string      `json:"tax_id"`
20	Phone             string      `json:"phone"`
21	CreditCard        *CreditCard `json:"credit_card"`
22}
23
24// CreditCard information associated with the Account.
25type CreditCard struct {
26	LastFour string `json:"last_four"`
27	Expiry   string `json:"expiry"`
28}
29
30// GetAccount gets the contact and billing information related to the Account.
31func (c *Client) GetAccount(ctx context.Context) (*Account, error) {
32	e, err := c.Account.Endpoint()
33	if err != nil {
34		return nil, err
35	}
36
37	r, err := coupleAPIErrors(c.R(ctx).SetResult(&Account{}).Get(e))
38	if err != nil {
39		return nil, err
40	}
41
42	return r.Result().(*Account), nil
43}
44