activitypub

package
v0.0.0-...-a0d1ad3 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FollowType          = "Follow"
	AcceptType          = "Accept"
	RejectType          = "Reject"
	UndoType            = "Undo"
	AddType             = "Add"
	AnnounceType        = "Announce"
	ArriveType          = "Arrive"
	BlockType           = "Block"
	CreateType          = "Create"
	DeleteType          = "Delete"
	DislikeType         = "Dislike"
	FlagType            = "Flag"
	IgnoreType          = "Ignore"
	InviteType          = "Invite"
	JoinType            = "Join"
	LeaveType           = "Leave"
	LikeType            = "Like"
	ListenType          = "Listen"
	MoveType            = "Move"
	OfferType           = "Offer"
	QuestionType        = "Question"
	ReadType            = "Read"
	RemoveType          = "Remove"
	TentativeRejectType = "TentativeReject"
	TentativeAcceptType = "TentativeAccept"
	TravelType          = "Travel"
	UpdateType          = "Update"
	ViewType            = "View"
	NoteType            = "Note"
)
View Source
const (
	ApplicationType  = "Application"
	GroupType        = "Group"
	OrganizationType = "Organization"
	PersonType       = "Person"
	ServiceType      = "Service"
	ChannelType      = "Channel"
)

Actor https://www.w3.org/TR/activitystreams-vocabulary/#actor-types.

Variables

This section is empty.

Functions

func GetActorByWebfinger

func GetActorByWebfinger(wf *WebFinger) (*resty.Response, error)

GetActorByWebfinger Get remote Actor via WebFinger.

func GetActorName

func GetActorName(resource string) string

GetActorName Get the username in the request url such, as "/.well-known/webFinger?resource=acct:hvturingga@halfmemories.com" Will get hvturingga, If the match fails, it will return a custom username not found error.

func NewActorContext

func NewActorContext() []interface{}

func NewContext

func NewContext() []interface{}

func NewWebFingerAddress

func NewWebFingerAddress(host, resource string) string

NewWebFingerAddress FOR EXAMPLE: https://mas.to/.well-known/webfinger?resource=acct:hvturingga@halfmemories.com

Types

type Accept

type Accept struct {
	Context string `json:"@context"`
	Id      string `json:"id"`
	Type    string `json:"type"`
	Actor   string `json:"actor"`
	Object  struct {
		Id     string `json:"id"`
		Type   string `json:"type"`
		Actor  string `json:"actor"`
		Object string `json:"object"`
	} `json:"object"`
}

Accept 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. https://www.w3.org/TR/activitystreams-vocabulary/#dfn-accept

type Actor

type Actor struct {
	Context                   []interface{} `json:"@context"`
	Id                        string        `json:"id"`
	Type                      string        `json:"type"`
	Following                 string        `json:"following"`
	Followers                 string        `json:"followers"`
	Inbox                     string        `json:"inbox"`
	Outbox                    string        `json:"outbox"`
	Featured                  string        `json:"featured"`
	FeaturedTags              string        `json:"featuredTags"`
	PreferredUsername         string        `json:"preferredUsername"`
	Name                      string        `json:"name"`
	Summary                   string        `json:"summary"`
	Url                       string        `json:"url"`
	ManuallyApprovesFollowers bool          `json:"manuallyApprovesFollowers"`
	Discoverable              bool          `json:"discoverable"`
	Published                 time.Time     `json:"published"`
	Devices                   string        `json:"devices"`
	PublicKey                 struct {
		Id           string `json:"id"`
		Owner        string `json:"owner"`
		PublicKeyPem string `json:"publicKeyPem"`
	} `json:"publicKey"`
	Tag        []interface{} `json:"tag"`
	Attachment []interface{} `json:"attachment"`
	Endpoints  struct {
		SharedInbox string `json:"sharedInbox"`
	} `json:"endpoints"`
	Icon struct {
		Type      string `json:"type"`
		MediaType string `json:"mediaType"`
		Url       string `json:"url"`
	} `json:"icon"`
}

func NewActor

func NewActor(preferredUsername, name, summary, publicKey, avatar string) *Actor

NewActor Return standard ActivityPub protocol user data.

type Create

