Add documentation to activity.go
Including the activitystreams package.
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
// Package activitystreams provides all the basic ActivityStreams
|
||||||
|
// implementation needed for Write.as.
|
||||||
package activitystreams
|
package activitystreams
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -9,6 +11,8 @@ const (
|
|||||||
toPublic = "https://www.w3.org/ns/activitystreams#Public"
|
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 {
|
type Activity struct {
|
||||||
BaseObject
|
BaseObject
|
||||||
Actor string `json:"actor"`
|
Actor string `json:"actor"`
|
||||||
@@ -18,6 +22,8 @@ type Activity struct {
|
|||||||
Object *Object `json:"object"`
|
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 {
|
func NewCreateActivity(o *Object) *Activity {
|
||||||
a := Activity{
|
a := Activity{
|
||||||
BaseObject: BaseObject{
|
BaseObject: BaseObject{
|
||||||
@@ -33,6 +39,7 @@ func NewCreateActivity(o *Object) *Activity {
|
|||||||
return &a
|
return &a
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Object is the primary base type for the Activity Streams vocabulary.
|
||||||
type Object struct {
|
type Object struct {
|
||||||
BaseObject
|
BaseObject
|
||||||
Published time.Time `json:"published"`
|
Published time.Time `json:"published"`
|
||||||
@@ -47,6 +54,8 @@ type Object struct {
|
|||||||
ContentMap map[string]string `json:"contentMap,omitempty"`
|
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 {
|
func NewNoteObject() *Object {
|
||||||
o := Object{
|
o := Object{
|
||||||
BaseObject: BaseObject{
|
BaseObject: BaseObject{
|
||||||
@@ -59,6 +68,8 @@ func NewNoteObject() *Object {
|
|||||||
return &o
|
return &o
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewArticleObject creates a basic Article object that includes the public
|
||||||
|
// namespace in IRIs it's addressed to.
|
||||||
func NewArticleObject() *Object {
|
func NewArticleObject() *Object {
|
||||||
o := Object{
|
o := Object{
|
||||||
BaseObject: BaseObject{
|
BaseObject: BaseObject{
|
||||||
|
|||||||
Reference in New Issue
Block a user