ap

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActivityAccept          = "Accept"          // ActivityStreamsAccept https://www.w3.org/TR/activitystreams-vocabulary/#dfn-accept
	ActivityAdd             = "Add"             // ActivityStreamsAdd https://www.w3.org/TR/activitystreams-vocabulary/#dfn-add
	ActivityAnnounce        = "Announce"        // ActivityStreamsAnnounce https://www.w3.org/TR/activitystreams-vocabulary/#dfn-announce
	ActivityArrive          = "Arrive"          // ActivityStreamsArrive https://www.w3.org/TR/activitystreams-vocabulary/#dfn-arrive
	ActivityBlock           = "Block"           // ActivityStreamsBlock https://www.w3.org/TR/activitystreams-vocabulary/#dfn-block
	ActivityCreate          = "Create"          // ActivityStreamsCreate https://www.w3.org/TR/activitystreams-vocabulary/#dfn-create
	ActivityDelete          = "Delete"          // ActivityStreamsDelete https://www.w3.org/TR/activitystreams-vocabulary/#dfn-delete
	ActivityDislike         = "Dislike"         // ActivityStreamsDislike https://www.w3.org/TR/activitystreams-vocabulary/#dfn-dislike
	ActivityFlag            = "Flag"            // ActivityStreamsFlag https://www.w3.org/TR/activitystreams-vocabulary/#dfn-flag
	ActivityFollow          = "Follow"          // ActivityStreamsFollow https://www.w3.org/TR/activitystreams-vocabulary/#dfn-follow
	ActivityIgnore          = "Ignore"          // ActivityStreamsIgnore https://www.w3.org/TR/activitystreams-vocabulary/#dfn-ignore
	ActivityInvite          = "Invite"          // ActivityStreamsInvite https://www.w3.org/TR/activitystreams-vocabulary/#dfn-invite
	ActivityJoin            = "Join"            // ActivityStreamsJoin https://www.w3.org/TR/activitystreams-vocabulary/#dfn-join
	ActivityLeave           = "Leave"           // ActivityStreamsLeave https://www.w3.org/TR/activitystreams-vocabulary/#dfn-leave
	ActivityLike            = "Like"            // ActivityStreamsLike https://www.w3.org/TR/activitystreams-vocabulary/#dfn-like
	ActivityListen          = "Listen"          // ActivityStreamsListen https://www.w3.org/TR/activitystreams-vocabulary/#dfn-listen
	ActivityMove            = "Move"            // ActivityStreamsMove https://www.w3.org/TR/activitystreams-vocabulary/#dfn-move
	ActivityOffer           = "Offer"           // ActivityStreamsOffer https://www.w3.org/TR/activitystreams-vocabulary/#dfn-offer
	ActivityQuestion        = "Question"        // ActivityStreamsQuestion https://www.w3.org/TR/activitystreams-vocabulary/#dfn-question
	ActivityReject          = "Reject"          // ActivityStreamsReject https://www.w3.org/TR/activitystreams-vocabulary/#dfn-reject
	ActivityRead            = "Read"            // ActivityStreamsRead https://www.w3.org/TR/activitystreams-vocabulary/#dfn-read
	ActivityRemove          = "Remove"          // ActivityStreamsRemove https://www.w3.org/TR/activitystreams-vocabulary/#dfn-remove
	ActivityTentativeReject = "TentativeReject" // ActivityStreamsTentativeReject https://www.w3.org/TR/activitystreams-vocabulary/#dfn-tentativereject
	ActivityTentativeAccept = "TentativeAccept" // ActivityStreamsTentativeAccept https://www.w3.org/TR/activitystreams-vocabulary/#dfn-tentativeaccept
	ActivityTravel          = "Travel"          // ActivityStreamsTravel https://www.w3.org/TR/activitystreams-vocabulary/#dfn-travel
	ActivityUndo            = "Undo"            // ActivityStreamsUndo https://www.w3.org/TR/activitystreams-vocabulary/#dfn-undo
	ActivityUpdate          = "Update"          // ActivityStreamsUpdate https://www.w3.org/TR/activitystreams-vocabulary/#dfn-update
	ActivityView            = "View"            // ActivityStreamsView https://www.w3.org/TR/activitystreams-vocabulary/#dfn-view

	ActorApplication  = "Application"  // ActivityStreamsApplication https://www.w3.org/TR/activitystreams-vocabulary/#dfn-application
	ActorGroup        = "Group"        // ActivityStreamsGroup https://www.w3.org/TR/activitystreams-vocabulary/#dfn-group
	ActorOrganization = "Organization" // ActivityStreamsOrganization https://www.w3.org/TR/activitystreams-vocabulary/#dfn-organization
	ActorPerson       = "Person"       // ActivityStreamsPerson https://www.w3.org/TR/activitystreams-vocabulary/#dfn-person
	ActorService      = "Service"      // ActivityStreamsService https://www.w3.org/TR/activitystreams-vocabulary/#dfn-service

	ObjectArticle               = "Article"               // ActivityStreamsArticle https://www.w3.org/TR/activitystreams-vocabulary/#dfn-article
	ObjectAudio                 = "Audio"                 // ActivityStreamsAudio https://www.w3.org/TR/activitystreams-vocabulary/#dfn-audio
	ObjectDocument              = "Document"              // ActivityStreamsDocument https://www.w3.org/TR/activitystreams-vocabulary/#dfn-document
	ObjectEvent                 = "Event"                 // ActivityStreamsEvent https://www.w3.org/TR/activitystreams-vocabulary/#dfn-event
	ObjectImage                 = "Image"                 // ActivityStreamsImage https://www.w3.org/TR/activitystreams-vocabulary/#dfn-image
	ObjectNote                  = "Note"                  // ActivityStreamsNote https://www.w3.org/TR/activitystreams-vocabulary/#dfn-note
	ObjectPage                  = "Page"                  // ActivityStreamsPage https://www.w3.org/TR/activitystreams-vocabulary/#dfn-page
	ObjectPlace                 = "Place"                 // ActivityStreamsPlace https://www.w3.org/TR/activitystreams-vocabulary/#dfn-place
	ObjectProfile               = "Profile"               // ActivityStreamsProfile https://www.w3.org/TR/activitystreams-vocabulary/#dfn-profile
	ObjectRelationship          = "Relationship"          // ActivityStreamsRelationship https://www.w3.org/TR/activitystreams-vocabulary/#dfn-relationship
	ObjectTombstone             = "Tombstone"             // ActivityStreamsTombstone https://www.w3.org/TR/activitystreams-vocabulary/#dfn-tombstone
	ObjectVideo                 = "Video"                 // ActivityStreamsVideo https://www.w3.org/TR/activitystreams-vocabulary/#dfn-video
	ObjectCollection            = "Collection"            // ActivityStreamsCollection https://www.w3.org/TR/activitystreams-vocabulary/#dfn-collection
	ObjectCollectionPage        = "CollectionPage"        // ActivityStreamsCollectionPage https://www.w3.org/TR/activitystreams-vocabulary/#dfn-collectionpage
	ObjectOrderedCollection     = "OrderedCollection"     // ActivityStreamsOrderedCollection https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollection
	ObjectOrderedCollectionPage = "OrderedCollectionPage" // ActivityStreamsOrderedCollectionPage https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollectionPage

	// Hashtag is not in the AS spec per se, but it tends to get used
	// as though 'Hashtag' is a named type under the Tag property.
	//
	// See https://www.w3.org/TR/activitystreams-vocabulary/#microsyntaxes
	// and https://www.w3.org/TR/activitystreams-vocabulary/#dfn-tag
	TagHashtag = "Hashtag"
)

