2017-09-11 20:45:57 +00:00
|
|
|
package activitypub
|
|
|
|
|
2017-09-16 17:53:11 +00:00
|
|
|
type (
|
2018-03-27 14:16:07 +00:00
|
|
|
// SharesCollection is a list of all Announce activities with this object as the object property,
|
|
|
|
// added as a side effect. The shares collection MUST be either an OrderedCollection or a Collection
|
|
|
|
// and MAY be filtered on privileges of an authenticated user or as appropriate when no authentication
|
|
|
|
// is given.
|
2019-05-18 21:13:00 +00:00
|
|
|
SharesCollection = Shares
|
2017-09-11 20:45:57 +00:00
|
|
|
|
2018-03-27 14:16:07 +00:00
|
|
|
// Shares is a type alias for an Ordered Collection
|
2019-12-03 16:23:59 +00:00
|
|
|
Shares OrderedCollection
|
2017-09-16 17:53:11 +00:00
|
|
|
)
|
2018-10-11 18:48:38 +00:00
|
|
|
|
|
|
|
// SharesNew initializes a new Shares
|
|
|
|
func SharesNew() *Shares {
|
2019-12-03 16:23:59 +00:00
|
|
|
id := ObjectID("Shares")
|
2018-10-11 18:48:38 +00:00
|
|
|
|
2019-12-03 16:23:59 +00:00
|
|
|
i := Shares{ID: id, Type: CollectionType}
|
|
|
|
i.Name = NaturalLanguageValuesNew()
|
|
|
|
i.Content = NaturalLanguageValuesNew()
|
2018-10-11 18:48:38 +00:00
|
|
|
|
|
|
|
i.TotalItems = 0
|
|
|
|
|
|
|
|
return &i
|
|
|
|
}
|
|
|
|
|
|
|
|
// Append adds an element to an Shares
|
2019-12-03 16:23:59 +00:00
|
|
|
func (o *Shares) Append(ob Item) error {
|
2018-10-11 18:48:38 +00:00
|
|
|
o.OrderedItems = append(o.OrderedItems, ob)
|
|
|
|
o.TotalItems++
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetID returns the ObjectID corresponding to Shares
|
2019-12-03 16:23:59 +00:00
|
|
|
func (o Shares) GetID() ObjectID {
|
2018-10-11 18:48:38 +00:00
|
|
|
return o.Collection().GetID()
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetLink returns the IRI corresponding to the current Shares object
|
2019-12-03 16:23:59 +00:00
|
|
|
func (o Shares) GetLink() IRI {
|
|
|
|
return IRI(o.ID)
|
2018-10-11 18:48:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetType returns the Shares's type
|
2019-12-03 16:23:59 +00:00
|
|
|
func (o Shares) GetType() ActivityVocabularyType {
|
2018-10-11 18:48:38 +00:00
|
|
|
return o.Type
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsLink returns false for an Shares object
|
|
|
|
func (o Shares) IsLink() bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
// IsObject returns true for a Shares object
|
|
|
|
func (o Shares) IsObject() bool {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
// UnmarshalJSON
|
|
|
|
func (o *Shares) 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 := OrderedCollection(*o)
|
2018-10-11 18:48:38 +00:00
|
|
|
err := c.UnmarshalJSON(data)
|
|
|
|
|
|
|
|
*o = Shares(c)
|
|
|
|
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Collection returns the underlying Collection type
|
2019-12-03 16:23:59 +00:00
|
|
|
func (o Shares) Collection() CollectionInterface {
|
|
|
|
c := OrderedCollection(o)
|
2018-10-11 18:48:38 +00:00
|
|
|
return &c
|
|
|
|
}
|