api: inform Object whether or not it has expired
This commit is contained in:
parent
81ce51728a
commit
b75ac1d672
@ -58,6 +58,16 @@ func (o *ObjectResource) Rel(name string) (*LinkRelation, bool) {
|
||||
return rel, ok
|
||||
}
|
||||
|
||||
func (o *ObjectResource) IsExpired(now time.Time) bool {
|
||||
for _, a := range o.Actions {
|
||||
if a.ExpiresAt.Before(now) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
type LinkRelation struct {
|
||||
Href string `json:"href"`
|
||||
Header map[string]string `json:"header,omitempty"`
|
||||
|
Loading…
Reference in New Issue
Block a user