https://www.w3.org/TR/activitystreams-vocabulary

Variables

This section is empty.

Functions

func ExtractActorURI added in v0.10.0

func ExtractActorURI(withActor WithActor) (*url.URL, error)

ExtractActorURI extracts the first Actor URI it can find from a WithActor interface.

func ExtractAttachment

func ExtractAttachment(i Attachmentable) (*gtsmodel.MediaAttachment, error)

ExtractAttachment extracts a minimal gtsmodel.Attachment (just remote URL, description, and blurhash) from the given Attachmentable interface, or an error if no remote URL is set.

func ExtractAttachments

func ExtractAttachments(i WithAttachment) ([]*gtsmodel.MediaAttachment, error)

ExtractAttachments attempts to extract barebones MediaAttachment objects from given AS interface type.

func ExtractAttributedToURI added in v0.10.0

func ExtractAttributedToURI(i WithAttributedTo) (*url.URL, error)

ExtractAttributedToURI returns the first URI it can find in the given WithAttributedTo, or an error if no URI can be found.

func ExtractBlurhash added in v0.2.0

func ExtractBlurhash(i WithBlurhash) string

ExtractBlurhash extracts the blurhash string value from the given WithBlurhash interface, or returns an empty string if nothing is found.

func ExtractCcURIs added in v0.10.0

func ExtractCcURIs(i WithCC) []*url.URL

ExtractCcURIs returns a slice of URIs that the given WithCC addresses as Cc.

func ExtractContent

func ExtractContent(i WithContent) string

ExtractContent returns a string representation of the given interface's Content property, or an empty string if no Content is found.

func ExtractDiscoverable

func ExtractDiscoverable(i WithDiscoverable) (bool, error)

ExtractDiscoverable extracts the Discoverable boolean of the given WithDiscoverable interface. Will return an error if Discoverable was nil.

func ExtractEmoji

func ExtractEmoji(i Emojiable) (*gtsmodel.Emoji, error)

ExtractEmoji extracts a minimal gtsmodel.Emoji from the given Emojiable.

func ExtractEmojis

func ExtractEmojis(i WithTag) ([]*gtsmodel.Emoji, error)

ExtractEmojis extracts a slice of minimal gtsmodel.Emojis from a WithTag. If an entry in the WithTag is not an emoji, it will be quietly ignored.

func ExtractFields added in v0.9.0

func ExtractFields(i WithAttachment) []*gtsmodel.Field

