forked from go-auth0/auth0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
grant.go
40 lines (28 loc) · 754 Bytes
/
grant.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
package management
import "encoding/json"
type Grant struct {
// The id of the grant.
ID *string `json:"id,omitempty"`
// The id of the client.
ClientID *string `json:"clientID,omitempty"`
// The id of the user.
UserID *string `json:"user_id`
// The grant's audience.
Audience *string `json:"audience,omitempty"`
Scope []interface{} `json:"scope,omitempty"`
}
func (g *Grant) String() string {
b, _ := json.MarshalIndent(g, "", " ")
return string(b)
}
type GrantManager struct {
m *Management
}
func NewGrantManager(m *Management) *GrantManager {
return &GrantManager{m}
}
func (gm *GrantManager) List(opts ...reqOption) ([]*Grant, error) {
var g []*Grant
err := gm.m.get(gm.m.uri("grants")+gm.m.q(opts), &g)
return g, err
}