activitystreams

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: MPL-2.0 Imports: 4 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

View Source
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"`
	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 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 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,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"`

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

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 TagType = "Mention"
)

Jump to

Keyboard shortcuts

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