ExtractFields extracts property/value fields from the given WithAttachment interface. Will return an empty slice if no property/value fields can be found. Attachments that are not (well-formed) PropertyValues will be ignored.

func ExtractHashtags

func ExtractHashtags(i WithTag) ([]*gtsmodel.Tag, error)

ExtractHashtags extracts a slice of minimal gtsmodel.Tags from a WithTag. If an entry in the WithTag is not a hashtag, or has a name that cannot be normalized, it will be ignored.

TODO: find a better heuristic for determining if something is a hashtag or not, since looking for type name "Hashtag" is non-normative. Perhaps look for things that are either type "Hashtag" or have no type name set at all?

func ExtractIconURI added in v0.10.0

func ExtractIconURI(i WithIcon) (*url.URL, error)

ExtractIconURI extracts the first URI it can find from the given WithIcon which links to a supported image file. Input will look something like this:

"icon": {
  "mediaType": "image/jpeg",
  "type": "Image",
  "url": "http://example.org/path/to/some/file.jpeg"
},

If no valid URI can be found, this will return an error.

func ExtractImageURI added in v0.10.0

func ExtractImageURI(i WithImage) (*url.URL, error)

ExtractImageURI extracts the first URI it can find from the given WithImage which links to a supported image file. Input will look something like this:

"image": {
  "mediaType": "image/jpeg",
  "type": "Image",
  "url": "http://example.org/path/to/some/file.jpeg"
},

If no valid URI can be found, this will return an error.

func ExtractInReplyToURI

func ExtractInReplyToURI(i WithInReplyTo) *url.URL

ExtractInReplyToURI extracts the first inReplyTo URI property it can find from an interface. Will return nil if no valid URI can be found.

func ExtractItemsURIs added in v0.10.0

func ExtractItemsURIs(i WithItems) []*url.URL

ExtractItemsURIs extracts each URI it can find for an item from the provided WithItems.

func ExtractMention

func ExtractMention(i Mentionable) (*gtsmodel.Mention, error)

ExtractMention extracts a minimal gtsmodel.Mention from a Mentionable.

func ExtractMentions

func ExtractMentions(i WithTag) ([]*gtsmodel.Mention, error)

ExtractMentions extracts a slice of minimal gtsmodel.Mentions from a WithTag. If an entry in the WithTag is not a mention, it will be quietly ignored.

func ExtractName

func ExtractName(i WithName) string

ExtractName returns the first string representation it can find of an interface's name property, or an empty string if this is not found.

func ExtractObjectURI added in v0.10.0

func ExtractObjectURI(withObject WithObject) (*url.URL, error)

ExtractObjectURI extracts the first Object URI it can find from a WithObject interface.

func ExtractObjectURIs added in v0.10.0

func ExtractObjectURIs(withObject WithObject) ([]*url.URL, error)

ExtractObjectURIs extracts the URLs of each Object it can find from a WithObject interface.

func ExtractPreferredUsername

func ExtractPreferredUsername(i WithPreferredUsername) (string, error)

ExtractPreferredUsername returns a string representation of an interface's preferredUsername property. Will return an error if preferredUsername is nil, not a string, or empty.

func ExtractPublicKey added in v0.10.0

func ExtractPublicKey(i WithPublicKey) (
	*rsa.PublicKey,
	*url.URL,
	*url.URL,
	error,
)

ExtractPublicKey extracts the public key, public key ID, and public key owner ID from an interface, or an error if something goes wrong.

func ExtractPublished

func ExtractPublished(i WithPublished) (time.Time, error)

ExtractPublished extracts the published time from the given WithPublished. Will return an error if the published property is not set, is not a time.Time, or is zero.

func ExtractSensitive

func ExtractSensitive(withSensitive WithSensitive) bool

ExtractSensitive extracts whether or not an item should be marked as sensitive according to its ActivityStreams sensitive property.

If no sensitive property is set on the item at all, or if this property isn't a boolean, then false will be returned by default.

func ExtractSharedInbox added in v0.5.0

func ExtractSharedInbox(withEndpoints WithEndpoints) *url.URL

ExtractSharedInbox extracts the sharedInbox URI property from an Actor. Returns nil if this property is not set.

func ExtractSummary

func ExtractSummary(i WithSummary) string

ExtractSummary extracts the summary/content warning of the given WithSummary interface. Will return an empty string if no summary/content warning was present.

func ExtractToURIs added in v0.10.0

func ExtractToURIs(i WithTo) []*url.URL

ExtractToURIs returns a slice of URIs that the given WithTo addresses as To.

func ExtractURL

func ExtractURL(i WithURL) (*url.URL, error)

ExtractURL extracts the first URI it can find from the given WithURL interface, or an error if no URL was set. The ID of a type will not work, this function wants a URI specifically.

func ExtractVisibility

func ExtractVisibility(addressable Addressable, actorFollowersURI string) (gtsmodel.Visibility, error)

ExtractVisibility extracts the gtsmodel.Visibility of a given addressable with a To and CC property.

