This repository has been archived by the owner on May 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
/
account_feature.go
77 lines (62 loc) · 2.23 KB
/
account_feature.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// WARNING: This code is auto-generated from the Heroku Platform API JSON Schema
// by a Ruby script (gen/gen.rb). Changes should be made to the generation
// script rather than the generated files.
package heroku
import (
"time"
)
// An account feature represents a Heroku labs capability that can be enabled or
// disabled for an account on Heroku.
type AccountFeature struct {
// when account feature was created
CreatedAt time.Time `json:"created_at"`
// description of account feature
Description string `json:"description"`
// documentation URL of account feature
DocURL string `json:"doc_url"`
// whether or not account feature has been enabled
Enabled bool `json:"enabled"`
// unique identifier of account feature
Id string `json:"id"`
// unique name of account feature
Name string `json:"name"`
// state of account feature
State string `json:"state"`
// when account feature was updated
UpdatedAt time.Time `json:"updated_at"`
}
// Info for an existing account feature.
//
// accountFeatureIdentity is the unique identifier of the AccountFeature.
func (c *Client) AccountFeatureInfo(accountFeatureIdentity string) (*AccountFeature, error) {
var accountFeature AccountFeature
return &accountFeature, c.Get(&accountFeature, "/account/features/"+accountFeatureIdentity)
}
// List existing account features.
//
// lr is an optional ListRange that sets the Range options for the paginated
// list of results.
func (c *Client) AccountFeatureList(lr *ListRange) ([]AccountFeature, error) {
req, err := c.NewRequest("GET", "/account/features", nil)
if err != nil {
return nil, err
}
if lr != nil {
lr.SetHeader(req)
}
var accountFeaturesRes []AccountFeature
return accountFeaturesRes, c.DoReq(req, &accountFeaturesRes)
}
// Update an existing account feature.
//
// accountFeatureIdentity is the unique identifier of the AccountFeature.
// enabled is the whether or not account feature has been enabled.
func (c *Client) AccountFeatureUpdate(accountFeatureIdentity string, enabled bool) (*AccountFeature, error) {
params := struct {
Enabled bool `json:"enabled"`
}{
Enabled: enabled,
}
var accountFeatureRes AccountFeature
return &accountFeatureRes, c.Patch(&accountFeatureRes, "/account/features/"+accountFeatureIdentity, params)
}