2017-09-11 20:45:57 +00:00
|
|
|
package activitypub
|
|
|
|
|
2017-09-16 17:53:11 +00:00
|
|
|
type (
|
2018-03-25 18:54:51 +00:00
|
|
|
// FollowersCollection is a collection of followers
|
2019-05-18 21:13:00 +00:00
|
|
|
FollowersCollection = Followers
|
2017-09-11 20:45:57 +00:00
|
|
|
|
2018-03-25 18:54:51 +00:00
|
|
|
// Followers is a Collection type
|
2019-12-03 16:23:59 +00:00
|
|
|
Followers Collection
|
2017-09-16 17:53:11 +00:00
|
|
|
)
|
2018-10-04 19:05:01 +00:00
|
|
|
|
|
|
|
// FollowersNew initializes a new Followers
|
|
|
|
func FollowersNew() *Followers {
|
2019-12-03 16:23:59 +00:00
|
|
|
id := ObjectID("followers")
|
2018-10-04 19:05:01 +00:00
|
|
|
|
2019-12-03 16:23:59 +00:00
|
|
|
i := Followers{ID: id, Type: CollectionType}
|
|
|
|
i.Name = NaturalLanguageValuesNew()
|
|
|
|
i.Content = NaturalLanguageValuesNew()
|
|
|
|
i.Summary = NaturalLanguageValuesNew()
|
2018-10-04 19:05:01 +00:00
|
|
|
|
|
|
|
i.TotalItems = 0
|
|
|
|
|
|
|
|
return &i
|
|
|
|
}
|
|
|
|
|
|
|
|
// Append adds an element to an Followers
|
2019-12-03 16:23:59 +00:00
|
|
|
func (f *Followers) Append(ob Item) error {
|
2018-10-11 18:48:38 +00:00
|
|
|
f.Items = append(f.Items, ob)
|
|
|
|
f.TotalItems++
|
2018-10-04 19:05:01 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetID returns the ObjectID corresponding to Followers
|
2019-12-03 16:23:59 +00:00
|
|
|
func (f Followers) GetID() ObjectID {
|
2018-10-11 18:48:38 +00:00
|
|
|
return f.Collection().GetID()
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetLink returns the IRI corresponding to the current Followers object
|
2019-12-03 16:23:59 +00:00
|
|
|
func (f Followers) GetLink() IRI {
|
|
|
|
return IRI(f.ID)
|
2018-10-04 19:05:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetType returns the Followers's type
|
2019-12-03 16:23:59 +00:00
|
|
|
func (f Followers) GetType() ActivityVocabularyType {
|
2018-10-11 18:48:38 +00:00
|
|
|
return f.Type
|
2018-10-04 19:05:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// IsLink returns false for an Followers object
|
2018-10-11 18:48:38 +00:00
|
|
|
func (f Followers) IsLink() bool {
|
2018-10-04 19:05:01 +00:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsObject returns true for a Followers object
|
2018-10-11 18:48:38 +00:00
|
|
|
func (f Followers) IsObject() bool {
|
2018-10-04 19:05:01 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
// UnmarshalJSON
|
2018-10-11 18:48:38 +00:00
|
|
|
func (f *Followers) UnmarshalJSON(data []byte) error {
|
2019-12-03 16:23:59 +00:00
|
|
|
if ItemTyperFunc == nil {
|
|
|
|
ItemTyperFunc = JSONGetItemByType
|
2019-05-18 21:13:00 +00:00
|
|
|
}
|
2019-12-03 16:23:59 +00:00
|
|
|
c := Collection(*f)
|
2018-10-04 19:05:01 +00:00
|
|
|
err := c.UnmarshalJSON(data)
|
|
|
|
|
2018-10-11 18:48:38 +00:00
|
|
|
*f = Followers(c)
|
2018-10-04 19:05:01 +00:00
|
|
|
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Collection returns the underlying Collection type
|
2019-12-03 16:23:59 +00:00
|
|
|
func (f Followers) Collection() CollectionInterface {
|
|
|
|
c := Collection(f)
|
2018-10-04 19:05:01 +00:00
|
|
|
return &c
|
|
|
|
}
|