ActorFollowersURI is needed to check whether the visibility is FollowersOnly or not. The passed-in value should just be the string value representation of the followers URI of the actor who created the activity, eg., `https://example.org/users/whoever/followers`.

func IsAccountable added in v0.12.0

func IsAccountable(typeName string) bool

IsAccountable returns whether AS vocab type name is acceptable as Accountable.

func IsPollable added in v0.12.0

func IsPollable(typeName string) bool

IsPollable returns whether AS vocab type name is acceptable as Pollable.

func IsStatusable added in v0.12.0

func IsStatusable(typeName string) bool

IsStatusable returns whether AS vocab type name is acceptable as Statusable.

func IterateAnyOf added in v0.12.0

func IterateAnyOf(withAnyOf WithAnyOf, foreach func(vocab.ActivityStreamsAnyOfPropertyIterator))

IterateAnyOf will attempt to extract anyOf property from given interface, and passes each iterated item to function.

func IterateOneOf added in v0.12.0

func IterateOneOf(withOneOf WithOneOf, foreach func(vocab.ActivityStreamsOneOfPropertyIterator))

IterateOneOf will attempt to extract oneOf property from given interface, and passes each iterated item to function.

func NewASCollection added in v0.12.0

func NewASCollection(params CollectionParams) vocab.ActivityStreamsCollection

NewASCollection builds and returns a new ActivityStreams Collection from given parameters.

func NewASCollectionPage added in v0.12.0

func NewASCollectionPage(params CollectionPageParams) vocab.ActivityStreamsCollectionPage

NewASCollectionPage builds and returns a new ActivityStreams CollectionPage from given parameters (including item property appending function).

func NewASOrderedCollection added in v0.12.0

func NewASOrderedCollection(params CollectionParams) vocab.ActivityStreamsOrderedCollection

NewASOrderedCollection builds and returns a new ActivityStreams OrderedCollection from given parameters.

func NewASOrderedCollectionPage added in v0.12.0

func NewASOrderedCollectionPage(params CollectionPageParams) vocab.ActivityStreamsOrderedCollectionPage

NewASOrderedCollectionPage builds and returns a new ActivityStreams OrderedCollectionPage from given parameters (including item property appending function).

func NormalizeIncomingActivity added in v0.12.0

func NormalizeIncomingActivity(activity pub.Activity, rawJSON map[string]interface{})

NormalizeIncomingActivityObject normalizes the 'object'.'content' field of the given Activity.

The rawActivity map should the freshly deserialized json representation of the Activity.

This function is a noop if the type passed in is anything except a Create or Update with a Statusable or Accountable as its Object.

func NormalizeIncomingAttachments added in v0.9.0

func NormalizeIncomingAttachments(item WithAttachment, rawJSON map[string]interface{})

NormalizeIncomingAttachments normalizes all attachments (if any) of the given item, replacing the 'name' (aka content warning) field of each attachment with the raw 'name' value from the raw json object map, and doing sanitization on the result.

noop if there are no attachments; noop if attachment is not a format we can understand.

func NormalizeIncomingContent added in v0.9.0

func NormalizeIncomingContent(item WithContent, rawJSON map[string]interface{})

NormalizeIncomingContent replaces the Content of the given item with the sanitized version of the raw 'content' value from the raw json object map.

noop if there was no content in the json object map or the content was not a plain string.

func NormalizeIncomingName added in v0.9.0

func NormalizeIncomingName(item WithName, rawJSON map[string]interface{})

NormalizeIncomingName replaces the Name of the given item with the raw 'name' value from the raw json object map.

noop if there was no name in the json object map or the name was not a plain string.

func NormalizeIncomingPollOptions added in v0.12.0

func NormalizeIncomingPollOptions(item WithOneOf, rawJSON map[string]interface{})

NormalizeIncomingOneOf normalizes all oneOf (if any) of the given item, replacing the 'name' field of each oneOf with the raw 'name' value from the raw json object map, and doing sanitization on the result.

noop if there are no oneOf; noop if oneOf is not expected format.

func NormalizeIncomingSummary added in v0.9.0

func NormalizeIncomingSummary(item WithSummary, rawJSON map[string]interface{})

NormalizeIncomingSummary replaces the Summary of the given item with the sanitized version of the raw 'summary' value from the raw json object map.

noop if there was no summary in the json object map or the summary was not a plain string.

func ResolveIncomingActivity added in v0.12.0

func ResolveIncomingActivity(r *http.Request) (pub.Activity, gtserror.WithCode)

ResolveActivity is a util function for pulling a pub.Activity type out of an incoming request body.

func Serialize added in v0.9.0

func Serialize(t vocab.Type) (m map[string]interface{}, e error)

Serialize is a custom serializer for ActivityStreams types.

In most cases, it will simply call the go-fed streams.Serialize function under the hood. However, if custom serialization is required on a specific type (eg for inter-implementation compatibility), it can be inserted into the switch as necessary.

Callers should always call this function instead of streams.Serialize, unless there's a very good reason to do otherwise.

