Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F10433505
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
View Options
diff --git a/activitystreams/activity.go b/activitystreams/activity.go
index 8b2100b..a5c1644 100644
--- a/activitystreams/activity.go
+++ b/activitystreams/activity.go
@@ -1,100 +1,101 @@
// Package activitystreams provides all the basic ActivityStreams
// implementation needed for Write.as.
package activitystreams
import (
"time"
)
const (
Namespace = "https://www.w3.org/ns/activitystreams"
toPublic = "https://www.w3.org/ns/activitystreams#Public"
)
// Activity describes actions that have either already occurred, are in the
// process of occurring, or may occur in the future.
type Activity struct {
BaseObject
Actor string `json:"actor"`
Published time.Time `json:"published,omitempty"`
To []string `json:"to,omitempty"`
CC []string `json:"cc,omitempty"`
Object *Object `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 {
a := Activity{
BaseObject: BaseObject{
Context: []interface{}{
Namespace,
},
ID: o.ID,
Type: "Create",
},
- Actor: o.AttributedTo,
- Object: o,
+ Actor: o.AttributedTo,
+ Object: o,
+ Published: o.Published,
}
return &a
}
// NewDeleteActivity builds a basic Delete activity that includes the given
// Object and the Object's AttributedTo property as the Actor.
func NewDeleteActivity(o *Object) *Activity {
a := Activity{
BaseObject: BaseObject{
Context: []interface{}{
Namespace,
},
ID: o.ID,
Type: "Delete",
},
Actor: o.AttributedTo,
Object: o,
}
return &a
}
// Object is the primary base type for the Activity Streams vocabulary.
type Object struct {
BaseObject
Published time.Time `json:"published"`
Summary *string `json:"summary,omitempty"`
InReplyTo *string `json:"inReplyTo"`
URL string `json:"url"`
AttributedTo string `json:"attributedTo"`
To []string `json:"to"`
CC []string `json:"cc,omitempty"`
Name string `json:"name,omitempty"`
Content string `json:"content"`
ContentMap map[string]string `json:"contentMap,omitempty"`
}
// NewNoteObject creates a basic Note object that includes the public
// namespace in IRIs it's addressed to.
func NewNoteObject() *Object {
o := Object{
BaseObject: BaseObject{
Type: "Note",
},
To: []string{
toPublic,
},
}
return &o
}
// NewArticleObject creates a basic Article object that includes the public
// namespace in IRIs it's addressed to.
func NewArticleObject() *Object {
o := Object{
BaseObject: BaseObject{
Type: "Article",
},
To: []string{
toPublic,
},
}
return &o
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Jan 20, 4:11 AM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3137629
Attached To
rWC Write.as Web Core
Event Timeline
Log In to Comment