activitypub

package
v0.0.0-...-cdf258e Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

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

	TypeCreate            = "Create"
	TypeFollow            = "Follow"
	TypeAccept            = "Accept"
	TypeNote              = "Note"
	TypeLike              = "Like"
	TypeOrderedCollection = "OrderedCollection"

	Public = ActivityStreams + "#Public"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Activity

type Activity struct {
	Context   interface{} `json:"@context"`
	ID        string      `json:"id,omitempty"`
	Type      string      `json:"type,omitempty"`
	Actor     string      `json:"actor,omitempty"`
	Object    interface{} `json:"object,omitempty"`
	From      string      `json:"from,omitempty"`
	To        interface{} `json:"to,omitempty"`
	InReplyTo string      `json:"inReplyTo,omitempty"`
	Content   string      `json:"content,omitempty"`
	Published time.Time   `json:"published,omitempty"`
}

type Actor

type Actor struct {
	Context           []interface{} `json:"@context"`
	Followers         string        `json:"followers"`
	Following         string        `json:"following"`
	Id                string        `json:"id"`
	Type              string        `json:"type"`
	PreferredUsername string        `json:"preferredUsername"`
	Inbox             string        `json:"inbox"`
	Outbox            string        `json:"outbox"`
	Playlists         string        `json:"playlists"`
	Name              string        `json:"name"`
	PublicKey         PublicKey     `json:"publicKey"`
	Url               string        `json:"url"`
	Summary           string        `json:"summary"`
	Published         time.Time     `json:"published"`
	Icon              Media         `json:"icon,omitempty"`
	Image             Media         `json:"image,omitempty"`
}

func UnmarshalActor

func UnmarshalActor(data []byte) (Actor, error)

func (*Actor) Marshal

func (actor *Actor) Marshal() ([]byte, error)

type Create

type Create struct {
	Context string      `json:"@context"`
	Type    string      `json:"type"`
	Id      string      `json:"id"`
	To      []string    `json:"to"`
	Actor   string      `json:"actor"`
	Object  interface{} `json:"object"`
}

type Follow

type Follow struct {
	Context          string `json:"@context" validate:"activitystream"`
	UniqueIdentifier string `json:"-"`
	Id               string `json:"id"`
	Type             string `json:"type"`
	Actor            string `json:"actor"`
	Object           string `json:"object"`
}

func NewFollow

func NewFollow(follower, followee string) *Follow

func UnmarshalFollow

func UnmarshalFollow(data []byte) (Follow, error)

func (*Follow) Marshal

func (follow *Follow) Marshal() ([]byte, error)

type Followers

type Followers struct {
	Context      string      `json:"@context"`
	ID           string      `json:"id,omitempty"`
	Type         string      `json:"type,omitempty"`
	TotalItems   int         `json:"totalItems"`
	OrderedItems interface{} `json:"orderedItems,omitempty"`
}

func UnmarshalFollowers

func UnmarshalFollowers(data []byte) (Followers, error)

func (*Followers) Marshal

func (followers *Followers) Marshal() ([]byte, error)

type Inbox

type Inbox struct {
	Context      string      `json:"@context"`
	ID           string      `json:"id,omitempty"`
	Type         string      `json:"type,omitempty"`
	TotalItems   int         `json:"totalItems"`
	OrderedItems interface{} `json:"orderedItems,omitempty"`
}

func UnmarshalInbox

func UnmarshalInbox(data []byte) (Inbox, error)

func (*Inbox) Marshal

func (inbox *Inbox) Marshal() ([]byte, error)
type Link struct {
	Href     *string `json:"href,omitempty"`
	Rel      string  `json:"rel"`
	Type     *string `json:"type,omitempty"`
	Template *string `json:"template,omitempty"`
}

type Media

type Media struct {
	Height    int64  `json:"height,omitempty"`
	MediaType string `json:"mediaType,omitempty"`
	Type      string `json:"type,omitempty"`
	URL       string `json:"url,omitempty"`
	Width     int64  `json:"width,omitempty"`
}

type Note

type Note struct {
	Context      string   `json:"@context" validate:"activitystream"`
	Id           string   `json:"id,omitempty"`
	Type         string   `json:"type"`
	To           []string `json:"to"`
	AttributedTo string   `json:"attributedTo"`
	InReplyTo    string   `json:"inReplyTo,omitempty"`
	Content      string   `json:"content"`
}

func NewNote

func NewNote(from, to, content string) *Note

func NewPublicNote

func NewPublicNote(from, content string) *Note

func UnmarshalNote

func UnmarshalNote(data []byte) (Note, error)

func (*Note) Marshal

func (note *Note) Marshal() ([]byte, error)

func (*Note) Wrap

func (note *Note) Wrap(username, publicUrl, uniqueIdentifier string) *Activity

type Object

type Object struct {
	Context interface{} `json:"@context"`
	Type    string      `json:"type"`
}

func UnmarshalObject

func UnmarshalObject(data []byte) (Object, error)

func (*Object) Marshal

func (object *Object) Marshal() ([]byte, error)

type OrderedCollection

type OrderedCollection struct {
	Context      string      `json:"@context"`
	ID           string      `json:"id,omitempty"`
	Type         string      `json:"type,omitempty"`
	TotalItems   int         `json:"totalItems"`
	OrderedItems interface{} `json:"orderedItems,omitempty"`
	First        string      `json:"first,omitempty"`
}

func NewOrderedCollection

func NewOrderedCollection(id string, items interface{}, length int) *OrderedCollection

func UnmarshalOrderedCollection

func UnmarshalOrderedCollection(data []byte) (OrderedCollection, error)

func (*OrderedCollection) Marshal

func (orderedCollection *OrderedCollection) Marshal() ([]byte, error)

type Outbox

type Outbox struct {
	Context      string      `json:"@context"`
	ID           string      `json:"id,omitempty"`
	Type         string      `json:"type,omitempty"`
	TotalItems   int         `json:"totalItems"`
	OrderedItems interface{} `json:"orderedItems,omitempty"`
}

func UnmarshalOutbox

func UnmarshalOutbox(data []byte) (Outbox, error)

func (*Outbox) Marshal

func (outbox *Outbox) Marshal() ([]byte, error)

type PublicKey

type PublicKey struct {
	ID           string `json:"id"`
	Owner        string `json:"owner"`
	PublicKeyPem string `json:"publicKeyPem"`
}

type Webfinger

type Webfinger struct {
	Aliases []string `json:"aliases"`
	Links   []Link   `json:"links"`
	Subject string   `json:"subject"`
}

func UnmarshalWebfinger

func UnmarshalWebfinger(data []byte) (Webfinger, error)

func (*Webfinger) Marshal

func (webfinger *Webfinger) Marshal() ([]byte, error)

func (*Webfinger) Self

func (webfinger *Webfinger) Self() string

Jump to

Keyboard shortcuts

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