Currently, the following things will be custom serialized:

  • OrderedCollection: 'orderedItems' property will always be made into an array.
  • Any Accountable type: 'attachment' property will always be made into an array.
  • Update: any Accountable 'object's set on an update will be custom serialized as above.

Types

type Accountable

Accountable represents the minimum activitypub interface for representing an 'account'. (see: IsAccountable() for types implementing this, though you MUST make sure to check the typeName as this bare interface may be implementable by non-Accountable types).

func ResolveAccountable added in v0.8.0

func ResolveAccountable(ctx context.Context, b []byte) (Accountable, error)

ResolveStatusable tries to resolve the given bytes into an ActivityPub Accountable representation. It will then perform normalization on the Accountable.

Works for: Application, Group, Organization, Person, Service

func ToAccountable added in v0.12.0

func ToAccountable(t vocab.Type) (Accountable, bool)

ToAccountable safely tries to cast vocab.Type as Accountable, also checking for expected AS type names.

type Addressable

type Addressable interface {
	WithTo
	WithCC
}

Addressable represents the minimum interface for an addressed activity.

type Announceable

Announceable represents the minimum interface for an activitystreams 'announce' activity.

type Attachmentable

type Attachmentable interface {
	WithTypeName
	WithMediaType
	WithURL
	WithName
	WithBlurhash
}

Attachmentable represents the minimum activitypub interface for representing a 'mediaAttachment'. (see: IsAttachmentable). This interface is fulfilled by: Audio, Document, Image, Video

type Blockable

type Blockable interface {
	WithJSONLDId
	WithTypeName

	WithActor
	WithObject
}

Blockable represents the minimum interface for an activitystreams 'block' activity.

type CollectionBuilder added in v0.12.0

type CollectionBuilder interface {
	SetJSONLDId(vocab.JSONLDIdProperty)
	SetActivityStreamsFirst(vocab.ActivityStreamsFirstProperty)
	SetActivityStreamsTotalItems(i vocab.ActivityStreamsTotalItemsProperty)
}

CollectionPage is a simplified interface type that can be fulfilled by either of (where required): vocab.ActivityStreamsCollection vocab.ActivityStreamsOrderedCollection

type CollectionPageBuilder added in v0.12.0

type CollectionPageBuilder interface {
	SetJSONLDId(vocab.JSONLDIdProperty)
	SetActivityStreamsPartOf(vocab.ActivityStreamsPartOfProperty)
	SetActivityStreamsNext(vocab.ActivityStreamsNextProperty)
	SetActivityStreamsPrev(vocab.ActivityStreamsPrevProperty)
	SetActivityStreamsTotalItems(i vocab.ActivityStreamsTotalItemsProperty)
}

CollectionPageBuilder is a simplified interface type that can be fulfilled by either of (where required): vocab.ActivityStreamsCollectionPage vocab.ActivityStreamsOrderedCollectionPage

type CollectionPageIterator added in v0.12.0

type CollectionPageIterator interface {
	vocab.Type

	NextPage() WithIRI
	PrevPage() WithIRI

	NextItem() TypeOrIRI
	PrevItem() TypeOrIRI
}

CollectionPageIterator represents the minimum interface for interacting with a wrapped CollectionPage or OrderedCollectionPage in order to access both next / prev pages and items.

func ToCollectionPageIterator added in v0.12.0

func ToCollectionPageIterator(t vocab.Type) (CollectionPageIterator, error)

ToCollectionPageIterator attempts to resolve the given vocab type as a CollectionPage like object and wrap in a standardised interface in order to iterate its contents.

func WrapCollectionPage added in v0.12.0

WrapCollectionPage wraps an ActivityStreamsCollectionPage in a standardised collection page interface.

func WrapOrderedCollectionPage added in v0.12.0

WrapOrderedCollectionPage wraps an ActivityStreamsOrderedCollectionPage in a standardised collection page interface.

type CollectionPageParams added in v0.12.0

type CollectionPageParams struct {
	// containing collection.
	CollectionParams

	// Paging details.
	Current *paging.Page
	Next    *paging.Page
	Prev    *paging.Page
	Query   url.Values

	// Item appender for each item at index.
	Append func(int, ItemsPropertyBuilder)
	Count  int
}

type CollectionParams added in v0.12.0

type CollectionParams struct {
	// Containing collection
	// ID (i.e. NOT the page).
	ID *url.URL

	// Total no. items.
	Total int
}

type Emojiable

type Emojiable interface {
	WithJSONLDId
	WithTypeName
	WithName
	WithUpdated
	WithIcon
}

Emojiable represents the minimum interface for an 'emoji' tag.

type Flaggable added in v0.7.0

Flaggable represents the minimum interface for an activitystreams 'Flag' activity.

type Followable

type Followable interface {
	WithJSONLDId
	WithTypeName

	WithActor
	WithObject
}

Followable represents the minimum interface for an activitystreams 'follow' activity.

type Hashtaggable

type Hashtaggable interface {
	WithTypeName
	WithHref
	WithName
}

Hashtaggable represents the minimum activitypub interface for representing a 'hashtag' tag.

type ItemsPropertyBuilder added in v0.12.0

