-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
entitlement.go
40 lines (32 loc) · 1.09 KB
/
entitlement.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 keygen
import "time"
type EntitlementCode string
// Entitlement represents a Keygen entitlement object.
type Entitlement struct {
ID string `json:"-"`
Type string `json:"-"`
Code EntitlementCode `json:"code"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
Metadata map[string]interface{} `json:"metadata"`
}
// SetID implements the jsonapi.UnmarshalResourceIdentifier interface.
func (e *Entitlement) SetID(id string) error {
e.ID = id
return nil
}
// SetType implements the jsonapi.UnmarshalResourceIdentifier interface.
func (e *Entitlement) SetType(t string) error {
e.Type = t
return nil
}
// SetData implements the jsonapi.UnmarshalData interface.
func (e *Entitlement) SetData(to func(target interface{}) error) error {
return to(e)
}
// Entitlements represents an array of entitlement objects.
type Entitlements []Entitlement
// SetData implements the jsonapi.UnmarshalData interface.
func (e *Entitlements) SetData(to func(target interface{}) error) error {
return to(e)
}