api: inform Object whether or not it has expired

This commit is contained in:
Taylor Blau 2016-07-05 08:25:23 -06:00
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"`