type ItemsPropertyBuilder interface {
	AppendIRI(*url.URL)
}

ItemsPropertyBuilder is a simplified interface type that can be fulfilled by either of (where required): vocab.ActivityStreamsItemsProperty vocab.ActivityStreamsOrderedItemsProperty

type Likeable

type Likeable interface {
	WithJSONLDId
	WithTypeName

	WithActor
	WithObject
}

Likeable represents the minimum interface for an activitystreams 'like' activity.

type Mentionable

type Mentionable interface {
	WithName
	WithHref
}

Mentionable represents the minimum interface for a 'mention' tag.

type PollOptionable added in v0.12.0

type PollOptionable interface {
	WithTypeName
	WithName
	WithReplies
}

PollOptionable represents the minimum activitypub interface for representing a poll 'option'. (see: IsPollOptionable() for types implementing this).

type Pollable added in v0.12.0

type Pollable interface {
	WithOneOf
	WithAnyOf
	WithEndTime
	WithClosed
	WithVotersCount

	// base-interface
	Statusable
}

Pollable represents the minimum activitypub interface for representing a 'poll' (it's a subset of a status). (see: IsPollable() for types implementing this, though you MUST make sure to check the typeName as this bare interface may be implementable by non-Pollable types).

func ToPollable added in v0.12.0

func ToPollable(t vocab.Type) (Pollable, bool)

ToPollable safely tries to cast vocab.Type as Pollable, also checking for expected AS type names.

type ReplyToable added in v0.3.4

type ReplyToable interface {
	WithInReplyTo
}

ReplyToable represents the minimum interface for an Activity that can be InReplyTo another activity.

type Statusable

Statusable represents the minimum activitypub interface for representing a 'status'. (see: IsStatusable() for types implementing this, though you MUST make sure to check the typeName as this bare interface may be implementable by non-Statusable types).

func ResolveStatusable added in v0.8.0

func ResolveStatusable(ctx context.Context, b []byte) (Statusable, error)

ResolveStatusable tries to resolve the given bytes into an ActivityPub Statusable representation. It will then perform normalization on the Statusable.

Works for: Article, Document, Image, Video, Note, Page, Event, Place, Profile, Question.

func ToStatusable added in v0.12.0

func ToStatusable(t vocab.Type) (Statusable, bool)

ToStatusable safely tries to cast vocab.Type as Statusable, also checking for expected AS type names.

type TypeOrIRI added in v0.12.0

type TypeOrIRI interface {
	WithIRI
	WithType
}

TypeOrIRI represents the minimum interface for something that may be a vocab.Type OR IRI.

func ExtractActivityData added in v0.12.0

func ExtractActivityData(activity pub.Activity, rawJSON map[string]any) ([]TypeOrIRI, []any, bool)

ExtractActivityData will extract the usable data type (e.g. Note, Question, etc) and corresponding JSON, from activity.

func ExtractObjects added in v0.7.0

func ExtractObjects(with WithObject) []TypeOrIRI

ExtractObjects will extract object vocab.Types from given implementing interface.

type WithActor

type WithActor interface {
	GetActivityStreamsActor() vocab.ActivityStreamsActorProperty
	SetActivityStreamsActor(vocab.ActivityStreamsActorProperty)
}

WithActor represents an activity with ActivityStreamsActorProperty

type WithAnyOf added in v0.12.0

type WithAnyOf interface {
	GetActivityStreamsAnyOf() vocab.ActivityStreamsAnyOfProperty
	SetActivityStreamsAnyOf(vocab.ActivityStreamsAnyOfProperty)
}

WithOneOf represents an activity with the oneOf property.

type WithAttachment

type WithAttachment interface {
	GetActivityStreamsAttachment() vocab.ActivityStreamsAttachmentProperty
	SetActivityStreamsAttachment(vocab.ActivityStreamsAttachmentProperty)
}

WithAttachment represents an activity with ActivityStreamsAttachmentProperty

type WithAttributedTo

type WithAttributedTo interface {
	GetActivityStreamsAttributedTo() vocab.ActivityStreamsAttributedToProperty
	SetActivityStreamsAttributedTo(vocab.ActivityStreamsAttributedToProperty)
}

WithAttributedTo represents an activity with ActivityStreamsAttributedToProperty

type WithBlurhash added in v0.2.0

type WithBlurhash interface {
	GetTootBlurhash() vocab.TootBlurhashProperty
	SetTootBlurhash(vocab.TootBlurhashProperty)
}

WithBlurhash represents an activity with TootBlurhashProperty

type WithCC

type WithCC interface {
	GetActivityStreamsCc() vocab.ActivityStreamsCcProperty
	SetActivityStreamsCc(vocab.ActivityStreamsCcProperty)
}

WithCC represents an activity with ActivityStreamsCcProperty

type WithClosed added in v0.12.0

type WithClosed interface {
	GetActivityStreamsClosed() vocab.ActivityStreamsClosedProperty
	SetActivityStreamsClosed(vocab.ActivityStreamsClosedProperty)
}

WithClosed represents an activity with the closed property.

type WithContent

type WithContent interface {
	GetActivityStreamsContent() vocab.ActivityStreamsContentProperty
	SetActivityStreamsContent(vocab.ActivityStreamsContentProperty)
}

WithContent represents an activity with ActivityStreamsContentProperty

type WithConversation

type WithConversation interface {
}

WithConversation ...

type WithDiscoverable

type WithDiscoverable interface {
	GetTootDiscoverable() vocab.TootDiscoverableProperty
	SetTootDiscoverable(vocab.TootDiscoverableProperty)
}

WithDiscoverable represents an activity with TootDiscoverableProperty

type WithEndTime added in v0.12.0

type WithEndTime interface {
	GetActivityStreamsEndTime() vocab.ActivityStreamsEndTimeProperty
	SetActivityStreamsEndTime(vocab.ActivityStreamsEndTimeProperty)
}

WithEndTime represents an activity with the endTime property.

type WithEndpoints added in v0.5.0

type WithEndpoints interface {
	GetActivityStreamsEndpoints() vocab.ActivityStreamsEndpointsProperty
	SetActivityStreamsEndpoints(vocab.ActivityStreamsEndpointsProperty)
}

WithEndpoints represents a Person or profile with the endpoints property

type WithFeatured

type WithFeatured interface {
	GetTootFeatured() vocab.TootFeaturedProperty
	SetTootFeatured(vocab.TootFeaturedProperty)
}

WithFeatured represents an activity with TootFeaturedProperty

type WithFollowers

type WithFollowers interface {
	GetActivityStreamsFollowers() vocab.ActivityStreamsFollowersProperty
	SetActivityStreamsFollowers(vocab.ActivityStreamsFollowersProperty)
}

WithFollowers represents an activity with ActivityStreamsFollowersProperty

type WithFollowing

type WithFollowing interface {
	GetActivityStreamsFollowing() vocab.ActivityStreamsFollowingProperty
	SetActivityStreamsFollowing(vocab.ActivityStreamsFollowingProperty)
}

WithFollowing represents an activity with ActivityStreamsFollowingProperty

type WithHref

type WithHref interface {
	GetActivityStreamsHref() vocab.ActivityStreamsHrefProperty
	SetActivityStreamsHref(vocab.ActivityStreamsHrefProperty)
}

WithHref represents an activity with ActivityStreamsHrefProperty

type WithIRI added in v0.12.0

type WithIRI interface {
	GetIRI() *url.URL
	IsIRI() bool
	SetIRI(*url.URL)
}

WithIRI represents an object (possibly) representable as an IRI.

type WithIcon

type WithIcon interface {
	GetActivityStreamsIcon() vocab.ActivityStreamsIconProperty
	SetActivityStreamsIcon(vocab.ActivityStreamsIconProperty)
}

WithIcon represents an activity with ActivityStreamsIconProperty

type WithImage

type WithImage interface {
	GetActivityStreamsImage() vocab.ActivityStreamsImageProperty
}

WithImage represents an activity with ActivityStreamsImageProperty

type WithInReplyTo

type WithInReplyTo interface {
	GetActivityStreamsInReplyTo() vocab.ActivityStreamsInReplyToProperty
	SetActivityStreamsInReplyTo(vocab.ActivityStreamsInReplyToProperty)
}

WithInReplyTo represents an activity with ActivityStreamsInReplyToProperty

type WithInbox

type WithInbox interface {
	GetActivityStreamsInbox() vocab.ActivityStreamsInboxProperty
	SetActivityStreamsInbox(vocab.ActivityStreamsInboxProperty)
}

WithInbox represents an activity with ActivityStreamsInboxProperty

type WithItems

type WithItems interface {
	GetActivityStreamsItems() vocab.ActivityStreamsItemsProperty
	SetActivityStreamsItems(vocab.ActivityStreamsItemsProperty)
}

WithItems represents an activity with ActivityStreamsItemsProperty

type WithJSONLDId

type WithJSONLDId interface {
	GetJSONLDId() vocab.JSONLDIdProperty
	SetJSONLDId(vocab.JSONLDIdProperty)
}

WithJSONLDId represents an activity with JSONLDIdProperty.

type WithManuallyApprovesFollowers

type WithManuallyApprovesFollowers interface {
	GetActivityStreamsManuallyApprovesFollowers() vocab.ActivityStreamsManuallyApprovesFollowersProperty
	SetActivityStreamsManuallyApprovesFollowers(vocab.ActivityStreamsManuallyApprovesFollowersProperty)
}

WithManuallyApprovesFollowers represents a Person or profile with the ManuallyApprovesFollowers property.

type WithMediaType

type WithMediaType interface {
	GetActivityStreamsMediaType() vocab.ActivityStreamsMediaTypeProperty
	SetActivityStreamsMediaType(vocab.ActivityStreamsMediaTypeProperty)
}

WithMediaType represents an activity with ActivityStreamsMediaTypeProperty

type WithName

type WithName interface {
	GetActivityStreamsName() vocab.ActivityStreamsNameProperty
	SetActivityStreamsName(vocab.ActivityStreamsNameProperty)
}

WithName represents an activity with ActivityStreamsNameProperty

type WithNext

type WithNext interface {
	GetActivityStreamsNext() vocab.ActivityStreamsNextProperty
	SetActivityStreamsNext(vocab.ActivityStreamsNextProperty)
}

WithNext represents an activity with ActivityStreamsNextProperty

type WithObject

type WithObject interface {
	GetActivityStreamsObject() vocab.ActivityStreamsObjectProperty
	SetActivityStreamsObject(vocab.ActivityStreamsObjectProperty)
}

WithObject represents an activity with ActivityStreamsObjectProperty

type WithOneOf added in v0.12.0

type WithOneOf interface {
	GetActivityStreamsOneOf() vocab.ActivityStreamsOneOfProperty
	SetActivityStreamsOneOf(vocab.ActivityStreamsOneOfProperty)
}

WithOneOf represents an activity with the oneOf property.

type WithOutbox

type WithOutbox interface {
	GetActivityStreamsOutbox() vocab.ActivityStreamsOutboxProperty
	SetActivityStreamsOutbox(vocab.ActivityStreamsOutboxProperty)
}

WithOutbox represents an activity with ActivityStreamsOutboxProperty

type WithPartOf

type WithPartOf interface {
	GetActivityStreamsPartOf() vocab.ActivityStreamsPartOfProperty
	SetActivityStreamsPartOf(vocab.ActivityStreamsPartOfProperty)
}

WithPartOf represents an activity with ActivityStreamsPartOfProperty

type WithPreferredUsername

type WithPreferredUsername interface {
	GetActivityStreamsPreferredUsername() vocab.ActivityStreamsPreferredUsernameProperty
	SetActivityStreamsPreferredUsername(vocab.ActivityStreamsPreferredUsernameProperty)
}

WithPreferredUsername represents an activity with ActivityStreamsPreferredUsernameProperty

type WithPublicKey

type WithPublicKey interface {
	GetW3IDSecurityV1PublicKey() vocab.W3IDSecurityV1PublicKeyProperty
	SetW3IDSecurityV1PublicKey(vocab.W3IDSecurityV1PublicKeyProperty)
}

WithPublicKey represents an activity with W3IDSecurityV1PublicKeyProperty

type WithPublished

type WithPublished interface {
	GetActivityStreamsPublished() vocab.ActivityStreamsPublishedProperty
	SetActivityStreamsPublished(vocab.ActivityStreamsPublishedProperty)
}

WithPublished represents an activity with ActivityStreamsPublishedProperty

type WithReplies

type WithReplies interface {
	GetActivityStreamsReplies() vocab.ActivityStreamsRepliesProperty
	SetActivityStreamsReplies(vocab.ActivityStreamsRepliesProperty)
}

WithReplies represents an activity with ActivityStreamsRepliesProperty

type WithSensitive

type WithSensitive interface {
	GetActivityStreamsSensitive() vocab.ActivityStreamsSensitiveProperty
	SetActivityStreamsSensitive(vocab.ActivityStreamsSensitiveProperty)
}

WithSensitive represents an activity with ActivityStreamsSensitiveProperty

type WithSummary

type WithSummary interface {
	GetActivityStreamsSummary() vocab.ActivityStreamsSummaryProperty
	SetActivityStreamsSummary(vocab.ActivityStreamsSummaryProperty)
}

WithSummary represents an activity with ActivityStreamsSummaryProperty

type WithTag

type WithTag interface {
	GetActivityStreamsTag() vocab.ActivityStreamsTagProperty
	SetActivityStreamsTag(vocab.ActivityStreamsTagProperty)
}

WithTag represents an activity with ActivityStreamsTagProperty

type WithTo

type WithTo interface {
	GetActivityStreamsTo() vocab.ActivityStreamsToProperty
	SetActivityStreamsTo(vocab.ActivityStreamsToProperty)
}

WithTo represents an activity with ActivityStreamsToProperty

type WithType added in v0.12.0

type WithType interface {
	GetType() vocab.Type
}

WithType ...

type WithTypeName

type WithTypeName interface {
	GetTypeName() string
}

WithTypeName represents an activity with a type name

type WithURL

type WithURL interface {
	GetActivityStreamsUrl() vocab.ActivityStreamsUrlProperty
	SetActivityStreamsUrl(vocab.ActivityStreamsUrlProperty)
}

WithURL represents an activity with ActivityStreamsUrlProperty

type WithUpdated

type WithUpdated interface {
	GetActivityStreamsUpdated() vocab.ActivityStreamsUpdatedProperty
	SetActivityStreamsUpdated(vocab.ActivityStreamsUpdatedProperty)
}

WithUpdated represents an activity with ActivityStreamsUpdatedProperty

type WithVotersCount added in v0.12.0

type WithVotersCount interface {
	GetTootVotersCount() vocab.TootVotersCountProperty
	SetTootVotersCount(vocab.TootVotersCountProperty)
}

WithVotersCount represents an activity with the votersCount property.

Jump to

Keyboard shortcuts

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