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
/
app_feature.go
80 lines (65 loc) · 2.36 KB
/
app_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
78
79
80
// 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 app feature represents a Heroku labs capability that can be enabled or
// disabled for an app on Heroku.
type AppFeature struct {
// when app feature was created
CreatedAt time.Time `json:"created_at"`
// description of app feature
Description string `json:"description"`
// documentation URL of app feature
DocURL string `json:"doc_url"`
// whether or not app feature has been enabled
Enabled bool `json:"enabled"`
// unique identifier of app feature
Id string `json:"id"`
// unique name of app feature
Name string `json:"name"`
// state of app feature
State string `json:"state"`
// when app feature was updated
UpdatedAt time.Time `json:"updated_at"`
}
// Info for an existing app feature.
//
// appIdentity is the unique identifier of the AppFeature's App.
// appFeatureIdentity is the unique identifier of the AppFeature.
func (c *Client) AppFeatureInfo(appIdentity string, appFeatureIdentity string) (*AppFeature, error) {
var appFeature AppFeature
return &appFeature, c.Get(&appFeature, "/apps/"+appIdentity+"/features/"+appFeatureIdentity)
}
// List existing app features.
//
// appIdentity is the unique identifier of the AppFeature's App. lr is an
// optional ListRange that sets the Range options for the paginated list of
// results.
func (c *Client) AppFeatureList(appIdentity string, lr *ListRange) ([]AppFeature, error) {
req, err := c.NewRequest("GET", "/apps/"+appIdentity+"/features", nil)
if err != nil {
return nil, err
}
if lr != nil {
lr.SetHeader(req)
}
var appFeaturesRes []AppFeature
return appFeaturesRes, c.DoReq(req, &appFeaturesRes)
}
// Update an existing app feature.
//
// appIdentity is the unique identifier of the AppFeature's App.
// appFeatureIdentity is the unique identifier of the AppFeature. enabled is the
// whether or not app feature has been enabled.
func (c *Client) AppFeatureUpdate(appIdentity string, appFeatureIdentity string, enabled bool) (*AppFeature, error) {
params := struct {
Enabled bool `json:"enabled"`
}{
Enabled: enabled,
}
var appFeatureRes AppFeature
return &appFeatureRes, c.Patch(&appFeatureRes, "/apps/"+appIdentity+"/features/"+appFeatureIdentity, params)
}