Documentation
¶
Overview ¶
Package activitystreams provides all the basic ActivityStreams implementation needed for Write.as.
Index ¶
Constants ¶
const (
Namespace = "https://www.w3.org/ns/activitystreams"
)
Variables ¶
var Extensions = map[string]string{}
Functions ¶
This section is empty.
Types ¶
type Activity ¶
type Activity struct { BaseObject Actor string `json:"actor"` Published time.Time `json:"published,omitempty"` Updated *time.Time `json:"updated,omitempty"` To []string `json:"to,omitempty"` CC []string `json:"cc,omitempty"` Object *Object `json:"object"` }
Activity describes actions that have either already occurred, are in the process of occurring, or may occur in the future.
func NewCreateActivity ¶
NewCreateActivity builds a basic Create activity that includes the given Object and the Object's AttributedTo property as the Actor.
func NewDeleteActivity ¶
NewDeleteActivity builds a basic Delete activity that includes the given Object and the Object's AttributedTo property as the Actor.
func NewUpdateActivity ¶
NewUpdateActivity builds a basic Update activity that includes the given Object and the Object's AttributedTo property as the Actor.
type Attachment ¶ added in v1.3.0
type Attachment struct { Type AttachmentType `json:"type"` URL string `json:"url"` MediaType string `json:"mediaType"` Name string `json:"name"` }
func NewDocumentAttachment ¶ added in v1.4.0
func NewDocumentAttachment(url string) Attachment
NewDocumentAttachment creates a new Attachment from the given URL, setting the correct type and automatically detecting the MediaType based on the file extension.
func NewImageAttachment ¶ added in v1.3.0
func NewImageAttachment(url string) Attachment
NewImageAttachment creates a new Attachment from the given URL, setting the correct type and automatically detecting the MediaType based on the file extension.
type AttachmentType ¶ added in v1.3.0
type AttachmentType string
const ( AttachImage AttachmentType = "Image" AttachDocument AttachmentType = "Document" )
type BaseObject ¶
type FollowActivity ¶
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"` }
func NewFollowActivity ¶
func NewFollowActivity(actorIRI, followeeIRI string) *FollowActivity
NewFollowActivity builds a basic Follow activity.
type Object ¶
type Object struct { BaseObject Published time.Time `json:"published,omitempty"` Updated *time.Time `json:"updated,omitempty"` Summary *string `json:"summary,omitempty"` InReplyTo *string `json:"inReplyTo,omitempty"` URL string `json:"url"` AttributedTo string `json:"attributedTo,omitempty"` To []string `json:"to,omitempty"` CC []string `json:"cc,omitempty"` Name string `json:"name,omitempty"` Content string `json:"content,omitempty"` ContentMap map[string]string `json:"contentMap,omitempty"` Tag []Tag `json:"tag,omitempty"` Attachment []Attachment `json:"attachment,omitempty"` Preview *Object `json:"preview,omitempty"` // Person Inbox string `json:"inbox,omitempty"` Outbox string `json:"outbox,omitempty"` Following string `json:"following,omitempty"` Followers string `json:"followers,omitempty"` PreferredUsername string `json:"preferredUsername,omitempty"` Icon *Image `json:"icon,omitempty"` PublicKey *PublicKey `json:"publicKey,omitempty"` Endpoints *Endpoints `json:"endpoints,omitempty"` }
Object is the primary base type for the Activity Streams vocabulary.
func NewArticleObject ¶
func NewArticleObject() *Object
NewArticleObject creates a basic Article object that includes the public namespace in IRIs it's addressed to.
func NewNoteObject ¶
func NewNoteObject() *Object
NewNoteObject creates a basic Note object that includes the public namespace in IRIs it's addressed to.
func NewPersonObject ¶ added in v1.4.1
func NewPersonObject() *Object
NewPersonObject creates a basic Person object.
type OrderedCollection ¶
type OrderedCollection struct { BaseObject TotalItems int `json:"totalItems"` First string `json:"first"` Last string `json:"last,omitempty"` }
func NewOrderedCollection ¶
func NewOrderedCollection(accountRoot, collType string, items int) *OrderedCollection
type OrderedCollectionPage ¶
type OrderedCollectionPage struct { BaseObject TotalItems int `json:"totalItems"` PartOf string `json:"partOf"` Next string `json:"next,omitempty"` Prev string `json:"prev,omitempty"` OrderedItems []interface{} `json:"orderedItems,omitempty"` }
func NewOrderedCollectionPage ¶
func NewOrderedCollectionPage(accountRoot, collType string, items, page int) *OrderedCollectionPage
type Person ¶
type Person struct { BaseObject Inbox string `json:"inbox"` Outbox string `json:"outbox"` PreferredUsername string `json:"preferredUsername"` URL string `json:"url"` Name string `json:"name"` Icon Image `json:"icon"` Following string `json:"following"` Followers string `json:"followers"` Summary string `json:"summary"` PublicKey PublicKey `json:"publicKey"` Endpoints Endpoints `json:"endpoints"` }