2019-01-30 06:28:40 +09:00
package streams
import (
"context"
"errors"
vocab "github.com/go-fed/activity/streams/vocab"
)
// TypeResolver resolves ActivityStreams values based on their type name.
type TypeResolver struct {
callbacks [ ] interface { }
}
// NewTypeResolver creates a new Resolver that examines the type of an
// ActivityStream value to determine what callback function to pass the
// concretely typed value. The callback is guaranteed to receive a value whose
// underlying ActivityStreams type matches the concrete interface name in its
// signature. The callback functions must be of the form:
//
// func(context.Context, <TypeInterface>) error
//
// where TypeInterface is the code-generated interface for an ActivityStream
// type. An error is returned if a callback function does not match this
// signature.
2019-02-06 08:26:21 +09:00
func NewTypeResolver ( callbacks ... interface { } ) ( * TypeResolver , error ) {
2019-01-30 06:28:40 +09:00
for _ , cb := range callbacks {
// Each callback function must satisfy one known function signature, or else we will generate a runtime error instead of silently fail.
switch cb . ( type ) {
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsAccept ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsActivity ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsAdd ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsAnnounce ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsApplication ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsArrive ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsArticle ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsAudio ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsBlock ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsCollection ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsCollectionPage ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsCreate ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsDelete ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsDislike ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsDocument ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsEvent ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsFlag ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsFollow ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsGroup ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsIgnore ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsImage ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsIntransitiveActivity ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsInvite ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsJoin ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsLeave ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsLike ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsLink ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsListen ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsMention ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsMove ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsNote ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsObject ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsOffer ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsOrderedCollection ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsOrderedCollectionPage ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsOrganization ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsPage ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsPerson ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsPlace ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsProfile ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsQuestion ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsRead ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsReject ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsRelationship ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsRemove ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsService ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsTentativeAccept ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsTentativeReject ) error :
2019-02-05 06:29:04 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsTombstone ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsTravel ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsUndo ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsUpdate ) error :
2019-02-05 06:29:04 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsVideo ) error :
2019-02-05 06:29:04 +09:00
// Do nothing, this callback has a correct signature.
2019-02-10 05:56:00 +09:00
case func ( context . Context , vocab . ActivityStreamsView ) error :
2019-01-30 06:28:40 +09:00
// Do nothing, this callback has a correct signature.
default :
return nil , errors . New ( "a callback function is of the wrong signature and would never be called" )
}
}
return & TypeResolver { callbacks : callbacks } , nil
}
// Resolve applies the first callback function whose signature accepts the
// ActivityStreams value's type. This strictly assures that the callback
// function will only be passed ActivityStream objects whose type matches its
// interface. Returns an error if the ActivityStreams type does not match
// callbackers, is not a type handled by the generated code, or the value
// passed in is not go-fed compatible.
func ( this TypeResolver ) Resolve ( ctx context . Context , o ActivityStreamsInterface ) error {
for _ , i := range this . callbacks {
2019-02-16 06:11:48 +09:00
if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Accept" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsAccept ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsAccept ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Activity" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsActivity ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsActivity ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Add" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsAdd ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsAdd ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Announce" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsAnnounce ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsAnnounce ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Application" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsApplication ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsApplication ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Arrive" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsArrive ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsArrive ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Article" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsArticle ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsArticle ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Audio" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsAudio ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsAudio ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Block" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsBlock ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsBlock ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Collection" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsCollection ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsCollection ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "CollectionPage" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsCollectionPage ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsCollectionPage ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Create" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsCreate ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsCreate ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Delete" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsDelete ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsDelete ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Dislike" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsDislike ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsDislike ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Document" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsDocument ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsDocument ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Event" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsEvent ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsEvent ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Flag" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsFlag ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsFlag ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Follow" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsFollow ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsFollow ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Group" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsGroup ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsGroup ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Ignore" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsIgnore ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsIgnore ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Image" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsImage ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsImage ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "IntransitiveActivity" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsIntransitiveActivity ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsIntransitiveActivity ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Invite" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsInvite ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsInvite ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Join" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsJoin ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsJoin ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Leave" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsLeave ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsLeave ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Like" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsLike ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsLike ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Link" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsLink ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsLink ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Listen" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsListen ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsListen ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Mention" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsMention ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsMention ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Move" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsMove ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsMove ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Note" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsNote ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsNote ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Object" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsObject ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsObject ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Offer" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsOffer ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsOffer ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "OrderedCollection" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsOrderedCollection ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsOrderedCollection ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "OrderedCollectionPage" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsOrderedCollectionPage ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsOrderedCollectionPage ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Organization" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsOrganization ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsOrganization ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Page" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsPage ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsPage ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Person" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsPerson ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsPerson ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Place" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsPlace ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsPlace ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Profile" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsProfile ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsProfile ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Question" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsQuestion ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsQuestion ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Read" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsRead ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsRead ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Reject" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsReject ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsReject ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Relationship" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsRelationship ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsRelationship ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Remove" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsRemove ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsRemove ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Service" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsService ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsService ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "TentativeAccept" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsTentativeAccept ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsTentativeAccept ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "TentativeReject" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsTentativeReject ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsTentativeReject ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Tombstone" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsTombstone ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsTombstone ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Travel" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsTravel ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsTravel ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Undo" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsUndo ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsUndo ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Update" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsUpdate ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsUpdate ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "Video" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsVideo ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsVideo ) ; ok {
2019-02-05 06:29:04 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-16 06:11:48 +09:00
} else if o . VocabularyURI ( ) == "https://www.w3.org/TR/activitystreams-vocabulary" && o . GetTypeName ( ) == "View" {
2019-02-10 05:56:00 +09:00
if fn , ok := i . ( func ( context . Context , vocab . ActivityStreamsView ) error ) ; ok {
if v , ok := o . ( vocab . ActivityStreamsView ) ; ok {
2019-01-30 06:28:40 +09:00
return 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 errCannotTypeAssertType
}
}
2019-02-10 05:56:00 +09:00
} else {
2019-01-30 06:28:40 +09:00
return ErrUnhandledType
}
}
return ErrNoCallbackMatch
}