Adding IsObject to collections

This commit is contained in:
Marius Orcsik 2018-07-18 21:34:08 +02:00
parent e630cf771c
commit 1100bd7ddc
No known key found for this signature in database
GPG key ID: 889CE8E4FB2D877A
4 changed files with 34 additions and 4 deletions

View file

@ -55,6 +55,11 @@ func (i InboxStream) IsLink() bool {
return false
}
// IsObject returns true for a InboxStream object
func (i InboxStream) IsObject() bool {
return true
}
// GetID returns the ObjectID corresponding to Inbox
func (i Inbox) GetID() ObjectID {
return i.ID
@ -69,3 +74,8 @@ func (i Inbox) GetType() ActivityVocabularyType {
func (i Inbox) IsLink() bool {
return false
}
// IsObject returns true for a Inbox object
func (i Inbox) IsObject() bool {
return true
}

View file

@ -54,6 +54,11 @@ func (l LikedCollection) IsLink() bool {
return false
}
// IsObject returns true for a LikedCollection object
func (l LikedCollection) IsObject() bool {
return true
}
// GetID returns the ObjectID corresponding to the Liked
func (l Liked) GetID() ObjectID {
return l.ID
@ -68,3 +73,8 @@ func (l Liked) GetType() ActivityVocabularyType {
func (l Liked) IsLink() bool {
return false
}
// IsObject returns true for a Liked object
func (l Liked) IsObject() bool {
return true
}

View file

@ -86,14 +86,15 @@ type (
ActivityVocabularyType string
// ActivityObject is a subtype of Object that describes some form of action that may happen,
// is currently happening, or has already happened
ActivityObject interface{}
ActivityObject interface{
GetID() ObjectID
}
// ObjectOrLink describes an object of any kind.
ObjectOrLink interface {
ActivityObject
GetID() ObjectID
GetType() ActivityVocabularyType
//IsLink() bool
//IsObject() bool
IsLink() bool
IsObject() bool
//UnmarshalJSON([]byte) error
}
// ObjectsArr is a named type for matching an ObjectOrLink slice type to Collection interface

View file

@ -52,6 +52,10 @@ func (o OutboxStream) GetType() ActivityVocabularyType {
func (o OutboxStream) IsLink() bool {
return false
}
// IsObject returns true for a OutboxStream object
func (o OutboxStream) IsObject() bool {
return true
}
// GetID returns the ObjectID corresponding to Outbox
func (o Outbox) GetID() ObjectID {
@ -67,3 +71,8 @@ func (o Outbox) GetType() ActivityVocabularyType {
func (o Outbox) IsLink() bool {
return false
}
// IsObject returns true for a Outbox object
func (o Outbox) IsObject() bool {
return true
}