activitypub

package
v0.0.0-...-3750746 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: BSD-3-Clause Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectionsShow

func CollectionsShow(env *Env, w http.ResponseWriter, r *http.Request) error

func Follow

func Follow(ctx context.Context, follower *models.Account, target *models.Actor) error

Follow sends a follow request from the Account to the Target Actor's inbox.

func Followers

func Followers(env *Env, w http.ResponseWriter, r *http.Request) error

func Following

func Following(env *Env, w http.ResponseWriter, r *http.Request) error

func Like

func Like(ctx context.Context, liker *models.Account, target *models.Status) error

Like sends a like request from the Account to the Statuses Actor's inbox.

func Outbox

func Outbox(env *Env, w http.ResponseWriter, r *http.Request) error

func Unfollow

func Unfollow(ctx context.Context, follower *models.Account, target *models.Actor) error

Unfollow sends an unfollow request from the Account to the Target Actor's inbox.

func Unlike

func Unlike(ctx context.Context, liker *models.Account, target *models.Status) error

Unlike sends an undo like request from the Account to the Statuses Actor's inbox.

func UsersShow

func UsersShow(env *Env, w http.ResponseWriter, r *http.Request) error

Types

type Activity

type Activity struct {
	// Type is the type of the Activity.
	Type string `json:"type"`
	// The Activity's unique global identifier.
	ID string `json:"id"`
	// Object is the Object that the Activity is acting upon.
	Object any `json:"object"`
	// Actor is the Actor that performed the Activity.
	Actor any `json:"actor"`
	// Target is the Object that the Activity is directed at.
	Target string `json:"target"`

	Published time.Time `json:"published"`
	Updated   time.Time `json:"updated"`
}

Activity is an ActivityStreams Activity. https://www.w3.org/TR/activitystreams-core/#activities

type Attachment

type Attachment struct {
	Type  string `json:"type"`
	Name  string `json:"name"`
	Value string `json:"value"`
}

type Collection

type Collection struct {
	Type       string `json:"type"`
	TotalItems int    `json:"totalItems"`
}

type Env

type Env struct {
	*gorm.DB
	*streaming.Mux
	Logger   *slog.Logger
	Client   *activitypub.Client
	Instance *models.Instance
}

func (*Env) Log

func (e *Env) Log() *slog.Logger

type HashTag

type HashTag struct {
	Type string `json:"type"`
	Href string `json:"href"`
	Name string `json:"name"`
}

HashTag is an ActivityStreams Hashtag

type Image

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

Image is an ActivityStreams Image

type InboxController

type InboxController struct {
}

func NewInbox

func NewInbox(db *gorm.DB) *InboxController

func (*InboxController) Create

func (i *InboxController) Create(env *Env, w http.ResponseWriter, r *http.Request) error

type Item

type Item struct {
	ID        string   `json:"id"`
	Type      string   `json:"type"`
	Actor     string   `json:"actor"`
	Published string   `json:"published"`
	To        []string `json:"to"`
	CC        []string `json:"cc"`
	Object    any      `json:"object"`
}

type Object

type Object struct {
	// Type is the type of the Object.
	Type string `json:"type"`
}

Object is an ActivityPub Object. https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object

type Option

type Option struct {
	Type    string     `json:"type"`
	Name    string     `json:"name"`
	Replies Collection `json:"replies"`
}

type Status

type Status struct {
	// Type is the type of the Status.
	Type string `json:"type"`
	// The Status's unique global identifier.
	ID string `json:"id"`

	AttributedTo string    `json:"attributedTo"`
	InReplyTo    string    `json:"inReplyTo"`
	Published    time.Time `json:"published"`
	Updated      time.Time `json:"updated"`

	To StringOrArray `json:"to"`
	CC StringOrArray `json:"cc"`

	Sensitive   bool          `json:"sensitive"`
	Summary     string        `json:"summary"`
	Content     string        `json:"content"`
	Attachments []interface{} `json:"attachment"`
	Tags        []HashTag     `json:"tag"`

	StartTime time.Time `json:"startTime"`
	EndTime   time.Time `json:"endTime"`
	OneOf     []Option  `json:"oneOf"`
}

type StringOrArray

type StringOrArray []string

func (*StringOrArray) UnmarshalJSON

func (s *StringOrArray) UnmarshalJSON(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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