Support creating Follow activities
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user