type Create struct {
	Context   []interface{} `json:"@context"`
	Id        string        `json:"id"`
	Type      string        `json:"type"`
	Actor     string        `json:"actor"`
	Published time.Time     `json:"published"`
	To        []string      `json:"to"`
	Cc        []string      `json:"cc"`
	Object    struct {
		Id               string      `json:"id"`
		Type             string      `json:"type"`
		Title            string      `json:"title"`
		Summary          interface{} `json:"summary"`
		InReplyTo        interface{} `json:"inReplyTo"`
		Published        time.Time   `json:"published"`
		Url              string      `json:"url"`
		AttributedTo     string      `json:"attributedTo"`
		To               []string    `json:"to"`
		Cc               []string    `json:"cc"`
		Sensitive        bool        `json:"sensitive"`
		AtomUri          string      `json:"atomUri"`
		InReplyToAtomUri interface{} `json:"inReplyToAtomUri"`
		Conversation     string      `json:"conversation"`
		Content          string      `json:"content"`
		ContentMap       struct {
			En string `json:"en"`
		} `json:"contentMap"`
		Attachment []interface{} `json:"attachment"`
		Tag        []interface{} `json:"tag"`
		Replies    struct {
			Id    string `json:"id"`
			Type  string `json:"type"`
			First struct {
				Type   string        `json:"type"`
				Next   string        `json:"next"`
				PartOf string        `json:"partOf"`
				Items  []interface{} `json:"items"`
			} `json:"first"`
		} `json:"replies"`
	} `json:"object"`
	Signature struct {
		Type           string    `json:"type"`
		Creator        string    `json:"creator"`
		Created        time.Time `json:"created"`
		SignatureValue string    `json:"signatureValue"`
	} `json:"signature"`
}

Create Indicates that the actor has created the object. https://www.w3.org/TR/activitystreams-vocabulary/#dfn-create

type Delete

type Delete struct {
	Context []interface{} `json:"@context"`
	Id      string        `json:"id"`
	Type    string        `json:"type"`
	Actor   string        `json:"actor"`
	To      []string      `json:"to"`
	Object  struct {
		Id      string `json:"id"`
		Type    string `json:"type"`
		AtomUri string `json:"atomUri"`
	} `json:"object"`
	Signature struct {
		Type           string    `json:"type"`
		Creator        string    `json:"creator"`
		Created        time.Time `json:"created"`
		SignatureValue string    `json:"signatureValue"`
	} `json:"signature"`
}

type Follow

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

Follow Indicates that the actor is "following" the object. Following is defined in the sense typically used within Social systems in which the actor is interested in any activity performed by or on the object. The target and origin typically have no defined meaning. https://www.w3.org/TR/activitystreams-vocabulary/#dfn-follow

type Reject

type Reject struct {
	Context string `json:"@context"`
	Id      string `json:"id"`
	Type    string `json:"type"`
	Actor   string `json:"actor"`
	Object  struct {
		Id     string `json:"id"`
		Type   string `json:"type"`
		Actor  string `json:"actor"`
		Object string `json:"object"`
	} `json:"object"`
}

Reject Indicates that the actor is rejecting the object. The target and origin typically have no defined meaning. https://www.w3.org/TR/activitystreams-vocabulary/#dfn-reject

type Undo

type Undo struct {
	Context string `json:"@context"`
	Id      string `json:"id"`
	Type    string `json:"type"`
	Actor   string `json:"actor"`
	Object  struct {
		Id     string `json:"id"`
		Type   string `json:"type"`
		Actor  string `json:"actor"`
		Object string `json:"object"`
	} `json:"object"`
}

Undo Indicates that the actor is undoing the object. In most cases, the object will be an Activity describing some previously performed action (for instance, a person may have previously "liked" an article but, for whatever reason, might choose to undo that like at some later point in time). The target and origin typically have no defined meaning. https://www.w3.org/TR/activitystreams-vocabulary/#dfn-undo

type WebFinger

type WebFinger struct {
	Subject string   `json:"subject"`
	Aliases []string `json:"aliases"`
	Links   []struct {
		Rel      string `json:"rel"`
		Type     string `json:"type,omitempty"`
		Href     string `json:"href,omitempty"`
		Template string `json:"template,omitempty"`
	} `json:"links"`
}

func GetWebFingerHandler

func GetWebFingerHandler(address string) (*WebFinger, error)

GetWebFingerHandler Obtain the WebFinger of the remote instance through the email address format.

func NewWebFinger

func NewWebFinger(name string, isChan bool) *WebFinger

NewWebFinger Receive the username and combine the object into the standard json data returned by webFinger. In order to return to the query that the instance owns this actor.

Jump to

Keyboard shortcuts

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