Changes
4 changed files (+294/-4)
-
-
@@ -1,5 +1,7 @@package activitypub import "fmt" type ( // FollowersCollection is a collection of followers FollowersCollection Followers
-
@@ -7,3 +9,106 @@ type (// Followers is a Collection type Followers Collection ) // FollowersNew initializes a new Followers func FollowersNew() *Followers { id := ObjectID("followers") i := Followers{ID: id, Type: OrderedCollectionType} i.Name = NaturalLanguageValueNew() i.Content = NaturalLanguageValueNew() i.Summary = NaturalLanguageValueNew() i.TotalItems = 0 return &i } // Append adds an element to an FollowersCollection func (i *FollowersCollection) Append(o Item) error { if i == nil { return fmt.Errorf("nil ") } i.Items = append(i.Items, o) i.TotalItems++ return nil } // Append adds an element to an Followers func (i *Followers) Append(ob Item) error { i.Items = append(i.Items, ob) i.TotalItems++ return nil } // GetID returns the ObjectID corresponding to FollowersCollection func (i FollowersCollection) GetID() *ObjectID { return i.Collection().GetID() } // GetType returns the FollowersCollection's type func (i FollowersCollection) GetType() ActivityVocabularyType { return i.Type } // IsLink returns false for an FollowersCollection object func (i FollowersCollection) IsLink() bool { return false } // IsObject returns true for a FollowersCollection object func (i FollowersCollection) IsObject() bool { return true } // GetID returns the ObjectID corresponding to Followers func (i Followers) GetID() *ObjectID { return i.Collection().GetID() } // GetType returns the Followers's type func (i Followers) GetType() ActivityVocabularyType { return i.Type } // IsLink returns false for an Followers object func (i Followers) IsLink() bool { return false } // IsObject returns true for a Followers object func (i Followers) IsObject() bool { return true } // UnmarshalJSON func (i *FollowersCollection) UnmarshalJSON(data []byte) error { c := Collection(*i) err := c.UnmarshalJSON(data) *i = FollowersCollection(c) return err } // UnmarshalJSON func (i *Followers) UnmarshalJSON(data []byte) error { c := Collection(*i) err := c.UnmarshalJSON(data) *i = Followers(c) return err } // Collection returns the underlying Collection type func (i Followers) Collection() CollectionInterface { c := Collection(i) return &c } // Collection returns the underlying Collection type func (i FollowersCollection) Collection() CollectionInterface { c := Collection(i) return &c }
-
-
-
@@ -1,5 +1,7 @@package activitypub import "fmt" type ( // FollowingCollection is a list of everybody that the actor has followed, added as a side effect. // The following collection MUST be either an OrderedCollection or a Collection and MAY
-
@@ -9,3 +11,106 @@ type (// Following is a type alias for a simple Collection Following Collection ) // FollowingNew initializes a new Following func FollowingNew() *Following { id := ObjectID("following") i := Following{ID: id, Type: OrderedCollectionType} i.Name = NaturalLanguageValueNew() i.Content = NaturalLanguageValueNew() i.Summary = NaturalLanguageValueNew() i.TotalItems = 0 return &i } // Append adds an element to an FollowingCollection func (i *FollowingCollection) Append(o Item) error { if i == nil { return fmt.Errorf("nil ") } i.Items = append(i.Items, o) i.TotalItems++ return nil } // Append adds an element to an Following func (i *Following) Append(ob Item) error { i.Items = append(i.Items, ob) i.TotalItems++ return nil } // GetID returns the ObjectID corresponding to FollowingCollection func (i FollowingCollection) GetID() *ObjectID { return i.Collection().GetID() } // GetType returns the FollowingCollection's type func (i FollowingCollection) GetType() ActivityVocabularyType { return i.Type } // IsLink returns false for an FollowingCollection object func (i FollowingCollection) IsLink() bool { return false } // IsObject returns true for a FollowingCollection object func (i FollowingCollection) IsObject() bool { return true } // GetID returns the ObjectID corresponding to Following func (i Following) GetID() *ObjectID { return i.Collection().GetID() } // GetType returns the Following's type func (i Following) GetType() ActivityVocabularyType { return i.Type } // IsLink returns false for an Following object func (i Following) IsLink() bool { return false } // IsObject returns true for a Following object func (i Following) IsObject() bool { return true } // UnmarshalJSON func (i *FollowingCollection) UnmarshalJSON(data []byte) error { c := Collection(*i) err := c.UnmarshalJSON(data) *i = FollowingCollection(c) return err } // UnmarshalJSON func (i *Following) UnmarshalJSON(data []byte) error { c := Collection(*i) err := c.UnmarshalJSON(data) *i = Following(c) return err } // Collection returns the underlying Collection type func (i Following) Collection() CollectionInterface { c := Collection(i) return &c } // Collection returns the underlying Collection type func (i FollowingCollection) Collection() CollectionInterface { c := Collection(i) return &c }
-
-
-
@@ -80,13 +80,13 @@ func (l Liked) IsObject() bool {} // Collection returns the underlying Collection type func (l *Liked) Collection() CollectionInterface { c := OrderedCollection(*l) func (l Liked) Collection() CollectionInterface { c := OrderedCollection(l) return &c } // Collection returns the underlying Collection type func (l *LikedCollection) Collection() CollectionInterface { c := OrderedCollection(*l) func (l LikedCollection) Collection() CollectionInterface { c := OrderedCollection(l) return &c }
-
-
-
@@ -10,3 +10,83 @@ type (// Likes is a type alias for an Ordered Collection Likes OrderedCollection ) // LikesCollection initializes a new Outbox func LikesNew() *Likes { id := ObjectID("likes") l := Likes{ID: id, Type: OrderedCollectionType} l.Name = NaturalLanguageValueNew() l.Content = NaturalLanguageValueNew() l.Summary = NaturalLanguageValueNew() l.TotalItems = 0 return &l } // Append adds an element to an LikesCollection func (l *LikesCollection) Append(o Item) error { l.OrderedItems = append(l.OrderedItems, o) l.TotalItems++ return nil } // Append adds an element to an Outbox func (l *Likes) Append(ob Item) error { l.OrderedItems = append(l.OrderedItems, ob) l.TotalItems++ return nil } // GetID returns the ObjectID corresponding to the LikesCollection func (l LikesCollection) GetID() *ObjectID { return l.Collection().GetID() } // GetType returns the LikesCollection's type func (l LikesCollection) GetType() ActivityVocabularyType { return l.Type } // IsLink returns false for an LikesCollection object func (l LikesCollection) IsLink() bool { return false } // IsObject returns true for a LikesCollection object func (l LikesCollection) IsObject() bool { return true } // GetID returns the ObjectID corresponding to the Likes func (l Likes) GetID() *ObjectID { return l.Collection().GetID() } // GetType returns the Likes's type func (l Likes) GetType() ActivityVocabularyType { return l.Type } // IsLink returns false for an Likes object func (l Likes) IsLink() bool { return false } // IsObject returns true for a Likes object func (l Likes) IsObject() bool { return true } // Collection returns the underlying Collection type func (l Likes) Collection() CollectionInterface { c := OrderedCollection(l) return &c } // Collection returns the underlying Collection type func (l LikesCollection) Collection() CollectionInterface { c := OrderedCollection(l) return &c }
-