diff --git a/activitystreams/activity.go b/activitystreams/activity.go index bf77c79..aab4c9f 100644 --- a/activitystreams/activity.go +++ b/activitystreams/activity.go @@ -22,6 +22,15 @@ type Activity struct { Object *Object `json:"object"` } +type FollowActivity struct { + BaseObject + Actor string `json:"actor"` + Published time.Time `json:"published,omitempty"` + To []string `json:"to,omitempty"` + CC []string `json:"cc,omitempty"` + Object string `json:"object"` +} + // NewCreateActivity builds a basic Create activity that includes the given // Object and the Object's AttributedTo property as the Actor. func NewCreateActivity(o *Object) *Activity { @@ -75,6 +84,21 @@ func NewDeleteActivity(o *Object) *Activity { return &a } +// NewFollowActivity builds a basic Follow activity. +func NewFollowActivity(actorIRI, followeeIRI string) *FollowActivity { + a := FollowActivity{ + BaseObject: BaseObject{ + Context: []interface{}{ + Namespace, + }, + Type: "Follow", + }, + Actor: actorIRI, + Object: followeeIRI, + } + return &a +} + // Object is the primary base type for the Activity Streams vocabulary. type Object struct { BaseObject