2019-01-30 06:28:40 +09:00
package streams
import (
"context"
"errors"
vocab "github.com/go-fed/activity/streams/vocab"
)
// TypePredicatedResolver resolves ActivityStreams values if the value satisfies a
// predicate condition based on its type.
type TypePredicatedResolver struct {
delegate Resolver
predicate interface { }
}
// NewTypePredicatedResolver creates a new Resolver that applies a predicate to an
// ActivityStreams value to determine whether to Resolve or not. The
// ActivityStreams value's type is examined to determine if the predicate can
// apply itself to the value. This guarantees the predicate will receive a
// concrete value whose underlying ActivityStreams type matches the concrete
// interface name. The predicate function must be of the form:
//
// func(context.Context, <TypeInterface>) (bool, error)
//
// where TypeInterface is the code-generated interface for an ActivityStreams
// type. An error is returned if the predicate does not match this signature.
func NewTypePredicatedResolver ( delegate Resolver , predicate interface { } ) ( * TypePredicatedResolver , error ) {
// The predicate must satisfy one known predicate function signature, or else we will generate a runtime error instead of silently fail.
switch predicate . ( type ) {
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . AcceptInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
case func ( context . Context , vocab . ActivityInterface ) ( bool , error ) :
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . AddInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . AnnounceInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . ApplicationInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . ArriveInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . ArticleInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . AudioInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . BlockInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . CollectionInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . CollectionPageInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . CreateInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . DeleteInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . DislikeInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . DocumentInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . EventInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . FlagInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . FollowInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
case func ( context . Context , vocab . GroupInterface ) ( bool , error ) :
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . IgnoreInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . ImageInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . IntransitiveActivityInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . InviteInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . JoinInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . LeaveInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . LikeInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . LinkInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . ListenInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . MentionInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . MoveInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . NoteInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . ObjectInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . OfferInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . OrderedCollectionInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . OrderedCollectionPageInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . OrganizationInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . PageInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . PersonInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . PlaceInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . ProfileInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . QuestionInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . ReadInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . RejectInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . RelationshipInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . RemoveInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
case func ( context . Context , vocab . ServiceInterface ) ( bool , error ) :
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . TentativeAcceptInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . TentativeRejectInterface ) ( bool , error ) :
// Do nothing, this predicate has a correct signature.
case func ( context . Context , vocab . TombstoneInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
case func ( context . Context , vocab . TravelInterface ) ( bool , error ) :
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . UndoInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
2019-02-05 06:29:04 +09:00
case func ( context . Context , vocab . UpdateInterface ) ( bool , error ) :
// Do nothing, this predicate has a correct signature.
case func ( context . Context , vocab . VideoInterface ) ( bool , error ) :
// Do nothing, this predicate has a correct signature.
case func ( context . Context , vocab . ViewInterface ) ( bool , error ) :
2019-01-30 06:28:40 +09:00
// Do nothing, this predicate has a correct signature.
default :
return nil , errors . New ( "the predicate function is of the wrong signature and would never be called" )
}
return & TypePredicatedResolver {
delegate : delegate ,
predicate : predicate ,
} , nil
}
// Apply uses a predicate to determine whether to resolve the ActivityStreams
// value. The predicate's signature is matched with the ActivityStreams
// value's type. This strictly assures that the predicate will only be passed
// ActivityStream objects whose type matches its interface. Returns an error
// if the ActivityStreams type does not match the predicate, is not a type
// handled by the generated code, or the resolver returns an error. Returns
// true if the predicate returned true.
func ( this TypePredicatedResolver ) Apply ( ctx context . Context , o ActivityStreamsInterface ) ( bool , error ) {
var predicatePasses bool
var err error
switch o . GetName ( ) {
2019-02-05 06:29:04 +09:00
case "Accept" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . AcceptInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . AcceptInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Activity" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . ActivityInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . ActivityInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Add" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . AddInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . AddInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Announce" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . AnnounceInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . AnnounceInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Application" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . ApplicationInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . ApplicationInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Arrive" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . ArriveInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . ArriveInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Article" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . ArticleInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . ArticleInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Audio" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . AudioInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . AudioInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Block" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . BlockInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . BlockInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Collection" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . CollectionInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . CollectionInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "CollectionPage" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . CollectionPageInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . CollectionPageInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Create" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . CreateInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . CreateInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Delete" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . DeleteInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . DeleteInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Dislike" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . DislikeInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . DislikeInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Document" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . DocumentInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . DocumentInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Event" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . EventInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . EventInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Flag" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . FlagInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . FlagInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Follow" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . FollowInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . FollowInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Group" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . GroupInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . GroupInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Ignore" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . IgnoreInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . IgnoreInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Image" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . ImageInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . ImageInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "IntransitiveActivity" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . IntransitiveActivityInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . IntransitiveActivityInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Invite" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . InviteInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . InviteInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Join" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . JoinInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . JoinInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Leave" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . LeaveInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . LeaveInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Like" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . LikeInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . LikeInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Link" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . LinkInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . LinkInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Listen" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . ListenInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . ListenInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Mention" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . MentionInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . MentionInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Move" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . MoveInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . MoveInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Note" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . NoteInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . NoteInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Object" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . ObjectInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . ObjectInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Offer" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . OfferInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . OfferInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "OrderedCollection" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . OrderedCollectionInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . OrderedCollectionInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "OrderedCollectionPage" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . OrderedCollectionPageInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . OrderedCollectionPageInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Organization" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . OrganizationInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . OrganizationInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Page" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . PageInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . PageInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Person" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . PersonInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . PersonInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Place" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . PlaceInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . PlaceInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Profile" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . ProfileInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . ProfileInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Question" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . QuestionInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . QuestionInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Read" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . ReadInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . ReadInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Reject" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . RejectInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . RejectInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Relationship" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . RelationshipInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . RelationshipInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Remove" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . RemoveInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . RemoveInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Service" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . ServiceInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . ServiceInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "TentativeAccept" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . TentativeAcceptInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . TentativeAcceptInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "TentativeReject" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . TentativeRejectInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . TentativeRejectInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Tombstone" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . TombstoneInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . TombstoneInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Travel" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . TravelInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . TravelInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Undo" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . UndoInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . UndoInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Update" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . UpdateInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . UpdateInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "Video" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . VideoInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . VideoInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
2019-02-05 06:29:04 +09:00
case "View" :
if fn , ok := this . predicate . ( func ( context . Context , vocab . ViewInterface ) ( bool , error ) ) ; ok {
if v , ok := o . ( vocab . ViewInterface ) ; ok {
2019-01-30 06:28:40 +09:00
predicatePasses , err = fn ( ctx , v )
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false , errCannotTypeAssertType
}
} else {
return false , ErrPredicateUnmatched
}
default :
return false , ErrUnhandledType
}
if err != nil {
return predicatePasses , err
}
if predicatePasses {
return true , this . delegate . Resolve ( ctx , o )
} else {
return false , nil
}
}