activitystreams

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2018 License: MPL-2.0 Imports: 2 Imported by: 4

Documentation

Overview

Package activitystreams provides all the basic ActivityStreams implementation needed for Write.as.

Index

Constants

View Source
const (
	Namespace = "https://www.w3.org/ns/activitystreams"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Activity

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"`
}

Activity describes actions that have either already occurred, are in the process of occurring, or may occur in the future.

func NewCreateActivity

func NewCreateActivity(o *Object) *Activity

NewCreateActivity builds a basic Create activity that includes the given Object and the Object's AttributedTo property as the Actor.

func NewDeleteActivity

func NewDeleteActivity(o *Object) *Activity

NewDeleteActivity builds a basic Delete activity that includes the given Object and the Object's AttributedTo property as the Actor.

func NewUpdateActivity

func NewUpdateActivity(o *Object) *Activity

NewUpdateActivity builds a basic Update activity that includes the given Object and the Object's AttributedTo property as the Actor.

type BaseObject

type BaseObject struct {
	Context []interface{} `json:"@context,omitempty"`
	Type    string        `json:"type"`
	ID      string        `json:"id"`
}

type Endpoints

type Endpoints struct {
	SharedInbox string `json:"sharedInbox,omitempty"`
}

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 Image

type Image struct {
	Type      string `json:"type"`
	MediaType string `json:"mediaType"`
	URL       string `json:"url"`
}

type Object

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"`
	Tag          []Tag             `json:"tag"`
}

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.

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"`
}

func NewPerson

func NewPerson(accountRoot string) *Person

func (*Person) AddPubKey

func (p *Person) AddPubKey(k []byte)

func (*Person) GetPrivKey

func (p *Person) GetPrivKey() []byte

func (*Person) SetPrivKey

func (p *Person) SetPrivKey(k []byte)

type PublicKey

type PublicKey struct {
	ID           string `json:"id"`
	Owner        string `json:"owner"`
	PublicKeyPEM string `json:"publicKeyPem"`
	// contains filtered or unexported fields
}

type Tag

type Tag struct {
	Type TagType `json:"type"`
	HRef string  `json:"href"`
	Name string  `json:"name"`
}

type TagType

type TagType string
const (
	TagHashtag TagType = "Hashtag"
	TagMention         = "Mention"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL