Documentation
¶
Index ¶
- Constants
- func NewId(uris_table *uris.URIs) string
- type Activity
- func NewAcceptActivity(ctx context.Context, uris_table *uris.URIs, from string, object interface{}) (*Activity, error)
- func NewAnnounceActivity(ctx context.Context, uris_table *uris.URIs, from string, author_uri string, ...) (*Activity, error)
- func NewBoostActivity(ctx context.Context, uris_table *uris.URIs, from string, author_uri string, ...) (*Activity, error)
- func NewCreateActivity(ctx context.Context, uris_table *uris.URIs, from string, to []string, ...) (*Activity, error)
- func NewFollowActivity(ctx context.Context, uris_table *uris.URIs, from string, to string) (*Activity, error)
- func NewUndoFollowActivity(ctx context.Context, uris_table *uris.URIs, from string, to string) (*Activity, error)
- type Actor
- type Attachment
- type Followers
- type Following
- type Icon
- type Note
- type OrderedCollection
- type PublicKey
- type Tag
Constants ¶
const ACCEPT_ACTIVITY string = "Accept"
const ACTIVITYSTREAMS_ACCEPT_HEADER string = `application/ld+json; profile="https://www.w3.org/ns/activitystreams"`
Deprecated, please use ACTIVITYSTREAMS_ACCEPT_HEADER
const ACTIVITYSTREAMS_CONTEXT string = "https://www.w3.org/ns/activitystreams"
const ACTIVITY_CONTENT_TYPE string = "application/activity+json"
const ACTIVITY_LD_CONTENT_TYPE string = `application/ld+json; profile="https://www.w3.org/ns/activitystreams"`
const CREATE_ACTIVITY string = "Create"
const FOLLOW_ACTIVITY string = "Follow"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Activity ¶
type Activity struct {
// Context needs to be a "whatever" (interface{}) because ActivityPub (JSON-LD)
// mixes and matches string URIs, arbritrary data structures and arrays of string
// URIs and arbritrary data structures in @context...
Context interface{} `json:"@context,omitempty"`
// Id is the unique identifier for the activity.
Id string `json:"id"`
// Type is the name of the activity being performed.
Type string `json:"type"`
// Actor is the URI of the person (actor) performing the activity.
Actor string `json:"actor"`
// To is the list of URIs the activity should be delivered to.
To []string `json:"to,omitempty"`
// CC is the list of URIs the activity should be copied to.
Cc []string `json:"cc,omitempty"`
// Object is body of the activity itself.
Object interface{} `json:"object,omitempty"`
Published string `json:"published,omitempty"`
}
Activity is a struct encapsulating an ActivityPub activity.
func NewAcceptActivity ¶
func NewAcceptActivity(ctx context.Context, uris_table *uris.URIs, from string, object interface{}) (*Activity, error)
NewAcceptActvity returns a new `Activity` instance of type "Accept". The Accept activity "indicates that the actor accepts the object. The target property can be used in certain circumstances to indicate the context into which the object has been accepted."
func NewAnnounceActivity ¶
func NewAnnounceActivity(ctx context.Context, uris_table *uris.URIs, from string, author_uri string, object interface{}) (*Activity, error)
NewAnnounceActivity will return an ActivityPub "Announce" activity from 'from' about 'object' (created by 'author_uri').
func NewBoostActivity ¶
func NewBoostActivity(ctx context.Context, uris_table *uris.URIs, from string, author_uri string, object interface{}) (*Activity, error)
NewBoostActivity will return an ActivityPub "Announce" activity from 'from' about 'object' (created by 'author_uri').
func NewCreateActivity ¶
func NewCreateActivity(ctx context.Context, uris_table *uris.URIs, from string, to []string, object interface{}) (*Activity, error)
NewCreateActivity returns a new `Activity` instance of type "Create".
type Actor ¶
type Actor struct {
// It has to be an interface because JSON-LD... thanks, JSON-LD...
Context []interface{} `json:"@context"`
Id string `json:"id"`
Type string `json:"type"`
PreferredUsername string `json:"preferredUsername"`
Inbox string `json:"inbox"`
Outbox string `json:"outbox"`
PublicKey PublicKey `json:"publicKey"`
Following string `json:"following,omitempty"`
Followers string `json:"followers,omitempty"`
Name string `json:"name,omitempty"`
Summary string `json:"summary,omitempty"`
URL string `json:"url,omitempty"`
// Don't omitempty because if you do then false values are omitted
// ManuallyApprovesFollowers bool `json:"manuallyApprovesFollowers"`
Discoverable bool `json:"discoverable,omitempty"`
Published string `json:"published,omitempty"`
Icon Icon `json:"icon,omitempty"`
Attachments []*Attachment `json:"attachment,omitempty"` // Is this just a Mastodon-ism?
}
type Attachment ¶
type Note ¶
type Note struct {
Type string `json:"type"`
Id string `json:"id"`
AttributedTo string `json:"attributedTo"`
InReplyTo string `json:"inReplyTo,omitempty"`
Tags []*Tag `json:"tag,omitempty"`
To []string `json:"to"`
Cc []string `json:"cc"`
Content string `json:"content"`
URL string `json:"url"`
Published string `json:"published"`
}
type OrderedCollection ¶
type OrderedCollection struct {
// It has to be an interface because JSON-LD... thanks, JSON-LD...
Context []interface{} `json:"@context"`
Id string `json:"id"`
Summary string `json:"summary,omitempty"`
Type string `json:"type"`
TotalItems int `json:"totalItems"`
OrderedItem []*interface{} `json:"orderedItems,omitempty"`
}