activitystreams

package
v0.0.0-...-5d153c6 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

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

Variables

View Source
var Extensions = map[string]string{}

Allows us to drop more elements into @context on Create/Update

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 an event in the ActivityStream

func NewCreateActivity

func NewCreateActivity(o *Object) *Activity

func NewDeleteActivity

func NewDeleteActivity(o *Object) *Activity

func NewUpdateActivity

func NewUpdateActivity(o *Object) *Activity

type Attachment

type Attachment struct {
	Type      AttachmentType `json:"type"`
	URL       string         `json:"url"`
	MediaType string         `json:"mediaType"`
	Name      string         `json:"name"`
}

func NewDocumentAttachment

func NewDocumentAttachment(url string) Attachment

func NewImageAttachment

func NewImageAttachment(url string) Attachment

type AttachmentType

type AttachmentType string
const (
	TypeImage    AttachmentType = "Image"
	TypeDocument 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

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

func NewNoteObject

func NewNoteObject() *Object

func NewPersonObject

func NewPersonObject() *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 string)

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