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
/
Copy pathplan.go
68 lines (54 loc) · 1.76 KB
/
plan.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
// 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"
)
// Plans represent different configurations of add-ons that may be added to
// apps.
type Plan struct {
// when plan was created
CreatedAt time.Time `json:"created_at"`
// whether this plan is the default for its addon service
Default bool `json:"default"`
// description of plan
Description string `json:"description"`
// unique identifier of this plan
Id string `json:"id"`
// unique name of this plan
Name string `json:"name"`
// price
Price struct {
Cents int `json:"cents"`
Unit string `json:"unit"`
} `json:"price"`
// release status for plan
State string `json:"state"`
// when plan was updated
UpdatedAt time.Time `json:"updated_at"`
}
// Info for existing plan.
//
// addonServiceIdentity is the unique identifier of the Plan's AddonService.
// planIdentity is the unique identifier of the Plan.
func (c *Client) PlanInfo(addonServiceIdentity string, planIdentity string) (*Plan, error) {
var plan Plan
return &plan, c.Get(&plan, "/addon-services/"+addonServiceIdentity+"/plans/"+planIdentity)
}
// List existing plans.
//
// addonServiceIdentity is the unique identifier of the Plan's AddonService. lr
// is an optional ListRange that sets the Range options for the paginated list
// of results.
func (c *Client) PlanList(addonServiceIdentity string, lr *ListRange) ([]Plan, error) {
req, err := c.NewRequest("GET", "/addon-services/"+addonServiceIdentity+"/plans", nil)
if err != nil {
return nil, err
}
if lr != nil {
lr.SetHeader(req)
}
var plansRes []Plan
return plansRes, c.DoReq(req, &plansRes)
}