forked from joefitzgerald/forecast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccount.go
30 lines (26 loc) · 774 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
package forecast
import "fmt"
type accountContainer struct {
Account Account `json:"account"`
}
// Account is a Forecast account
type Account struct {
ID int `json:"id"`
Name string `json:"name"`
WeeklyCapacity int `json:"weekly_capacity"`
ColorLabels []struct {
Name string `json:"name"`
Label string `json:"label"`
} `json:"color_labels"`
HarvestSubdomain string `json:"harvest_subdomain"`
HarvestName string `json:"harvest_name"`
}
// Account returns information about the current Forecast account
func (api *API) Account() (*Account, error) {
var container accountContainer
err := api.do(fmt.Sprintf("accounts/%v", api.AccountID), &container)
if err != nil {
return nil, err
}
return &container.Account, nil
}