Documentation
¶
Overview ¶
JSON Marshal ¶
To create ActivityPub/ActivityStreams-flavored JSON-LD and JSON, you can either use the General Node Types....
The General Node Types being: Accept, Activity, Add, Announce, Application, [Arrive], Article, Audio, Block, Collection, CollectionPage, Create, Delete, Dislike, Document, Event, Flag, Follow, Group, HashTag, Ignore, Image, Invite, Join, Leave, Like, Link / HRef, Listen, Mention, Move, Note, Object / ObjectID, Offer, OrderedCollection, OrderedCollectionPage, Organization, Page, Person, Place, Profile, Question, Reject, Read, Relationship, Remove, Service, TentativeReject, TentativeAccept, Tombstone, [Travel], Undo, Update, Video, View, etc.
For example:
var note = activitypub.Note{
Content: opt.Something("<p>Hello world!</p>"),
}
bytes, err := activitypub.Marshal(note)
Or, alternatively, to generate ActivityPub/ActivityStreams-flavored JSON-LD and JSON, you can use the Any* Types.
The Any* Types being: AnyActivity, AnyActor, AnyCollection, AnyCollectionPage, AnyEntity, AnyImage, AnyLink, AnyNode, AnyObject, AnyRelationship.
For example:
var note = activitypub.AnyObject{
Type: jsonld.SomeType(activitypub.TypeNote),
Content: opt.Something("<p>Hello world!</p>"),
}
bytes, err := activitypub.Marshal(note)
JSON Unmarshal ¶
One way to load ActivityPub/ActivityStreams-flavored JSON-LD and JSON, is by using the Proto* functions:
• • • ProtoActorUnmarshalJSON
• • • • ProtoCollectionPageUnmarshalJSON
For example:
protoActivity, err := activitypub.ProtoActivityUnmarshalJSON(bytes)
if nil != err {
return err
}
switch protoActivity.(type) {
case activitypub.AnyActivity:
//@TODO
default:
//@TODO
}
Or, alternative, another way to load ActivityPub/ActivityStreams-flavored JSON-LD and JSON, is by using the Any* types directly.
General Node Types ¶
If you want to unmarshal ActivityPub/ActivityStreams-flavored JSON-LD data, most of the time, you probably want to use the General Node Types. General Node Types start with the prefix "Any".
In particular: AnyActivity, AnyActor, AnyCollection, AnyCollectionPage, AnyEntity, AnyImage, AnyLink, AnyNode, AnyObject, AnyRelationship.
Although, it is perhaps easier to understand these when seen as a hierarchy:
- AnyNode — represents something with an "id" and "type" field (which are ActivityPub's version of JSON-LD's "@id" and "@type" fields)
- • AnyEntity — also has "name", "nameMap", and "preview" fields
- • • AnyLink — has all of fields of an ActivityPub / ActivityStreams 'Link'
- • • AnyObject — has all of fields of an ActivityPub / ActivityStreams 'Object'
- • • • AnyActivity — has all of fields of an ActivityPub / ActivityStreams 'Activity'
- • • • AnyActor — has all of fields of an ActivityPub / ActivityStreams 'Actor'
- • • • AnyCollection — has all of fields of an ActivityPub / ActivityStreams 'Collection'
- • • • • AnyCollectionPage — has all of fields of an ActivityPub / ActivityStreams 'CollectionPage'
- • • • AnyImage — has all of fields of an ActivityPub / ActivityStreams 'Image'
- • • • AnyRelationship — has all of fields of an ActivityPub / ActivityStreams 'Relationship'
These are useful when you want to unmarshal ActivityPub / ActivityStreams JSON-LD into a struct.
For example:
var obj activitypub.AnyObject err := activitypub.Unmarshal(bytes, &obj)
Or, for example:
var act activitypub.AnyActivity err := activitypub.Unmarshal(bytes, &act)
Or, for example:
var unknown activitypub.AnyEntity
err := activitypub.Unmarshal(bytes, &unknown)
//@TODO: If unknown.Preview is not empty, then do something with unknown.Preview to show preview, since don't know how else to handle it.
// Else, if unknown.Preview is empty, then do something with unknown.Name or unknown.NameMap. ('name' is used as a title in other places, so perhaps treat it something like that.)
Concrete Node Types ¶
If you want to marshal a struct into JSON-LD data, most of the time, you probably want to use the concrete node types.
This package also provides concrete node types, so you do not have to set the 'type' yourself. In particular:
- Link / HRef
- • • Mention
- • • HashTag
- Object / ObjectID
- • Actor ← this should probably exist in ActivityPub / ActivityStreams, but doesn't
- • • Application
- • • Group
- • • Organization
- • • Person
- • • Service
- • Activity
- • • Accept
- • • Add
- • • Announce
- • • [Arrive]
- • • Block
- • • Create
- • • Delete
- • • Dislike
- • • Flag
- • • Follow
- • • Ignore
- • • Invite
- • • Join
- • • Leave
- • • Like
- • • Listen
- • • Move
- • • Offer
- • • Question
- • • Reject
- • • Read
- • • Remove
- • • TentativeReject
- • • TentativeAccept
- • • [Travel]
- • • Undo
- • • Update
- • • View
- • Article
- • Audio
- • Collection
- • • CollectionPage
- • • • OrderedCollectionPage ← appears more than once, due to multiple-inheritance
- • • OrderedCollection
- • • • OrderedCollectionPage ← appears more than once, due to multiple-inheritance
- • Document
- • Event
- • Image
- • Note
- • Page
- • Place
- • Profile
- • Relationship
- • Tombstone
- • Video
These are useful when you want to marshal a struct into ActivityPub / ActivityStreams JSON-LD.
For example:
var note = activitypub.Node{
Content: opt.Something("<p>Hello world!</p>"),
}
bytes, err := activitypub.Marshal(note)
Collapsed Form Types ¶
There is also a type that represents a collapsed form for a Link:
And, a type that represents a collapsed form for any Object type, include sub-types:
Proto* Types ¶
The Proto* types are used to hold that type, plus any of its sub-types. For example, a ProtoLink can hold any 'Link' type or sub-type (such as 'Link', 'Mention', 'Hashtag', or even custom sub-types of 'Link').
Here is a summary of the Proto* types:
┌────────────────────────┬─────────────────────┬─────────────────┬───────────────────┐ │ File │ Interface │ Embeds │ Returns │ ├────────────────────────┼─────────────────────┼─────────────────┼───────────────────┤ │ protonode.go │ ProtoNode │ (nothing) │ AnyNode │ ├────────────────────────┼─────────────────────┼─────────────────┼───────────────────┤ │ protoentity.go │ ProtoEntity │ ProtoNode │ AnyEntity │ ├────────────────────────┼─────────────────────┼─────────────────┼───────────────────┤ │ protolink.go │ ProtoLink │ ProtoEntity │ AnyLink │ ├────────────────────────┼─────────────────────┼─────────────────┼───────────────────┤ │ protoobject.go │ ProtoObject │ ProtoEntity │ AnyObject │ ├────────────────────────┼─────────────────────┼─────────────────┼───────────────────┤ │ protoimage.go │ ProtoImage │ ProtoObject │ AnyImage │ ├────────────────────────┼─────────────────────┼─────────────────┼───────────────────┤ │ protoactivity.go │ ProtoActivity │ ProtoObject │ AnyActivity │ ├────────────────────────┼─────────────────────┼─────────────────┼───────────────────┤ │ protoactor.go │ ProtoActor │ ProtoObject │ AnyActor │ ├────────────────────────┼─────────────────────┼─────────────────┼───────────────────┤ │ protocollection.go │ ProtoCollection │ ProtoObject │ AnyCollection │ ├────────────────────────┼─────────────────────┼─────────────────┼───────────────────┤ │ protocollectionpage.go │ ProtoCollectionPage │ ProtoCollection │ AnyCollectionPage │ ├────────────────────────┼─────────────────────┼─────────────────┼───────────────────┤ │ protorelationship.go │ ProtoRelationship │ ProtoObject │ AnyRelationship │ └────────────────────────┴─────────────────────┴─────────────────┴───────────────────┘
To load a Proto* type from JSON, use the following functions:
Index ¶
- Constants
- func IsActivityPubContentType(contentType string) bool
- func IsPublicFromJSONBytes(jsonldBytes []byte) bool
- func JSONIsCollectionPage(data []byte) bool
- func JSONIsLink(data []byte) bool
- func JSONType(data []byte) string
- func Marshal(values ...any) ([]byte, error)
- func ObjectURLFromJSONBytes(bytes []byte) []string
- func ServeHTTP(responseWriter http.ResponseWriter, request *http.Request, activity []byte)
- func TypeFromJSONBytes(jsonldBytes []byte) []string
- type Accept
- type Activity
- type Add
- type Announce
- type AnyActivity
- func (receiver AnyActivity) IsPublic() bool
- func (receiver AnyActivity) ProtoActivity() AnyActivity
- func (receiver AnyActivity) ProtoEntity() AnyEntity
- func (receiver AnyActivity) ProtoNode() AnyNode
- func (receiver AnyActivity) ProtoObject() AnyObject
- func (AnyActivity) ProtoObjectOrProtoLink()
- func (receiver *AnyActivity) UnmarshalJSON(data []byte) error
- type AnyActor
- type AnyCollection
- func (receiver AnyCollection) ProtoCollection() AnyCollection
- func (AnyCollection) ProtoCollectionOrProtoLink()
- func (receiver AnyCollection) ProtoEntity() AnyEntity
- func (receiver AnyCollection) ProtoNode() AnyNode
- func (receiver AnyCollection) ProtoObject() AnyObject
- func (AnyCollection) ProtoObjectOrProtoLink()
- func (receiver *AnyCollection) UnmarshalJSON(data []byte) error
- type AnyCollectionPage
- func (receiver AnyCollectionPage) ProtoCollection() AnyCollection
- func (AnyCollectionPage) ProtoCollectionOrProtoLink()
- func (receiver AnyCollectionPage) ProtoCollectionPage() AnyCollectionPage
- func (AnyCollectionPage) ProtoCollectionPageOrProtoLink()
- func (receiver AnyCollectionPage) ProtoEntity() AnyEntity
- func (receiver AnyCollectionPage) ProtoNode() AnyNode
- func (receiver AnyCollectionPage) ProtoObject() AnyObject
- func (AnyCollectionPage) ProtoObjectOrProtoLink()
- func (receiver *AnyCollectionPage) UnmarshalJSON(data []byte) error
- type AnyEntity
- type AnyImage
- type AnyIntransitiveActivity
- func (receiver AnyIntransitiveActivity) ProtoActivity() AnyActivity
- func (receiver AnyIntransitiveActivity) ProtoEntity() AnyEntity
- func (receiver AnyIntransitiveActivity) ProtoIntransitiveActivity() AnyIntransitiveActivity
- func (receiver AnyIntransitiveActivity) ProtoNode() AnyNode
- func (receiver AnyIntransitiveActivity) ProtoObject() AnyObject
- type AnyLink
- func (AnyLink) ProtoCollectionOrProtoLink()
- func (AnyLink) ProtoCollectionPageOrProtoLink()
- func (receiver AnyLink) ProtoEntity() AnyEntity
- func (receiver AnyLink) ProtoLink() AnyLink
- func (receiver AnyLink) ProtoNode() AnyNode
- func (AnyLink) ProtoObjectOrProtoLink()
- func (receiver *AnyLink) UnmarshalJSON(data []byte) error
- type AnyNode
- type AnyObject
- type AnyOrderedCollection
- func (receiver AnyOrderedCollection) ProtoCollection() AnyCollection
- func (receiver AnyOrderedCollection) ProtoEntity() AnyEntity
- func (receiver AnyOrderedCollection) ProtoNode() AnyNode
- func (receiver AnyOrderedCollection) ProtoObject() AnyObject
- func (receiver AnyOrderedCollection) ProtoOrderedCollection() AnyOrderedCollection
- type AnyOrderedCollectionPage
- func (receiver AnyOrderedCollectionPage) ProtoCollection() AnyCollection
- func (receiver AnyOrderedCollectionPage) ProtoCollectionPage() AnyCollectionPage
- func (receiver AnyOrderedCollectionPage) ProtoEntity() AnyEntity
- func (receiver AnyOrderedCollectionPage) ProtoNode() AnyNode
- func (receiver AnyOrderedCollectionPage) ProtoObject() AnyObject
- func (receiver AnyOrderedCollectionPage) ProtoOrderedCollection() AnyOrderedCollection
- func (receiver AnyOrderedCollectionPage) ProtoOrderedCollectionPage() AnyOrderedCollectionPage
- type AnyQuestion
- func (receiver AnyQuestion) ProtoActivity() AnyActivity
- func (receiver AnyQuestion) ProtoEntity() AnyEntity
- func (receiver AnyQuestion) ProtoIntransitiveActivity() AnyIntransitiveActivity
- func (receiver AnyQuestion) ProtoNode() AnyNode
- func (receiver AnyQuestion) ProtoObject() AnyObject
- func (receiver AnyQuestion) ProtoQuestion() AnyQuestion
- type AnyRelationship
- func (receiver AnyRelationship) ProtoEntity() AnyEntity
- func (receiver AnyRelationship) ProtoNode() AnyNode
- func (receiver AnyRelationship) ProtoObject() AnyObject
- func (AnyRelationship) ProtoObjectOrProtoLink()
- func (receiver AnyRelationship) ProtoRelationship() AnyRelationship
- func (receiver *AnyRelationship) UnmarshalJSON(data []byte) error
- type Application
- type Article
- type Audio
- type Block
- type Collection
- type CollectionPage
- func (receiver CollectionPage) ProtoCollection() AnyCollection
- func (CollectionPage) ProtoCollectionOrProtoLink()
- func (receiver CollectionPage) ProtoCollectionPage() AnyCollectionPage
- func (CollectionPage) ProtoCollectionPageOrProtoLink()
- func (receiver CollectionPage) ProtoEntity() AnyEntity
- func (receiver CollectionPage) ProtoNode() AnyNode
- func (receiver CollectionPage) ProtoObject() AnyObject
- func (CollectionPage) ProtoObjectOrProtoLink()
- type CoreActivity
- type CoreActor
- type CoreCollection
- type CoreCollectionPage
- type CoreEntity
- type CoreImage
- type CoreLink
- type CoreObject
- type CoreOrderedCollection
- type CoreOrderedCollectionPage
- type CoreQuestion
- type CoreRelationship
- type Create
- type Delete
- type Dislike
- type Document
- type EndPoints
- type Event
- type Flag
- type Follow
- type Group
- type HRef
- func (receiver HRef) MarshalText() (text []byte, err error)
- func (HRef) ProtoCollectionOrProtoLink()
- func (HRef) ProtoCollectionPageOrProtoLink()
- func (receiver HRef) ProtoEntity() AnyEntity
- func (receiver HRef) ProtoLink() AnyLink
- func (receiver HRef) ProtoNode() AnyNode
- func (HRef) ProtoObjectOrProtoLink()
- func (receiver HRef) String() string
- func (receiver *HRef) UnmarshalText(text []byte) error
- type HashTag
- type Ignore
- type Image
- type Invite
- type Join
- type Leave
- type Like
- type Link
- type Listen
- type Map
- type Mention
- type Move
- type Note
- type Object
- type ObjectID
- func (receiver ObjectID) MarshalText() (text []byte, err error)
- func (receiver ObjectID) ProtoEntity() AnyEntity
- func (receiver ObjectID) ProtoNode() AnyNode
- func (receiver ObjectID) ProtoObject() AnyObject
- func (ObjectID) ProtoObjectOrProtoLink()
- func (receiver ObjectID) String() string
- func (receiver *ObjectID) UnmarshalText(text []byte) error
- type ObjectURL
- type Offer
- type OrderedCollection
- func (receiver OrderedCollection) ProtoCollection() AnyCollection
- func (OrderedCollection) ProtoCollectionOrProtoLink()
- func (receiver OrderedCollection) ProtoEntity() AnyEntity
- func (receiver OrderedCollection) ProtoNode() AnyNode
- func (receiver OrderedCollection) ProtoObject() AnyObject
- func (OrderedCollection) ProtoObjectOrProtoLink()
- func (receiver OrderedCollection) ProtoOrderedCollection() AnyOrderedCollection
- type OrderedCollectionPage
- func (receiver OrderedCollectionPage) ProtoCollection() AnyCollection
- func (OrderedCollectionPage) ProtoCollectionOrProtoLink()
- func (receiver OrderedCollectionPage) ProtoCollectionPage() AnyCollectionPage
- func (OrderedCollectionPage) ProtoCollectionPageOrProtoLink()
- func (receiver OrderedCollectionPage) ProtoEntity() AnyEntity
- func (receiver OrderedCollectionPage) ProtoNode() AnyNode
- func (receiver OrderedCollectionPage) ProtoObject() AnyObject
- func (OrderedCollectionPage) ProtoObjectOrProtoLink()
- func (receiver OrderedCollectionPage) ProtoOrderedCollection() AnyOrderedCollection
- func (receiver OrderedCollectionPage) ProtoOrderedCollectionPage() AnyOrderedCollectionPage
- type Organization
- type Page
- type Person
- type Place
- type Profile
- type ProtoActivity
- type ProtoActor
- type ProtoCollection
- type ProtoCollectionOrProtoLink
- type ProtoCollectionPage
- type ProtoCollectionPageOrProtoLink
- type ProtoEntity
- type ProtoImage
- type ProtoIntransitiveActivity
- type ProtoLink
- type ProtoNode
- type ProtoObject
- type ProtoObjectOrProtoLink
- type ProtoOrderedCollection
- type ProtoQuestion
- type ProtoRelationship
- type Question
- func (receiver Question) ProtoActivity() AnyActivity
- func (receiver Question) ProtoEntity() AnyEntity
- func (receiver Question) ProtoIntransitiveActivity() AnyIntransitiveActivity
- func (receiver Question) ProtoNode() AnyNode
- func (receiver Question) ProtoObject() AnyObject
- func (Question) ProtoObjectOrProtoLink()
- func (receiver Question) ProtoQuestion() AnyQuestion
- type RawActivity
- type RawActor
- type RawCollection
- type RawCollectionPage
- type RawImage
- type RawLink
- type RawObject
- type RawRelationship
- type Read
- type Reject
- type Relationship
- type Remove
- type Service
- type Strings
- type TentativeAccept
- type TentativeReject
- type Tombstone
- type Undo
- type UnsafeObject
- type Update
- type Video
- type View
- type WholeNumber
Examples ¶
Constants ¶
const ( TypeAccept = "Accept" TypeAdd = "Add" TypeAnnounce = "Announce" TypeArrive = "Arrive" TypeBlock = "Block" TypeCreate = "Create" TypeDelete = "Delete" TypeDislike = "Dislike" TypeFlag = "Flag" TypeFollow = "Follow" TypeIgnore = "Ignore" TypeInvite = "Invite" TypeJoin = "Join" TypeLeave = "Leave" TypeLike = "Like" TypeListen = "Listen" TypeMove = "Move" TypeOffer = "Offer" TypeQuestion = "Question" TypeReject = "Reject" TypeRead = "Read" TypeRemove = "Remove" TypeTentativeReject = "TentativeReject" TypeTentativeAccept = "TentativeAccept" TypeTravel = "Travel" TypeUndo = "Undo" TypeUpdate = "Update" TypeView = "View" )
const ( TypeApplication = "Application" TypeFeed = "Feed" TypeGroup = "Group" TypeOrganization = "Organization" TypePerson = "Person" TypeService = "Service" )
const ( TypeCollection = "Collection" // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-collection TypeCollectionPage = "CollectionPage" // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-collectionpage TypeOrderedCollection = "OrderedCollection" // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollection TypeOrderedCollectionPage = "OrderedCollectionPage" // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollectionpage )
ActivityPub / ActivityStreams Collection types.
You might use these constants with AnyCollection or RawCollection.
The relationship between these different types is:
- Collection
- • CollectionPage
- • • OrderedCollectionPage ⬅ note that this is in the tree twice due to multiple-inheritance
- • OrderedCollection
- • • OrderedCollectionPage ⬅ note that this is in the tree twice due to multiple-inheritance
const ( ContentTypeJSON string = "application/activity+json" ContentTypeJSONLD string = `application/ld+json; profile="+JSONLDProfile+"` )
const ( ErrEmptyBytes = erorr.Error("activitypub: empty bytes") ErrNilReceiver = erorr.Error("activitypub: nil receiver") )
const ( TypeHashTag = "Hashtag" TypeMention = "Mention" )
const ( // TypeArticle is used to represent an ActivityPub / ActivityStreams "Article" type. // // An "Article" is a rich-text Object sub-type that has a title stored in the "name" field. // // See also [TypeObject] ("Object") for the parent type of TypeArticle ("Article"). // // The fully-qualified-value for this is: // https://www.w3.org/ns/activitystreams#Article // // For documentation about the ActivityPub / ActivityStreams "Article" type, see: // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-article // // One way you might use TypeArticle is in [AnyObject]. // For example: // // var obj activitypub.AnyObject // // obj.Type = activitypub.TypeArticle TypeArticle = "Article" TypeAudio = "Audio" // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-audio TypeDocument = "Document" // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-document TypeEvent = "Event" // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-event TypeImage = "Image" // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-image // TypeObject is used to represent an ActivityPub / ActivityStreams "Object" type. // // An "Object" is a the root Object type. // // The fully-qualified-value for this is: // https://www.w3.org/ns/activitystreams#Object // // For documentation about the ActivityPub / ActivityStreams "Object" type, see: // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object // // One way you might use TypeObject is in [AnyObject]. // For example: // // var obj activitypub.AnyObject // // obj.Type = activitypub.TypeObject TypeObject = "Object" // TypeNote is used to represent an ActivityPub / ActivityStreams "Note" type. // // A "Note" is a rich-text Object sub-type that doesT NOT have a title stored in the "name" field. // // See also [TypeObject] for the parent type of "Note". // // The fully-qualified-value for this is: // https://www.w3.org/ns/activitystreams#Note // // For documentation about the ActivityPub / ActivityStreams "Note" type, see: // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-note // // One way you might use TypeNote is in [AnyObject]. // For example: // // var obj activitypub.AnyObject // // obj.Type = activitypub.TypeNote TypeNote = "Note" TypePage = "Page" // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-page TypePlace = "Place" // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-place TypeProfile = "Profile" // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-profile TypeRelationship = "Relationship" // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-relationship TypeTombstone = "Tombstone" // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-tombstone TypeVideo = "Video" // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-video )
const ( PublicAddressIRICanonical = "https://www.w3.org/ns/activitystreams#Public" PublicAddressCompactCanonical = "as:Public" PublicAddressTerm = "Public" )
const (
JSONLDProfile string = "https://www.w3.org/ns/activitystreams"
)
const (
TypeActivity = "Activity"
)
const (
TypeActor = "Actor"
)
const (
TypeLink = "Link"
)
Variables ¶
This section is empty.
Functions ¶
func IsActivityPubContentType ¶
IsActivityPubContentType returns true if an HTTP Content-Type is an ActivityPub Content-Type, and returns false otherwise.
IsActivityPubContentType accepts the following as valid ActivityPub Content-Types:
- application/activity+json
- application/ld+json; profile="https://www.w3.org/ns/activitystreams"
- application/ld+json
Note that according to the ActivityPub/ActivityStreams specifications "application/ld+json" is not a valid ActivityPub Content-Type, but IsActivityPubContentType accepts it because there seems to have been some Fediverse software that have produced and accepted it.
Also note that IsActivityPubContentType ignores all Content-Type parameters except "profile" with the "application/ld+json" Media-Type. So, for example, IsActivityPubContentType would return true for these, too:
- application/activity+json; hello=world
- application/ld+json; secretmessage=hi
Note that just checking against ContentTypeJSON and ContentTypeJSONLD won't work because certain parts of an HTTP Content-Type are case-insensitive. IsActivityPubContentType with that.
For example, these (plus more) HTTP Content-Types are all equivalent:
application/activity+json aPpLiCaTiOn/AcTiViTy+JsOn application/activity+JSON application/ACTIVITY+json APPLICATION/activity+json APPLICATION/activity+JSON APPLICATION/ACTIVITY+json APPLICATION/ACTIVITY+JSON
Also, these (plus more) HTTP Content-Types are all equivalent:
application/ld+json; profile="https://www.w3.org/ns/activitystreams" aPpLiCaTiOn/Ld+JsOn; PrOfIlE="hTtPs://WwW.w3.OrG/ns/activitystreams" ApPlIcCtIoN/lD+jSoN; pRoFiLe="HtTpS://wWw.W3.oRg/ns/activitystreams" APPLICATION/ld+json; profile="https://www.w3.org/ns/activitystreams" application/LD+json; profile="https://www.w3.org/ns/activitystreams" application/ld+JSON; profile="https://www.w3.org/ns/activitystreams" application/ld+json; PROFILE="https://www.w3.org/ns/activitystreams" application/ld+json; profile="HTTPS://www.w3.org/ns/activitystreams" application/ld+json; profile="https://WWW.W3.ORG/ns/activitystreams" APPLICATION/LD+JSON; PROFILE="HTTPS://WWW.W3.ORG/ns/activitystreams"
But these (plus more) are NOT equivalent to the previous Content-Types (or to each other):
application/ld+json; profile="https://www.w3.org/NS/activitystreams" application/ld+json; profile="https://www.w3.org/Ns/activitystreams" application/ld+json; profile="https://www.w3.org/nS/activitystreams" application/ld+json; profile="https://www.w3.org/ns/ActivityStreams" application/ld+json; profile="https://www.w3.org/ns/ACTIVITYSTREAMS" application/ld+json; profile="https://www.w3.org/NS/ACTIVITYSTREAMS"
(URL paths are not case-insensitive.)
Which means you can NOT just use strings.ToLower() to normalize the Content-Type, but must parse it, normalize some but not all parts of it, and then reassemble it. Which is why IsActivityPubContentType exists.
func IsPublicFromJSONBytes ¶
IsPublicFromJSONBytes looks at raw ActivityPub JSON-LD and returns whether the "to" or "cc" fields make it public from an ActivityPub point-of-view.
func JSONIsCollectionPage ¶
JSONIsCollectionPage peeks at a JSON []byte and returns true if it appears to be an ActivityPub/ActivityStream 'CollectionPage' or 'OrderedCollectionPage'.
It checks if the "type" field (or "@type" field) is a known CollectionPage type ("CollectionPage", "OrderedCollectionPage").
func JSONIsLink ¶
JSONIsLink peeks at a JSON []byte and returns true if it appears to be an ActivityPub/ActivityStream 'Link'.
It first checks if the "type" field is a known 'Link' type ("Link", "Hashtag", "Mention"). If it is one of those, it returns true. If it isn't one of those, it continues.
It next needs to deal with custom 'Link' sub-types, or 'Link' types defined after this function was written. It does that by looking for the presence of an "href" field. Technically, the "href" field is optional, but — this function makes the assumption that it will exist (as it a 'Link', including sub-types, seem useless without an "href"). Maybe that assumption will prove to be misguided in the future, but — there doesn't seem to be another way to detect if a JSON object is an ActivityPub/ActivityStream 'Link'. So, if it has an "href" field, then it returns true.
If none of those returns true, it returns false.
If you want to unmarshal JSON that looks like it is a `Link` or sub-type, then use ProtoLinkUnmarshalJSON.
func JSONType ¶
JSONType returns the ActivityPub/ActivityStreams 'type' of JSON.
JSONType does this by extracting the "type" (or "@type") field from a JSON object without fully unmarshaling it.
RJSONType rturns an empty string if the type cannot be determined.
func Marshal ¶
Marshal returns the merged JSON-LD of the values passed to it.
Marshal is just a wrapper around jsonld.Marshal.
func ObjectURLFromJSONBytes ¶
func ServeHTTP ¶
func ServeHTTP(responseWriter http.ResponseWriter, request *http.Request, activity []byte)
ServeActivity helps create an http.Handler that serves "application/activity+json".
For example:
func ServeHTTP(responseWriter http.ResponseWriter, request *http.Request) {
// ...
activitypub.ServeHTTP(responseWriter, request, data)
// ...
}
func TypeFromJSONBytes ¶
TypeFromJSONBytes looks at raw ActivityPub JSON-LD and returns the types.
It looks for both the "@type" and "type" fields.
Types ¶
type Accept ¶
type Accept struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Accept"`
CoreEntity
CoreObject
CoreActivity
}
Accept represents an ActivityPub / ActivityStream Activity type "Accept".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-accept
Accept is similar to AnyObject except its `Type` field is hard-coded to "Accept".
func (Accept) ProtoActivity ¶
func (receiver Accept) ProtoActivity() AnyActivity
func (Accept) ProtoEntity ¶
func (Accept) ProtoObject ¶
func (Accept) ProtoObjectOrProtoLink ¶
func (Accept) ProtoObjectOrProtoLink()
type Activity ¶
type Activity struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Activity"`
CoreEntity
CoreObject
CoreActivity
}
Activity represents an ActivityPub / ActivityStream Activity type "Activity".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-activity
Activity is similar to AnyObject except its `Type` field is hard-coded to "Activity".
func (Activity) ProtoActivity ¶
func (receiver Activity) ProtoActivity() AnyActivity
func (Activity) ProtoEntity ¶
func (Activity) ProtoObject ¶
type Add ¶
type Add struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Add"`
CoreEntity
CoreObject
CoreActivity
}
Add represents an ActivityPub / ActivityStream Activity type "Add".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-add
Add is similar to AnyObject except its `Type` field is hard-coded to "Add".
func (Add) ProtoActivity ¶
func (receiver Add) ProtoActivity() AnyActivity
func (Add) ProtoEntity ¶
func (Add) ProtoObject ¶
func (Add) ProtoObjectOrProtoLink ¶
func (Add) ProtoObjectOrProtoLink()
type Announce ¶
type Announce struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Announce"`
CoreEntity
CoreObject
CoreActivity
}
Announce represents an ActivityPub / ActivityStream Activity type "Announce".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-announce
Announce is similar to AnyObject except its `Type` field is hard-coded to "Announce".
Example ¶
var announcement activitypub.Announce
announcement.ID = jsonld.SomeID("https://mastodon.social/users/reiver/statuses/113962917187191012/activity")
announcement.Actor = activitypub.HRef("acct:reiver@mastodon.social")
announcement.Published = opt.Something("2025-02-07T14:56:43Z")
announcement.To = activitypub.SomeString("https://www.w3.org/ns/activitystreams#Public")
announcement.Object = activitypub.HRef("https://example.com/note/0xf1938e3a1a6f4ac790fdf66d1b167858")
bytes, err := jsonld.Marshal(announcement)
if nil != err {
fmt.Printf("ERROR: %s", err)
return
}
fmt.Printf("%s", bytes)
func (Announce) ProtoActivity ¶
func (receiver Announce) ProtoActivity() AnyActivity
func (Announce) ProtoEntity ¶
func (Announce) ProtoObject ¶
func (Announce) ProtoObjectOrProtoLink ¶
func (Announce) ProtoObjectOrProtoLink()
type AnyActivity ¶
type AnyActivity struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
CoreEntity
CoreObject
CoreActivity
}
AnyActivity represents a general ActivityPub / ActivityStream Activity type that could be used to represent any ActivityPub / ActivityStream Activity type including sub-types.
AnyActivity is also returned by the ProtoActivity interface's [ProtoActivity.ProtoActivity] method.
AnyActivity is similar to other general types, such as: AnyActor, AnyCollection, AnyImage, AnyLink, AnyNode, AnyObject.
func (AnyActivity) IsPublic ¶
func (receiver AnyActivity) IsPublic() bool
func (AnyActivity) ProtoActivity ¶
func (receiver AnyActivity) ProtoActivity() AnyActivity
func (AnyActivity) ProtoEntity ¶
func (receiver AnyActivity) ProtoEntity() AnyEntity
func (AnyActivity) ProtoNode ¶
func (receiver AnyActivity) ProtoNode() AnyNode
func (AnyActivity) ProtoObject ¶
func (receiver AnyActivity) ProtoObject() AnyObject
func (AnyActivity) ProtoObjectOrProtoLink ¶
func (AnyActivity) ProtoObjectOrProtoLink()
Any Activities
func (*AnyActivity) UnmarshalJSON ¶
func (receiver *AnyActivity) UnmarshalJSON(data []byte) error
UnmarshalJSON makes AnyActivity fit the [json.Unmarshaler] interface.
This custom unmarshaler is needed because AnyActivity has interface-typed fields (ProtoNode, ProtoImage, ProtoEntity) that the standard json.Unmarshal cannot handle.
For ProtoNode fields: a JSON string unmarshals to ObjectID, a JSON object unmarshals to AnyObject or AnyLink. For ProtoImage fields: a JSON string unmarshals to an AnyImage with just an ID, a JSON object unmarshals to AnyImage. For ProtoEntity fields: a JSON string unmarshals to ObjectID, a JSON object unmarshals to AnyObject or AnyLink. For []ProtoNode fields: each element follows the same rules as ProtoNode fields.
type AnyActor ¶
type AnyActor struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
CoreEntity
CoreObject
CoreActor
}
AnyActor represents a general ActivityPub / ActivityStream Actor type that could be used to represent any ActivityPub / ActivityStream Actor type including sub-types.
AnyActor is also returned by the ProtoActor interface's [ProtoActor.ProtoActor] method.
AnyActor is similar to other general types, such as: AnyActivity, AnyCollection, AnyImage, AnyLink, AnyNode, AnyObject.
func (AnyActor) ProtoActor ¶
func (AnyActor) ProtoEntity ¶
func (AnyActor) ProtoObject ¶
func (*AnyActor) UnmarshalJSON ¶
UnmarshalJSON makes AnyActor fit the [json.Unmarshaler] interface.
This custom unmarshaler is needed because AnyActor has interface-typed fields (ProtoNode, ProtoImage, ProtoEntity) that the standard json.Unmarshal cannot handle.
For ProtoNode fields: a JSON string unmarshals to ObjectID, a JSON object unmarshals to AnyObject or AnyLink. For ProtoImage fields: a JSON string unmarshals to an AnyImage with just an ID, a JSON object unmarshals to AnyImage. For ProtoEntity fields: a JSON string unmarshals to ObjectID, a JSON object unmarshals to AnyObject or AnyLink. For []ProtoNode fields: each element follows the same rules as ProtoNode fields.
type AnyCollection ¶
type AnyCollection struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
CoreEntity
CoreObject
CoreCollection
}
AnyCollection represents a general ActivityPub / ActivityStream Collection type that could be used to represent any ActivityPub / ActivityStream Collection type including sub-types.
AnyCollection is also returned by the ProtoCollection interface's [ProtoCollection.ProtoCollection] method.
AnyCollection is similar to other general types, such as: AnyActivity, AnyActor, AnyImage, AnyLink, AnyNode, AnyObject.
func (AnyCollection) ProtoCollection ¶
func (receiver AnyCollection) ProtoCollection() AnyCollection
func (AnyCollection) ProtoCollectionOrProtoLink ¶
func (AnyCollection) ProtoCollectionOrProtoLink()
Any Collections
func (AnyCollection) ProtoEntity ¶
func (receiver AnyCollection) ProtoEntity() AnyEntity
func (AnyCollection) ProtoNode ¶
func (receiver AnyCollection) ProtoNode() AnyNode
func (AnyCollection) ProtoObject ¶
func (receiver AnyCollection) ProtoObject() AnyObject
func (AnyCollection) ProtoObjectOrProtoLink ¶
func (AnyCollection) ProtoObjectOrProtoLink()
Any Collections
func (*AnyCollection) UnmarshalJSON ¶
func (receiver *AnyCollection) UnmarshalJSON(data []byte) error
UnmarshalJSON makes AnyCollection fit the [json.Unmarshaler] interface.
This custom unmarshaler is needed because AnyCollection has interface-typed fields (ProtoNode, ProtoImage, ProtoEntity, ProtoCollection, ProtoCollectionOrProtoLink) that the standard json.Unmarshal cannot handle.
For ProtoNode fields: a JSON string unmarshals to ObjectID, a JSON object unmarshals to AnyObject or AnyLink. For ProtoImage fields: a JSON string unmarshals to an AnyImage with just an ID, a JSON object unmarshals to AnyImage. For ProtoEntity fields: a JSON string unmarshals to ObjectID, a JSON object unmarshals to AnyObject or AnyLink. For []ProtoNode fields: each element follows the same rules as ProtoNode fields. For ProtoCollectionOrProtoLink fields: a JSON string unmarshals to HRef, a link-type JSON object unmarshals to AnyLink, otherwise to AnyCollection. For ProtoCollection fields: a JSON string unmarshals to AnyCollection with just an ID, a JSON object unmarshals to AnyCollection.
type AnyCollectionPage ¶
type AnyCollectionPage struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
CoreEntity
CoreObject
CoreCollection
CoreCollectionPage
}
AnyCollectionPage represents a general ActivityPub / ActivityStream CollectionPage type that could be used to represent any ActivityPub / ActivityStream CollectionPage type including sub-types.
AnyCollectionPage is also returned by the ProtoCollectionPage interface's [ProtoCollectionPage.ProtoCollectionPage] method.
AnyCollectionPage is similar to other general types, such as: AnyActivity, AnyActor, AnyCollection, AnyImage, AnyLink, AnyNode, AnyObject.
func (AnyCollectionPage) ProtoCollection ¶
func (receiver AnyCollectionPage) ProtoCollection() AnyCollection
func (AnyCollectionPage) ProtoCollectionOrProtoLink ¶
func (AnyCollectionPage) ProtoCollectionOrProtoLink()
func (AnyCollectionPage) ProtoCollectionPage ¶
func (receiver AnyCollectionPage) ProtoCollectionPage() AnyCollectionPage
func (AnyCollectionPage) ProtoCollectionPageOrProtoLink ¶
func (AnyCollectionPage) ProtoCollectionPageOrProtoLink()
func (AnyCollectionPage) ProtoEntity ¶
func (receiver AnyCollectionPage) ProtoEntity() AnyEntity
func (AnyCollectionPage) ProtoNode ¶
func (receiver AnyCollectionPage) ProtoNode() AnyNode
func (AnyCollectionPage) ProtoObject ¶
func (receiver AnyCollectionPage) ProtoObject() AnyObject
func (AnyCollectionPage) ProtoObjectOrProtoLink ¶
func (AnyCollectionPage) ProtoObjectOrProtoLink()
func (*AnyCollectionPage) UnmarshalJSON ¶
func (receiver *AnyCollectionPage) UnmarshalJSON(data []byte) error
UnmarshalJSON makes AnyCollectionPage fit the [json.Unmarshaler] interface.
This custom unmarshaler is needed because AnyCollectionPage has interface-typed fields (ProtoNode, ProtoImage, ProtoEntity, ProtoCollection, ProtoCollectionOrProtoLink, ProtoCollectionPageOrProtoLink) that the standard json.Unmarshal cannot handle.
For ProtoNode fields: a JSON string unmarshals to ObjectID, a JSON object unmarshals to AnyObject or AnyLink. For ProtoImage fields: a JSON string unmarshals to an AnyImage with just an ID, a JSON object unmarshals to AnyImage. For ProtoEntity fields: a JSON string unmarshals to ObjectID, a JSON object unmarshals to AnyObject or AnyLink. For []ProtoNode fields: each element follows the same rules as ProtoNode fields. For ProtoCollectionOrProtoLink fields: a JSON string unmarshals to HRef, a link-type JSON object unmarshals to AnyLink, otherwise to AnyCollection. For ProtoCollection fields: a JSON string unmarshals to AnyCollection with just an ID, a JSON object unmarshals to AnyCollection. For ProtoCollectionPageOrProtoLink fields: a JSON string unmarshals to HRef, a link-type JSON object unmarshals to AnyLink, otherwise to AnyCollectionPage.
type AnyEntity ¶
type AnyEntity struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
CoreEntity
}
AnyEntity represents a general ActivityPub / ActivityStreams entity, that would be the root type that could be used to represent any ActivityPub / ActivityStreams entity type including sub-types.
AnyEntity is also returned by the ProtoEntity interface's [ProtoEntity.ProtoEntity] method.
AnyEntity is similar to other general types, such as:
- AnyActivity
- AnyActor
- AnyCollection
- AnyCollectionPage
- AnyEntity
- AnyImage
- AnyIntransitiveActivity
- AnyLink
- AnyNode
- AnyObject
- AnyOrderedCollection
- AnyOrderedCollectionPage
- AnyQuestion
- AnyRelationship
func (AnyEntity) ProtoEntity ¶
type AnyImage ¶
type AnyImage struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
CoreEntity
CoreObject
CoreImage
}
AnyImage represents any ActivityPub / ActivityStream 'Image' type.
See also: ProtoImage.
func (AnyImage) ProtoEntity ¶
func (AnyImage) ProtoImage ¶
func (AnyImage) ProtoObject ¶
func (AnyImage) ProtoObjectOrProtoLink ¶
func (AnyImage) ProtoObjectOrProtoLink()
func (*AnyImage) UnmarshalJSON ¶
UnmarshalJSON makes AnyImage fit the [json.Unmarshaler] interface.
This custom unmarshaler is needed because AnyImage has interface-typed fields (ProtoNode, ProtoImage, ProtoEntity) that the standard json.Unmarshal cannot handle.
For ProtoNode fields: a JSON string unmarshals to ObjectID, a JSON object unmarshals to AnyObject or AnyLink. For ProtoImage fields: a JSON string unmarshals to an AnyImage with just an ID, a JSON object unmarshals to AnyImage. For ProtoEntity fields: a JSON string unmarshals to ObjectID, a JSON object unmarshals to AnyObject or AnyLink. For []ProtoNode fields: each element follows the same rules as ProtoNode fields.
type AnyIntransitiveActivity ¶
type AnyIntransitiveActivity struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
CoreEntity
CoreObject
CoreActivity
}
AnyIntransitiveActivity represents a general ActivityPub / ActivityStream IntransitiveActivity type that could be used to represent any ActivityPub / ActivityStream IntransitiveActivity type including sub-types.
AnyIntransitiveActivity is also returned by the ProtoIntransitiveActivity interface's [ProtoActivity.ProtoActivity] method.
AnyIntransitiveActivity is similar to other general types, such as: AnyActor, AnyActivity, AnyCollection, AnyImage, AnyLink, AnyNode, AnyObject.
func (AnyIntransitiveActivity) ProtoActivity ¶
func (receiver AnyIntransitiveActivity) ProtoActivity() AnyActivity
func (AnyIntransitiveActivity) ProtoEntity ¶
func (receiver AnyIntransitiveActivity) ProtoEntity() AnyEntity
func (AnyIntransitiveActivity) ProtoIntransitiveActivity ¶
func (receiver AnyIntransitiveActivity) ProtoIntransitiveActivity() AnyIntransitiveActivity
func (AnyIntransitiveActivity) ProtoNode ¶
func (receiver AnyIntransitiveActivity) ProtoNode() AnyNode
func (AnyIntransitiveActivity) ProtoObject ¶
func (receiver AnyIntransitiveActivity) ProtoObject() AnyObject
type AnyLink ¶
type AnyLink struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
CoreEntity
CoreLink
}
AnyLink represents a general ActivityPub / ActivityStream Link type that could be used to represent any ActivityPub / ActivityStream Link type including sub-types.
AnyLink is also returned by the ProtoLink interface's [ProtoLink.ProtoLink] method.
AnyLink is similar to other general types, such as:
- AnyActivity
- AnyActor
- AnyCollection
- AnyCollectionPage
- AnyEntity
- AnyImage
- AnyIntransitiveActivity
- AnyLink
- AnyNode
- AnyObject
- AnyOrderedCollection
- AnyOrderedCollectionPage
- AnyQuestion
- AnyRelationship
func (AnyLink) ProtoCollectionPageOrProtoLink ¶
func (AnyLink) ProtoCollectionPageOrProtoLink()
func (AnyLink) ProtoEntity ¶
func (*AnyLink) UnmarshalJSON ¶
UnmarshalJSON makes AnyLink fit the [json.Unmarshaler] interface.
This custom unmarshaler is needed because AnyLink has an interface-typed field (Preview ProtoEntity) that the standard json.Unmarshal cannot handle.
type AnyNode ¶
type AnyNode struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
}
AnyNode represents a general JSON-LD node, that would be the root type that could be used to represent any JSON-LD node type including sub-types.
AnyNode is also returned by the ProtoNode interface's [ProtoNode.ProtoNode] method.
AnyNode is similar to other general types, such as:
type AnyObject ¶
type AnyObject struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
CoreEntity
CoreObject
}
AnyObject represents a general ActivityPub / ActivityStream Object type that could be used to represent any ActivityPub / ActivityStream Object type including sub-types.
AnyObject is also returned by the ProtoObject interface's [ProtoObject.ProtoObject] method.
AnyObject is similar to other general types, such as: AnyActivity, AnyActor, AnyCollection, AnyImage, AnyLink, AnyNode.
func (AnyObject) ProtoEntity ¶
func (AnyObject) ProtoObject ¶
func (*AnyObject) UnmarshalJSON ¶
UnmarshalJSON makes AnyObject fit the [json.Unmarshaler] interface.
This custom unmarshaler is needed because AnyObject has interface-typed fields (ProtoNode, ProtoImage, ProtoEntity) that the standard json.Unmarshal cannot handle.
For ProtoNode fields: a JSON string unmarshals to ObjectID, a JSON object unmarshals to AnyObject or AnyLink. For ProtoImage fields: a JSON string unmarshals to an AnyImage with just an ID, a JSON object unmarshals to AnyImage. For ProtoEntity fields: a JSON string unmarshals to ObjectID, a JSON object unmarshals to AnyObject or AnyLink. For []ProtoNode fields: each element follows the same rules as ProtoNode fields.
type AnyOrderedCollection ¶
type AnyOrderedCollection struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
CoreEntity
CoreObject
CoreCollection
CoreOrderedCollection
}
func (AnyOrderedCollection) ProtoCollection ¶
func (receiver AnyOrderedCollection) ProtoCollection() AnyCollection
func (AnyOrderedCollection) ProtoEntity ¶
func (receiver AnyOrderedCollection) ProtoEntity() AnyEntity
func (AnyOrderedCollection) ProtoNode ¶
func (receiver AnyOrderedCollection) ProtoNode() AnyNode
func (AnyOrderedCollection) ProtoObject ¶
func (receiver AnyOrderedCollection) ProtoObject() AnyObject
func (AnyOrderedCollection) ProtoOrderedCollection ¶
func (receiver AnyOrderedCollection) ProtoOrderedCollection() AnyOrderedCollection
type AnyOrderedCollectionPage ¶
type AnyOrderedCollectionPage struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
CoreEntity
CoreObject
CoreCollection
CoreCollectionPage
CoreOrderedCollection
CoreOrderedCollectionPage
}
func (AnyOrderedCollectionPage) ProtoCollection ¶
func (receiver AnyOrderedCollectionPage) ProtoCollection() AnyCollection
func (AnyOrderedCollectionPage) ProtoCollectionPage ¶
func (receiver AnyOrderedCollectionPage) ProtoCollectionPage() AnyCollectionPage
func (AnyOrderedCollectionPage) ProtoEntity ¶
func (receiver AnyOrderedCollectionPage) ProtoEntity() AnyEntity
func (AnyOrderedCollectionPage) ProtoNode ¶
func (receiver AnyOrderedCollectionPage) ProtoNode() AnyNode
func (AnyOrderedCollectionPage) ProtoObject ¶
func (receiver AnyOrderedCollectionPage) ProtoObject() AnyObject
func (AnyOrderedCollectionPage) ProtoOrderedCollection ¶
func (receiver AnyOrderedCollectionPage) ProtoOrderedCollection() AnyOrderedCollection
func (AnyOrderedCollectionPage) ProtoOrderedCollectionPage ¶
func (receiver AnyOrderedCollectionPage) ProtoOrderedCollectionPage() AnyOrderedCollectionPage
type AnyQuestion ¶
type AnyQuestion struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
CoreEntity
CoreObject
CoreActivity
CoreQuestion
}
func (AnyQuestion) ProtoActivity ¶
func (receiver AnyQuestion) ProtoActivity() AnyActivity
func (AnyQuestion) ProtoEntity ¶
func (receiver AnyQuestion) ProtoEntity() AnyEntity
func (AnyQuestion) ProtoIntransitiveActivity ¶
func (receiver AnyQuestion) ProtoIntransitiveActivity() AnyIntransitiveActivity
func (AnyQuestion) ProtoNode ¶
func (receiver AnyQuestion) ProtoNode() AnyNode
func (AnyQuestion) ProtoObject ¶
func (receiver AnyQuestion) ProtoObject() AnyObject
func (AnyQuestion) ProtoQuestion ¶
func (receiver AnyQuestion) ProtoQuestion() AnyQuestion
type AnyRelationship ¶
type AnyRelationship struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
CoreEntity
CoreObject
CoreRelationship
}
func (AnyRelationship) ProtoEntity ¶
func (receiver AnyRelationship) ProtoEntity() AnyEntity
func (AnyRelationship) ProtoNode ¶
func (receiver AnyRelationship) ProtoNode() AnyNode
func (AnyRelationship) ProtoObject ¶
func (receiver AnyRelationship) ProtoObject() AnyObject
func (AnyRelationship) ProtoObjectOrProtoLink ¶
func (AnyRelationship) ProtoObjectOrProtoLink()
func (AnyRelationship) ProtoRelationship ¶
func (receiver AnyRelationship) ProtoRelationship() AnyRelationship
func (*AnyRelationship) UnmarshalJSON ¶
func (receiver *AnyRelationship) UnmarshalJSON(data []byte) error
UnmarshalJSON makes AnyRelationship fit the [json.Unmarshaler] interface.
This custom unmarshaler is needed because AnyRelationship has interface-typed fields (ProtoNode, ProtoImage, ProtoEntity, ProtoObject, ProtoObjectOrProtoLink) that the standard json.Unmarshal cannot handle.
For ProtoNode fields: a JSON string unmarshals to ObjectID, a JSON object unmarshals to AnyObject or AnyLink. For ProtoImage fields: a JSON string unmarshals to an AnyImage with just an ID, a JSON object unmarshals to AnyImage. For ProtoEntity fields: a JSON string unmarshals to ObjectID, a JSON object unmarshals to AnyObject or AnyLink. For ProtoObject fields: a JSON string unmarshals to ObjectID, a JSON object unmarshals to AnyObject. For ProtoObjectOrProtoLink fields: a JSON string unmarshals to ObjectID, a JSON object unmarshals to AnyObject or AnyLink. For []ProtoNode fields: each element follows the same rules as ProtoNode fields.
type Application ¶
type Application struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Application"`
CoreEntity
CoreObject
CoreActor
}
Application represents an ActivityPub / ActivityStream Object type "Application".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-service
func (Application) ProtoActor ¶
func (receiver Application) ProtoActor() AnyActor
func (Application) ProtoEntity ¶
func (receiver Application) ProtoEntity() AnyEntity
func (Application) ProtoNode ¶
func (receiver Application) ProtoNode() AnyNode
func (Application) ProtoObject ¶
func (receiver Application) ProtoObject() AnyObject
type Article ¶
type Article struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Article"`
CoreEntity
CoreObject
}
Article represents an ActivityPub / ActivityStream Object type "Article".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-article
Article is similar to Object except its `Type` field is hard-coded to "Article".
func (Article) ProtoEntity ¶
func (Article) ProtoObject ¶
type Audio ¶
type Audio struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Audio"`
CoreEntity
CoreObject
}
Audio represents an ActivityPub / ActivityStream Object type "Audio".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-audio
func (Audio) ProtoEntity ¶
func (Audio) ProtoObject ¶
func (Audio) ProtoObjectOrProtoLink ¶
func (Audio) ProtoObjectOrProtoLink()
type Block ¶
type Block struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Block"`
CoreEntity
CoreObject
CoreActivity
}
Block represents an ActivityPub / ActivityStream Activity type "Block".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-block
Block is similar to AnyObject except its `Type` field is hard-coded to "Block".
func (Block) ProtoActivity ¶
func (receiver Block) ProtoActivity() AnyActivity
func (Block) ProtoEntity ¶
func (Block) ProtoObject ¶
func (Block) ProtoObjectOrProtoLink ¶
func (Block) ProtoObjectOrProtoLink()
func (Arrive) ProtoObjectOrProtoLink() {}
type Collection ¶
type Collection struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"` // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-id
Type json.Const[string] `json:"type" json.value:"Collection"` // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-type
CoreEntity
CoreObject
CoreCollection
}
Collection represents an ActivityPub / ActivityStream Collection type "Collection".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-collection
func (Collection) ProtoCollection ¶
func (receiver Collection) ProtoCollection() AnyCollection
func (Collection) ProtoCollectionOrProtoLink ¶
func (Collection) ProtoCollectionOrProtoLink()
Collections
func (Collection) ProtoEntity ¶
func (receiver Collection) ProtoEntity() AnyEntity
func (Collection) ProtoNode ¶
func (receiver Collection) ProtoNode() AnyNode
func (Collection) ProtoObject ¶
func (receiver Collection) ProtoObject() AnyObject
type CollectionPage ¶
type CollectionPage struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"` // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-id
Type json.Const[string] `json:"type" json.value:"CollectionPage"` // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-type
CoreEntity
CoreObject
CoreCollection
CoreCollectionPage
}
CollectionPage represents an ActivityPub / ActivityStream CollectionPage type "CollectionPage".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-collectionpage
func (CollectionPage) ProtoCollection ¶
func (receiver CollectionPage) ProtoCollection() AnyCollection
func (CollectionPage) ProtoCollectionOrProtoLink ¶
func (CollectionPage) ProtoCollectionOrProtoLink()
func (CollectionPage) ProtoCollectionPage ¶
func (receiver CollectionPage) ProtoCollectionPage() AnyCollectionPage
func (CollectionPage) ProtoCollectionPageOrProtoLink ¶
func (CollectionPage) ProtoCollectionPageOrProtoLink()
func (CollectionPage) ProtoEntity ¶
func (receiver CollectionPage) ProtoEntity() AnyEntity
func (CollectionPage) ProtoNode ¶
func (receiver CollectionPage) ProtoNode() AnyNode
func (CollectionPage) ProtoObject ¶
func (receiver CollectionPage) ProtoObject() AnyObject
func (CollectionPage) ProtoObjectOrProtoLink ¶
func (CollectionPage) ProtoObjectOrProtoLink()
type CoreActivity ¶
type CoreActivity struct {
Actor ProtoNode `json:"actor,omitempty"`
Instrument ProtoNode `json:"instrument,omitempty"`
Object ProtoObjectOrProtoLink `json:"object,omitempty"`
Origin ProtoNode `json:"origin,omitempty"`
Result ProtoNode `json:"result,omitempty"`
Target ProtoNode `json:"target,omitempty"`
}
type CoreActor ¶
type CoreActor struct {
EndPoints EndPoints `json:"endpoints,omitempty"`
Followers opt.Optional[string] `json:"followers,omitempty"`
Following opt.Optional[string] `json:"following,omitempty"`
InBox opt.Optional[string] `json:"inbox,omitempty"`
Liked opt.Optional[string] `json:"liked,omitempty"`
OutBox opt.Optional[string] `json:"outbox,omitempty"`
PreferredUserName Strings `json:"preferredUsername,omitempty"`
}
type CoreCollection ¶
type CoreCollection struct {
Current ProtoCollectionOrProtoLink `json:"current,omitempty"` // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-current
First ProtoCollectionOrProtoLink `json:"first,omitempty"` // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-first
Items []ProtoObjectOrProtoLink `json:"items,omitempty"` // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-items
Last ProtoCollectionOrProtoLink `json:"last,omitempty"` // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-last
TotalItems nul.Nullable[WholeNumber] `json:"totalItems,omitempty"` // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-totalitems
}
type CoreCollectionPage ¶
type CoreCollectionPage struct {
PartOf ProtoCollectionOrProtoLink `json:"partOf,omitempty"` // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-partof
Next ProtoCollectionPageOrProtoLink `json:"next,omitempty"` // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-next
Prev ProtoCollectionPageOrProtoLink `json:"prev,omitempty"` // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-prev
}
type CoreEntity ¶
type CoreEntity struct {
Name opt.Optional[string] `json:"name,omitempty"`
NameMap Map `json:"nameMap,omitempty"`
Preview ProtoEntity `json:"preview,omitempty"`
}
type CoreLink ¶
type CoreLink struct {
Height WholeNumber `json:"height,omitempty"`
HRef opt.Optional[string] `json:"href,omitempty"`
HRefLang opt.Optional[string] `json:"hreflang,omitempty"`
MediaType opt.Optional[string] `json:"mediaType,omitempty"`
Rel Strings `json:"rel,omitempty"`
Width WholeNumber `json:"width,omitempty"`
}
type CoreObject ¶
type CoreObject struct {
AlsoKnownAs Strings `json:"alsoKnownAs,omitempty"`
Attachments []ProtoObjectOrProtoLink `json:"attachment,omitempty"`
AttributedTo []ProtoObjectOrProtoLink `json:"attributedTo,omitempty"`
Audiences []ProtoObjectOrProtoLink `json:"audience,omitempty"`
CC Strings `json:"cc,omitempty"`
Content opt.Optional[string] `json:"content,omitempty"`
ContentMap Map `json:"contentMap,omitempty"`
Duration opt.Optional[string] `json:"duration,omitempty"`
EndTime opt.Optional[string] `json:"endTime,omitempty"`
Generator ProtoNode `json:"generator,omitempty"`
Icon ProtoImage `json:"icon,omitempty"`
Image ProtoImage `json:"image,omitempty"`
InReplyTo Strings `json:"inReplyTo,omitempty"`
Location []ProtoObjectOrProtoLink `json:"location,omitempty"`
MediaType opt.Optional[string] `json:"mediaType,omitempty"`
MovedTo opt.Optional[string] `json:"movedTo,omitempty"`
Published opt.Optional[string] `json:"published,omitempty"`
StartTime opt.Optional[string] `json:"startTime,omitempty"`
Summary nul.Nullable[string] `json:"summary,omitempty"`
SummaryMap Map `json:"summaryMap,omitempty"`
Tags []ProtoObjectOrProtoLink `json:"tag,omitempty"`
To Strings `json:"to,omitempty"`
Updated opt.Optional[string] `json:"updated,omitempty"`
URL ProtoLink `json:"url,omitempty"`
Likes ProtoCollectionOrProtoLink `json:"likes,omitempty"`
Replies ProtoCollection `json:"replies,omitempty"`
}
func (CoreObject) IsPublic ¶
func (receiver CoreObject) IsPublic() bool
type CoreOrderedCollection ¶
type CoreOrderedCollection struct {
OrderedItems []ProtoObjectOrProtoLink `json:"orderedItems,omitempty"`
}
type CoreOrderedCollectionPage ¶
type CoreOrderedCollectionPage struct {
StartIndex opt.Optional[uint64] `json:"startIndex,omitempty"` // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-startindex
}
type CoreQuestion ¶
type CoreQuestion struct {
AnyOf []ProtoObjectOrProtoLink `json:"anyOf,omitempty"`
Closed any `json:"closed,omitempty"` //@TODO: should be of type: Object | Link | xsd:dateTime | xsd:boolean
OneOf []ProtoObjectOrProtoLink `json:"oneOf,omitempty"`
}
type CoreRelationship ¶
type CoreRelationship struct {
Object ProtoObjectOrProtoLink `json:"object,omitempty"` // https://www.w3.org/ns/activitystreams#object
Relationship ProtoObject `json:"relationship,omitempty"` // https://www.w3.org/ns/activitystreams#relationship
Subject ProtoObjectOrProtoLink `json:"subject,omitempty"` // https://www.w3.org/ns/activitystreams#subject
}
type Create ¶
type Create struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Create"`
CoreEntity
CoreObject
CoreActivity
}
Create represents an ActivityPub / ActivityStream Activity type "Create".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-create
Create is similar to AnyObject except its `Type` field is hard-coded to "Create".
func (Create) ProtoActivity ¶
func (receiver Create) ProtoActivity() AnyActivity
func (Create) ProtoEntity ¶
func (Create) ProtoObject ¶
func (Create) ProtoObjectOrProtoLink ¶
func (Create) ProtoObjectOrProtoLink()
type Delete ¶
type Delete struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Delete"`
CoreEntity
CoreObject
CoreActivity
}
Delete represents an ActivityPub / ActivityStream Activity type "Delete".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-delete
Delete is similar to AnyObject except its `Type` field is hard-coded to "Delete".
func (Delete) ProtoActivity ¶
func (receiver Delete) ProtoActivity() AnyActivity
func (Delete) ProtoEntity ¶
func (Delete) ProtoObject ¶
func (Delete) ProtoObjectOrProtoLink ¶
func (Delete) ProtoObjectOrProtoLink()
type Dislike ¶
type Dislike struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Dislike"`
CoreEntity
CoreObject
CoreActivity
}
Dislike represents an ActivityPub / ActivityStream Activity type "Dislike".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-dislike
Dislike is similar to AnyObject except its `Type` field is hard-coded to "Dislike".
func (Dislike) ProtoActivity ¶
func (receiver Dislike) ProtoActivity() AnyActivity
func (Dislike) ProtoEntity ¶
func (Dislike) ProtoObject ¶
func (Dislike) ProtoObjectOrProtoLink ¶
func (Dislike) ProtoObjectOrProtoLink()
type Document ¶
type Document struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Document"`
CoreEntity
CoreObject
}
Document represents an ActivityPub / ActivityStream Object type "Document".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-document
func (Document) ProtoEntity ¶
func (Document) ProtoObject ¶
func (Document) ProtoObjectOrProtoLink ¶
func (Document) ProtoObjectOrProtoLink()
type EndPoints ¶
type EndPoints struct {
OAuthAuthorizationEndPoint opt.Optional[string] `json:"oauthAuthorizationEndpoint,omitempty"`
OAuthTokenEndPoint opt.Optional[string] `json:"oauthTokenEndpoint,omitempty"`
ProvideClientKey opt.Optional[string] `json:"provideClientKey,omitempty"`
ProxyURL opt.Optional[string] `json:"proxyUrl,omitempty"`
SignClientKey opt.Optional[string] `json:"signClientKey,omitempty"`
UploadMedia opt.Optional[string] `json:"uploadMedia,omitempty"`
}
type Event ¶
type Event struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Event"`
CoreEntity
CoreObject
}
Event represents an ActivityPub / ActivityStream Object type "Event".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-event
func (Event) ProtoEntity ¶
func (Event) ProtoObject ¶
func (Event) ProtoObjectOrProtoLink ¶
func (Event) ProtoObjectOrProtoLink()
type Flag ¶
type Flag struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Flag"`
CoreEntity
CoreObject
CoreActivity
}
Flag represents an ActivityPub / ActivityStream Activity type "Flag".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-flag
Flag is similar to AnyObject except its `Type` field is hard-coded to "Flag".
func (Flag) ProtoActivity ¶
func (receiver Flag) ProtoActivity() AnyActivity
func (Flag) ProtoEntity ¶
func (Flag) ProtoObject ¶
func (Flag) ProtoObjectOrProtoLink ¶
func (Flag) ProtoObjectOrProtoLink()
type Follow ¶
type Follow struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Follow"`
CoreEntity
CoreObject
CoreActivity
}
Follow represents an ActivityPub / ActivityStream Activity type "Follow".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-follow
Follow is similar to AnyObject except its `Type` field is hard-coded to "Follow".
func (Follow) ProtoActivity ¶
func (receiver Follow) ProtoActivity() AnyActivity
func (Follow) ProtoEntity ¶
func (Follow) ProtoObject ¶
func (Follow) ProtoObjectOrProtoLink ¶
func (Follow) ProtoObjectOrProtoLink()
type Group ¶
type Group struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Group"`
CoreEntity
CoreObject
CoreActor
}
Group represents an ActivityPub / ActivityStream Object type "Group".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-group
func (Group) ProtoActor ¶
func (Group) ProtoEntity ¶
func (Group) ProtoObject ¶
func (Group) ProtoObjectOrProtoLink ¶
func (Group) ProtoObjectOrProtoLink()
type HRef ¶
type HRef string
LinkHRef represents the a collapsed form of an ActivityPub / ActivityStream "Link" type. For example:
"https://example.com/apple/banana/cherry"
Could be a collapsed form for:
{
"type": "Link",
"href": "https://example.com/apple/banana/cherry"
}
For documentation on the ActivityPub / ActivityStream Object "Link" type, see: https://www.w3.org/TR/activitystreams-vocabulary/#dfn-link
See also: Link.
func (HRef) MarshalText ¶
MarshalText makes HRef fit the encoding.TextMarshaler interface.
func (HRef) ProtoCollectionOrProtoLink ¶
func (HRef) ProtoCollectionOrProtoLink()
func (HRef) ProtoCollectionPageOrProtoLink ¶
func (HRef) ProtoCollectionPageOrProtoLink()
func (HRef) ProtoEntity ¶
func (HRef) ProtoObjectOrProtoLink ¶
func (HRef) ProtoObjectOrProtoLink()
func (HRef) String ¶
String makes HRef fit the fmt.Stringer interface.
func (*HRef) UnmarshalText ¶
UnmarshalText makes HRef fit the encoding.TextUnmarshaler interface.
type HashTag ¶
type HashTag struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Hashtag"`
CoreEntity
CoreLink
}
func (HashTag) ProtoCollectionPageOrProtoLink ¶
func (HashTag) ProtoCollectionPageOrProtoLink()
func (HashTag) ProtoEntity ¶
type Ignore ¶
type Ignore struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Ignore"`
CoreEntity
CoreObject
CoreActivity
}
Ignore represents an ActivityPub / ActivityStream Activity type "Ignore".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-ignore
Ignore is similar to AnyObject except its `Type` field is hard-coded to "Ignore".
func (Ignore) ProtoActivity ¶
func (receiver Ignore) ProtoActivity() AnyActivity
func (Ignore) ProtoEntity ¶
func (Ignore) ProtoObject ¶
func (Ignore) ProtoObjectOrProtoLink ¶
func (Ignore) ProtoObjectOrProtoLink()
type Image ¶
type Image struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Image"`
CoreEntity
CoreObject
CoreImage
}
func (Image) ProtoEntity ¶
func (Image) ProtoImage ¶
func (Image) ProtoObject ¶
func (Image) ProtoObjectOrProtoLink ¶
func (Image) ProtoObjectOrProtoLink()
type Invite ¶
type Invite struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Invite"`
CoreEntity
CoreObject
CoreActivity
}
Invite represents an ActivityPub / ActivityStream Activity type "Invite".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-invite
Invite is similar to AnyObject except its `Type` field is hard-coded to "Invite".
func (Invite) ProtoActivity ¶
func (receiver Invite) ProtoActivity() AnyActivity
func (Invite) ProtoEntity ¶
func (Invite) ProtoObject ¶
func (Invite) ProtoObjectOrProtoLink ¶
func (Invite) ProtoObjectOrProtoLink()
type Join ¶
type Join struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Join"`
CoreEntity
CoreObject
CoreActivity
}
Join represents an ActivityPub / ActivityStream Activity type "Join".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-join
Join is similar to AnyObject except its `Type` field is hard-coded to "Join".
func (Join) ProtoActivity ¶
func (receiver Join) ProtoActivity() AnyActivity
func (Join) ProtoEntity ¶
func (Join) ProtoObject ¶
func (Join) ProtoObjectOrProtoLink ¶
func (Join) ProtoObjectOrProtoLink()
type Leave ¶
type Leave struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Leave"`
CoreEntity
CoreObject
CoreActivity
}
Leave represents an ActivityPub / ActivityStream Activity type "Leave".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-leave
Leave is similar to AnyObject except its `Type` field is hard-coded to "Leave".
func (Leave) ProtoActivity ¶
func (receiver Leave) ProtoActivity() AnyActivity
func (Leave) ProtoEntity ¶
func (Leave) ProtoObject ¶
func (Leave) ProtoObjectOrProtoLink ¶
func (Leave) ProtoObjectOrProtoLink()
type Like ¶
type Like struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Like"`
CoreEntity
CoreObject
CoreActivity
}
Like represents an ActivityPub / ActivityStream Activity type "Like".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-like
Like is similar to AnyObject except its `Type` field is hard-coded to "Like".
func (Like) ProtoActivity ¶
func (receiver Like) ProtoActivity() AnyActivity
func (Like) ProtoEntity ¶
func (Like) ProtoObject ¶
func (Like) ProtoObjectOrProtoLink ¶
func (Like) ProtoObjectOrProtoLink()
type Link ¶
type Link struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Link"`
CoreEntity
CoreLink
}
Link represents an ActivityPub / ActivityStream Link type "Link".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-link
func (Link) ProtoCollectionOrProtoLink ¶
func (Link) ProtoCollectionOrProtoLink()
func (Link) ProtoCollectionPageOrProtoLink ¶
func (Link) ProtoCollectionPageOrProtoLink()
func (Link) ProtoEntity ¶
func (Link) ProtoObjectOrProtoLink ¶
func (Link) ProtoObjectOrProtoLink()
type Listen ¶
type Listen struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Listen"`
CoreEntity
CoreObject
CoreActivity
}
Listen represents an ActivityPub / ActivityStream Activity type "Listen".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-listen
Listen is similar to AnyObject except its `Type` field is hard-coded to "Listen".
func (Listen) ProtoActivity ¶
func (receiver Listen) ProtoActivity() AnyActivity
func (Listen) ProtoEntity ¶
func (Listen) ProtoObject ¶
func (Listen) ProtoObjectOrProtoLink ¶
func (Listen) ProtoObjectOrProtoLink()
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map represents an ActivityStreams language-map field (such as "nameMap", "summaryMap", "contentMap") that is zero or more key-value pairs where both the key and value are strings.
The keys are BCP 47 language tags and the values are the corresponding text.
If its value is NoMap then its JSON / JSON-LD representation is the JSON / JSON-LD: null.
Otherwise its JSON / JSON-LD representation is a JSON object with string keys and string values.
Entries are stored sorted by key so that two Map values with the same entries are equal via ==.
Here is a JSON-LD example of what this Map type would be used:
"contentMap": {
"cr": "<p>Tansi kahkiyaw! Niwîcihtân nêhiyawêwin êkwa decentralized web protocols.</p>",
"en": "<p>Hello everyone! I love decentralized web protocols.</p>",
"fa": "<p>سلام به همگی! من عاشق پروتکلهای وب غیرمتمرکز هستم.</p>",
"fr": "<p>Bonjour à tous ! J'adore les protocoles web décentralisés.</p>",
"ja": "<p>皆さん、こんにちは!私は分散型ウェブプロトコルが大好きです。</p>",
"ko": "<p>안녕하세요 여러분! 저는 분산형 웹 프로토콜을 좋아합니다.</p>",
"pl": "<p>Cześć wszystkim! Uwielbiam zdecentralizowane protokoły internetowe.</p>"
},
Locally, this would be:
activitypub.SomeMaps(
field.String("cr", "<p>Tansi kahkiyaw! Niwîcihtân nêhiyawêwin êkwa decentralized web protocols.</p>"),
field.String("en", "<p>Hello everyone! I love decentralized web protocols.</p>"),
field.String("fa", "<p>سلام به همگی! من عاشق پروتکلهای وب غیرمتمرکز هستم.</p>"),
field.String("fr", "<p>Bonjour à tous ! J'adore les protocoles web décentralisés.</p>"),
field.String("ja", "<p>皆さん、こんにちは!私は分散型ウェブプロトコルが大好きです。</p>"),
field.String("ko", "<p>안녕하세요 여러분! 저는 분산형 웹 프로토콜을 좋아합니다.</p>"),
field.String("pl", "<p>Cześć wszystkim! Uwielbiam zdecentralizowane protokoły internetowe.</p>"),
)
func SomeMap ¶
func SomeMap(entry field.StringlyField) Map
SomeMap returns a Map with one entry in it.
func SomeMaps ¶
func SomeMaps(entries ...field.StringlyField) Map
SomeMaps returns a Map with many entries in it.
Entries are sorted by key. If duplicate keys are provided, the last value wins.
func (Map) MarshalJSON ¶
MarshalJSON makes Map fit the [json.Marshaler] interface.
type Mention ¶
type Mention struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Mention"`
CoreEntity
CoreLink
}
Mention represents an ActivityPub / ActivityStream Link type "Mention".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-mention
func (Mention) ProtoCollectionOrProtoLink ¶
func (Mention) ProtoCollectionOrProtoLink()
func (Mention) ProtoCollectionPageOrProtoLink ¶
func (Mention) ProtoCollectionPageOrProtoLink()
func (Mention) ProtoEntity ¶
func (Mention) ProtoObjectOrProtoLink ¶
func (Mention) ProtoObjectOrProtoLink()
type Move ¶
type Move struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Move"`
CoreEntity
CoreObject
CoreActivity
}
Move represents an ActivityPub / ActivityStream Activity type "Move".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-move
Move is similar to AnyObject except its `Type` field is hard-coded to "Move".
func (Move) ProtoActivity ¶
func (receiver Move) ProtoActivity() AnyActivity
func (Move) ProtoEntity ¶
func (Move) ProtoObject ¶
func (Move) ProtoObjectOrProtoLink ¶
func (Move) ProtoObjectOrProtoLink()
type Note ¶
type Note struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Note"`
CoreEntity
CoreObject
}
Note represents an ActivityPub / ActivityStream Object type "Note".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-note
Note is similar to Object and AnyObject except its `Type` field is hard-coded to "Note".
func (Note) ProtoEntity ¶
func (Note) ProtoObject ¶
func (Note) ProtoObjectOrProtoLink ¶
func (Note) ProtoObjectOrProtoLink()
type Object ¶
type Object struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Object"`
CoreEntity
CoreObject
}
Object represents the ActivityStreams object name-space used in a JSON-LD document.
Reference:
Example usage:
import ( "codeberg.org/reiver/go-activitypub" "github.com/reiver/go-jsonld" ) // ... var object activitypub.Object // ... bytes, err := jsonld.Marshal(object)
More likely you would mix this with other JSON-LD name-spaces, with code similar to the following:
import ( "codeberg.org/reiver/go-activitypub" "github.com/reiver/go-tootns" "github.com/reiver/go-jsonld" ) // ... var actor activitypub.Actor var object activitypub.Object var toot tootns.Toot // ... bytes, err := jsonld.Marshal(actor, object, toot)
See also:
func (Object) ProtoEntity ¶
func (Object) ProtoObject ¶
func (Object) ProtoObjectOrProtoLink ¶
func (Object) ProtoObjectOrProtoLink()
type ObjectID ¶
type ObjectID string
ObjectID represents the collapsed form of an ActivityPub / ActivityStream Object, including its sub-types.
For example:
{
"actor": "https://example.com/123"
}
Could be a collapsed form for:
{
"actor": {
"id": "https://example.com/123"
}
}
func (ObjectID) MarshalText ¶
MarshalText makes ObjectID fit the encoding.TextMarshaler interface.
func (ObjectID) ProtoEntity ¶
func (ObjectID) ProtoObject ¶
func (ObjectID) ProtoObjectOrProtoLink ¶
func (ObjectID) ProtoObjectOrProtoLink()
func (ObjectID) String ¶
String makes ObjectID fit the fmt.Stringer interface.
func (*ObjectID) UnmarshalText ¶
UnmarshalText makes ObjectID fit the encoding.TextUnmarshaler interface.
type ObjectURL ¶
type ObjectURL struct {
// contains filtered or unexported fields
}
ObjectURL is an alternative to AnyObject that just cares about the URL(s).
It also deals with the difference between an ActivityPub object's "url" being of type xsd:anyURI versus ActvityPub Link.
Call ObjectURL.URLs to get the object URL(s).
func (*ObjectURL) UnmarshalJSON ¶
type Offer ¶
type Offer struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Offer"`
CoreEntity
CoreObject
CoreActivity
}
Offer represents an ActivityPub / ActivityStream Activity type "Offer".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-offer
Offer is similar to AnyObject except its `Type` field is hard-coded to "Offer".
func (Offer) ProtoActivity ¶
func (receiver Offer) ProtoActivity() AnyActivity
func (Offer) ProtoEntity ¶
func (Offer) ProtoObject ¶
func (Offer) ProtoObjectOrProtoLink ¶
func (Offer) ProtoObjectOrProtoLink()
type OrderedCollection ¶
type OrderedCollection struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"` // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-id
Type json.Const[string] `json:"type" json.value:"OrderedCollection"` // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-type
CoreEntity
CoreObject
CoreCollection
CoreOrderedCollection
}
OrderedCollection represents an ActivityPub / ActivityStream Collection type "OrderedCollection".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollection
func (OrderedCollection) ProtoCollection ¶
func (receiver OrderedCollection) ProtoCollection() AnyCollection
func (OrderedCollection) ProtoCollectionOrProtoLink ¶
func (OrderedCollection) ProtoCollectionOrProtoLink()
func (OrderedCollection) ProtoEntity ¶
func (receiver OrderedCollection) ProtoEntity() AnyEntity
func (OrderedCollection) ProtoNode ¶
func (receiver OrderedCollection) ProtoNode() AnyNode
func (OrderedCollection) ProtoObject ¶
func (receiver OrderedCollection) ProtoObject() AnyObject
func (OrderedCollection) ProtoObjectOrProtoLink ¶
func (OrderedCollection) ProtoObjectOrProtoLink()
func (OrderedCollection) ProtoOrderedCollection ¶
func (receiver OrderedCollection) ProtoOrderedCollection() AnyOrderedCollection
type OrderedCollectionPage ¶
type OrderedCollectionPage struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"` // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-id
Type json.Const[string] `json:"type" json.value:"OrderedCollectionPage"` // https://www.w3.org/TR/activitystreams-vocabulary/#dfn-type
CoreEntity
CoreObject
CoreCollection
CoreCollectionPage
CoreOrderedCollection
CoreOrderedCollectionPage
}
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-orderedcollectionpage
func (OrderedCollectionPage) ProtoCollection ¶
func (receiver OrderedCollectionPage) ProtoCollection() AnyCollection
func (OrderedCollectionPage) ProtoCollectionOrProtoLink ¶
func (OrderedCollectionPage) ProtoCollectionOrProtoLink()
func (OrderedCollectionPage) ProtoCollectionPage ¶
func (receiver OrderedCollectionPage) ProtoCollectionPage() AnyCollectionPage
func (OrderedCollectionPage) ProtoCollectionPageOrProtoLink ¶
func (OrderedCollectionPage) ProtoCollectionPageOrProtoLink()
func (OrderedCollectionPage) ProtoEntity ¶
func (receiver OrderedCollectionPage) ProtoEntity() AnyEntity
func (OrderedCollectionPage) ProtoNode ¶
func (receiver OrderedCollectionPage) ProtoNode() AnyNode
func (OrderedCollectionPage) ProtoObject ¶
func (receiver OrderedCollectionPage) ProtoObject() AnyObject
func (OrderedCollectionPage) ProtoObjectOrProtoLink ¶
func (OrderedCollectionPage) ProtoObjectOrProtoLink()
func (OrderedCollectionPage) ProtoOrderedCollection ¶
func (receiver OrderedCollectionPage) ProtoOrderedCollection() AnyOrderedCollection
func (OrderedCollectionPage) ProtoOrderedCollectionPage ¶
func (receiver OrderedCollectionPage) ProtoOrderedCollectionPage() AnyOrderedCollectionPage
type Organization ¶
type Organization struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Organization"`
CoreEntity
CoreObject
CoreActor
}
Organization represents an ActivityPub / ActivityStream Object type "Organization".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-organization
func (Organization) ProtoActor ¶
func (receiver Organization) ProtoActor() AnyActor
func (Organization) ProtoEntity ¶
func (receiver Organization) ProtoEntity() AnyEntity
func (Organization) ProtoNode ¶
func (receiver Organization) ProtoNode() AnyNode
func (Organization) ProtoObject ¶
func (receiver Organization) ProtoObject() AnyObject
func (Organization) ProtoObjectOrProtoLink ¶
func (Organization) ProtoObjectOrProtoLink()
type Page ¶
type Page struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Page"`
CoreEntity
CoreObject
}
Page represents an ActivityPub / ActivityStream Object type "Page".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-page
Page is similar to Object except its `Type` field is hard-coded to "Page".
func (Page) ProtoEntity ¶
func (Page) ProtoObject ¶
func (Page) ProtoObjectOrProtoLink ¶
func (Page) ProtoObjectOrProtoLink()
type Person ¶
type Person struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Person"`
CoreEntity
CoreObject
CoreActor
}
Person represents an ActivityPub / ActivityStream Object type "Person".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-Person
func (Person) ProtoActor ¶
func (Person) ProtoEntity ¶
func (Person) ProtoObject ¶
func (Person) ProtoObjectOrProtoLink ¶
func (Person) ProtoObjectOrProtoLink()
type Place ¶
type Place struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Place"`
CoreEntity
CoreObject
}
Place represents an ActivityPub / ActivityStream Object type "Place".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-place
func (Place) ProtoEntity ¶
func (Place) ProtoObject ¶
func (Place) ProtoObjectOrProtoLink ¶
func (Place) ProtoObjectOrProtoLink()
type Profile ¶
type Profile struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Profile"`
CoreEntity
CoreObject
}
Profile represents an ActivityPub / ActivityStream Object type "Profile".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-profile
func (Profile) ProtoEntity ¶
func (Profile) ProtoObject ¶
func (Profile) ProtoObjectOrProtoLink ¶
func (Profile) ProtoObjectOrProtoLink()
type ProtoActivity ¶
type ProtoActivity interface {
ProtoObject
ProtoActivity() AnyActivity
IsPublic() bool
}
ProtoActivity represents something that is any type 'Activity', including sub-types.
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-activity
See also: AnyActivity.
func ProtoActivityUnmarshalJSON ¶
func ProtoActivityUnmarshalJSON(data []byte) (ProtoActivity, error)
ProtoActivityUnmarshalJSON unmarshals raw JSON into a ProtoActivity.
A JSON string is unmarshaled as an AnyActivity with just an ID set (collapsed form). A JSON object is unmarshaled as an AnyActivity.
type ProtoActor ¶
type ProtoActor interface {
ProtoObject
ProtoActor() AnyActor
}
ProtoActor represents something that is any type 'Actor', including sub-types.
See also: AnyActor.
func ProtoActorUnmarshalJSON ¶
func ProtoActorUnmarshalJSON(data []byte) (ProtoActor, error)
ProtoActorUnmarshalJSON unmarshals raw JSON into a ProtoActor.
A JSON string is unmarshaled as an AnyActor with just an ID set (collapsed form). A JSON object is unmarshaled as an AnyActor.
type ProtoCollection ¶
type ProtoCollection interface {
ProtoObject
ProtoCollection() AnyCollection
}
ProtoCollection represents something that is any type Collection, including sub-types.
See also: AnyCollection.
func ProtoCollectionUnmarshalJSON ¶
func ProtoCollectionUnmarshalJSON(data []byte) (ProtoCollection, error)
ProtoCollectionUnmarshalJSON unmarshals raw JSON into a ProtoCollection.
A JSON string is unmarshaled as an AnyCollection with just an ID set (collapsed form). A JSON object is unmarshaled as an AnyCollection. A JSON array is skipped (returns nil) since an array of items is not itself a collection.
type ProtoCollectionOrProtoLink ¶
type ProtoCollectionOrProtoLink interface {
ProtoCollectionOrProtoLink()
}
func ProtoCollectionOrProtoLinkUnmarshalJSON ¶
func ProtoCollectionOrProtoLinkUnmarshalJSON(data []byte) (ProtoCollectionOrProtoLink, error)
ProtoCollectionOrProtoLinkUnmarshalJSON unmarshals raw JSON into a ProtoCollectionOrProtoLink.
A JSON string is unmarshaled as an HRef (collapsed form of a link). A JSON object with a Link-like type is unmarshaled as an AnyLink. A JSON object with a CollectionPage-like type is unmarshaled as an AnyCollectionPage. A JSON object otherwise is unmarshaled as an AnyCollection.
type ProtoCollectionPage ¶
type ProtoCollectionPage interface {
ProtoCollection
ProtoCollectionPage() AnyCollectionPage
}
ProtoCollectionPage represents something that is any type CollectionPage, including sub-types.
See also: AnyCollectionPage.
func ProtoCollectionPageUnmarshalJSON ¶
func ProtoCollectionPageUnmarshalJSON(data []byte) (ProtoCollectionPage, error)
ProtoCollectionPageUnmarshalJSON unmarshals raw JSON into a ProtoCollectionPage.
A JSON string is unmarshaled as an AnyCollectionPage with just an ID set (collapsed form). A JSON object is unmarshaled as an AnyCollectionPage.
type ProtoCollectionPageOrProtoLink ¶
type ProtoCollectionPageOrProtoLink interface {
ProtoCollectionPageOrProtoLink()
}
func ProtoCollectionPageOrProtoLinkUnmarshalJSON ¶
func ProtoCollectionPageOrProtoLinkUnmarshalJSON(data []byte) (ProtoCollectionPageOrProtoLink, error)
ProtoCollectionPageOrProtoLinkUnmarshalJSON unmarshals raw JSON into a ProtoCollectionPageOrProtoLink.
A JSON string is unmarshaled as an HRef (collapsed form of a link). A JSON object with a Link-like type is unmarshaled as an AnyLink. A JSON object otherwise is unmarshaled as an AnyCollectionPage.
type ProtoEntity ¶
ProtoEntity represents something that is either a 'Object' or an 'Link', including sub-types for both.
ActivityPub / ActivityStreams doesn't actually have a single thing that represents this, but — one can note that if there 'Object' and 'Link' share 3 fields: "id", "type", "preview". Which are the fields that AnyEntity have.
See also: AnyEntity.
func ProtoEntityUnmarshalJSON ¶
func ProtoEntityUnmarshalJSON(data []byte) (ProtoEntity, error)
ProtoEntityUnmarshalJSON unmarshals raw JSON into a ProtoEntity.
A JSON string is unmarshaled as an ObjectID (collapsed form of an object). A JSON object is unmarshaled as an AnyLink if its "type" field is a known Link type ("Link", "Mention", "Hashtag"), otherwise as an AnyObject.
type ProtoImage ¶
type ProtoImage interface {
ProtoObject
ProtoImage() AnyImage
}
ProtoImage represents something that is any type 'Image', including sub-types.
See also: AnyImage.
func ProtoImageUnmarshalJSON ¶
func ProtoImageUnmarshalJSON(data []byte) (ProtoImage, error)
ProtoImageUnmarshalJSON unmarshals raw JSON into a ProtoImage.
A JSON string is unmarshaled as an ObjectID (which does not satisfy ProtoImage, so this returns an error). A JSON object is unmarshaled as an AnyImage.
type ProtoIntransitiveActivity ¶
type ProtoIntransitiveActivity interface {
ProtoActivity
ProtoIntransitiveActivity() AnyIntransitiveActivity
}
ProtoIntransitiveActivity represents something that is any type 'IntransitiveActivity', including sub-types.
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-activity
See also: AnyIntransitiveActivity.
type ProtoLink ¶
type ProtoLink interface {
ProtoEntity
ProtoLink() AnyLink
}
type ProtoNode ¶
type ProtoNode interface {
ProtoNode() AnyNode
}
ProtoNode is used to represent the "Range" = "Object | Link" found in ActivityPub / ActivityStreams: https://www.w3.org/TR/activitystreams-vocabulary/
func ProtoNodeUnmarshalJSON ¶
ProtoNodeUnmarshalJSON unmarshals raw JSON into a ProtoNode.
A JSON string is unmarshaled as an ObjectID (collapsed form of an object). A JSON object is unmarshaled as an AnyLink if its "type" field is a known Link type ("Link", "Mention", "Hashtag"), otherwise as an AnyObject.
func ProtoNodeUnmarshalJSONs ¶
ProtoNodeUnmarshalJSONs unmarshals raw JSON into a slice of ProtoNode.
A JSON array is expected, where each element follows the same rules as ProtoNodeUnmarshalJSON.
type ProtoObject ¶
type ProtoObject interface {
ProtoEntity
ProtoObject() AnyObject
}
ProtoObject represents something that is any type 'Object', including sub-types.
See also: AnyObject.
func ProtoObjectUnmarshalJSON ¶
func ProtoObjectUnmarshalJSON(data []byte) (ProtoObject, error)
ProtoObjectUnmarshalJSON unmarshals raw JSON into a ProtoObject.
A JSON string is unmarshaled as an ObjectID (collapsed form of an object). A JSON object is unmarshaled as an AnyObject.
type ProtoObjectOrProtoLink ¶
type ProtoObjectOrProtoLink interface {
ProtoObjectOrProtoLink()
}
func ProtoObjectOrProtoLinkUnmarshalJSON ¶
func ProtoObjectOrProtoLinkUnmarshalJSON(data []byte) (ProtoObjectOrProtoLink, error)
func ProtoObjectOrProtoLinkUnmarshalJSONs ¶
func ProtoObjectOrProtoLinkUnmarshalJSONs(data []byte) ([]ProtoObjectOrProtoLink, error)
ProtoObjectOrProtoLinkUnmarshalJSON unmarshals raw JSON into a ProtoObjectOrProtoLink.
A JSON string is unmarshaled as an ObjectID (collapsed form of an object). A JSON object with a Link-like type is unmarshaled as an AnyLink. A JSON object otherwise is unmarshaled as an AnyObject. ProtoObjectOrProtoLinkUnmarshalJSONs unmarshals raw JSON into a slice of ProtoObjectOrProtoLink.
A JSON array is expected, where each element follows the same rules as ProtoObjectOrProtoLinkUnmarshalJSON.
type ProtoOrderedCollection ¶
type ProtoOrderedCollection interface {
ProtoCollection
ProtoOrderedCollection() AnyOrderedCollection
}
ProtoOrderedCollection represents something that is any type OrderedCollection, including sub-types.
See also: AnyOrderedCollection.
type ProtoQuestion ¶
type ProtoQuestion interface {
ProtoIntransitiveActivity
ProtoQuestion() AnyQuestion
}
type ProtoRelationship ¶
type ProtoRelationship interface {
ProtoObject
ProtoRelationship() AnyRelationship
}
ProtoObject represents something that is any type 'Object', including sub-types.
See also: AnyObject.
func ProtoRelationshipUnmarshalJSON ¶
func ProtoRelationshipUnmarshalJSON(data []byte) (ProtoRelationship, error)
ProtoRelationshipUnmarshalJSON unmarshals raw JSON into a ProtoRelationship.
A JSON string is unmarshaled as an AnyRelationship with just an ID set (collapsed form). A JSON object is unmarshaled as an AnyRelationship.
type Question ¶
type Question struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Question"`
CoreEntity
CoreObject
CoreActivity
CoreQuestion
}
Question represents an ActivityPub / ActivityStream Activity type "Question".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-question
Question is similar to AnyObject except its `Type` field is hard-coded to "Question".
func (Question) ProtoActivity ¶
func (receiver Question) ProtoActivity() AnyActivity
func (Question) ProtoEntity ¶
func (Question) ProtoIntransitiveActivity ¶
func (receiver Question) ProtoIntransitiveActivity() AnyIntransitiveActivity
func (Question) ProtoObject ¶
func (Question) ProtoObjectOrProtoLink ¶
func (Question) ProtoObjectOrProtoLink()
func (Question) ProtoQuestion ¶
func (receiver Question) ProtoQuestion() AnyQuestion
type RawActivity ¶
type RawActivity struct {
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
Name opt.Optional[string] `json:"name,omitempty"`
NameMap Map `json:"nameMap,omitempty"`
Preview *gojson.RawMessage `json:"preview,omitempty"`
AlsoKnownAs Strings `json:"alsoKnownAs,omitempty"`
Attachments *gojson.RawMessage `json:"attachment,omitempty"`
AttributedTo *gojson.RawMessage `json:"attributedTo,omitempty"`
Audiences *gojson.RawMessage `json:"audience,omitempty"`
CC Strings `json:"cc,omitempty"`
Content opt.Optional[string] `json:"content,omitempty"`
ContentMap Map `json:"contentMap,omitempty"`
Duration opt.Optional[string] `json:"duration,omitempty"`
EndTime opt.Optional[string] `json:"endTime,omitempty"`
Generator *gojson.RawMessage `json:"generator,omitempty"`
Icon *gojson.RawMessage `json:"icon,omitempty"`
Image *gojson.RawMessage `json:"image,omitempty"`
InReplyTo Strings `json:"inReplyTo,omitempty"`
Location *gojson.RawMessage `json:"location,omitempty"`
MediaType opt.Optional[string] `json:"mediaType,omitempty"`
MovedTo opt.Optional[string] `json:"movedTo,omitempty"`
Published opt.Optional[string] `json:"published,omitempty"`
StartTime opt.Optional[string] `json:"startTime,omitempty"`
Summary nul.Nullable[string] `json:"summary,omitempty"`
SummaryMap Map `json:"summaryMap,omitempty"`
Tags *gojson.RawMessage `json:"tag,omitempty"`
To Strings `json:"to,omitempty"`
Updated opt.Optional[string] `json:"updated,omitempty"`
URL *gojson.RawMessage `json:"url,omitempty"`
Likes *gojson.RawMessage `json:"likes,omitempty"`
Replies *gojson.RawMessage `json:"replies,omitempty"`
Actor *gojson.RawMessage `json:"actor,omitempty"`
Instrument *gojson.RawMessage `json:"instrument,omitempty"`
Object *gojson.RawMessage `json:"object,omitempty"`
Origin *gojson.RawMessage `json:"origin,omitempty"`
Result *gojson.RawMessage `json:"result,omitempty"`
Target *gojson.RawMessage `json:"target,omitempty"`
}
RawActivity is used by AnyActivity.UnmarshalJSON to decode Activity JSON in two passes.
Fields with concrete types are decoded directly by the first pass. Fields with interface types (ProtoNode, ProtoImage, ProtoEntity) are kept as raw JSON so they can be decoded in a second pass.
type RawActor ¶
type RawActor struct {
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
Name opt.Optional[string] `json:"name,omitempty"`
NameMap Map `json:"nameMap,omitempty"`
Preview *gojson.RawMessage `json:"preview,omitempty"`
AlsoKnownAs Strings `json:"alsoKnownAs,omitempty"`
Attachments *gojson.RawMessage `json:"attachment,omitempty"`
AttributedTo *gojson.RawMessage `json:"attributedTo,omitempty"`
Audiences *gojson.RawMessage `json:"audience,omitempty"`
CC Strings `json:"cc,omitempty"`
Content opt.Optional[string] `json:"content,omitempty"`
ContentMap Map `json:"contentMap,omitempty"`
Duration opt.Optional[string] `json:"duration,omitempty"`
EndTime opt.Optional[string] `json:"endTime,omitempty"`
Generator *gojson.RawMessage `json:"generator,omitempty"`
Icon *gojson.RawMessage `json:"icon,omitempty"`
Image *gojson.RawMessage `json:"image,omitempty"`
InReplyTo Strings `json:"inReplyTo,omitempty"`
Location *gojson.RawMessage `json:"location,omitempty"`
MediaType opt.Optional[string] `json:"mediaType,omitempty"`
MovedTo opt.Optional[string] `json:"movedTo,omitempty"`
Published opt.Optional[string] `json:"published,omitempty"`
StartTime opt.Optional[string] `json:"startTime,omitempty"`
Summary nul.Nullable[string] `json:"summary,omitempty"`
SummaryMap Map `json:"summaryMap,omitempty"`
Tags *gojson.RawMessage `json:"tag,omitempty"`
To Strings `json:"to,omitempty"`
Updated opt.Optional[string] `json:"updated,omitempty"`
URL *gojson.RawMessage `json:"url,omitempty"`
Likes *gojson.RawMessage `json:"likes,omitempty"`
Replies *gojson.RawMessage `json:"replies,omitempty"`
EndPoints EndPoints `json:"endpoints,omitempty"`
Followers opt.Optional[string] `json:"followers,omitempty"`
Following opt.Optional[string] `json:"following,omitempty"`
InBox opt.Optional[string] `json:"inbox,omitempty"`
Liked opt.Optional[string] `json:"liked,omitempty"`
OutBox opt.Optional[string] `json:"outbox,omitempty"`
PreferredUserName Strings `json:"preferredUsername,omitempty"`
}
RawActor is used by AnyActor.UnmarshalJSON to decode Actor JSON in two passes.
Fields with concrete types are decoded directly by the first pass. Fields with interface types (ProtoNode, ProtoImage, ProtoEntity) are kept as raw JSON so they can be decoded in a second pass.
type RawCollection ¶
type RawCollection struct {
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
Name opt.Optional[string] `json:"name,omitempty"`
NameMap Map `json:"nameMap,omitempty"`
Preview *gojson.RawMessage `json:"preview,omitempty"`
AlsoKnownAs Strings `json:"alsoKnownAs,omitempty"`
Attachments *gojson.RawMessage `json:"attachment,omitempty"`
AttributedTo *gojson.RawMessage `json:"attributedTo,omitempty"`
Audiences *gojson.RawMessage `json:"audience,omitempty"`
CC Strings `json:"cc,omitempty"`
Content opt.Optional[string] `json:"content,omitempty"`
ContentMap Map `json:"contentMap,omitempty"`
Duration opt.Optional[string] `json:"duration,omitempty"`
EndTime opt.Optional[string] `json:"endTime,omitempty"`
Generator *gojson.RawMessage `json:"generator,omitempty"`
Icon *gojson.RawMessage `json:"icon,omitempty"`
Image *gojson.RawMessage `json:"image,omitempty"`
InReplyTo Strings `json:"inReplyTo,omitempty"`
Location *gojson.RawMessage `json:"location,omitempty"`
MediaType opt.Optional[string] `json:"mediaType,omitempty"`
MovedTo opt.Optional[string] `json:"movedTo,omitempty"`
Published opt.Optional[string] `json:"published,omitempty"`
StartTime opt.Optional[string] `json:"startTime,omitempty"`
Summary nul.Nullable[string] `json:"summary,omitempty"`
SummaryMap Map `json:"summaryMap,omitempty"`
Tags *gojson.RawMessage `json:"tag,omitempty"`
To Strings `json:"to,omitempty"`
Updated opt.Optional[string] `json:"updated,omitempty"`
URL *gojson.RawMessage `json:"url,omitempty"`
Likes *gojson.RawMessage `json:"likes,omitempty"`
Replies *gojson.RawMessage `json:"replies,omitempty"`
Current *gojson.RawMessage `json:"current,omitempty"`
First *gojson.RawMessage `json:"first,omitempty"`
Items *gojson.RawMessage `json:"items,omitempty"`
Last *gojson.RawMessage `json:"last,omitempty"`
TotalItems nul.Nullable[WholeNumber] `json:"totalItems,omitempty"`
}
RawCollection is used by AnyCollection.UnmarshalJSON to decode Collection JSON in two passes.
Fields with concrete types are decoded directly by the first pass. Fields with interface types (ProtoNode, ProtoImage, ProtoEntity, ProtoCollection, ProtoCollectionOrProtoLink) are kept as raw JSON so they can be decoded in a second pass.
type RawCollectionPage ¶
type RawCollectionPage struct {
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
Name opt.Optional[string] `json:"name,omitempty"`
NameMap Map `json:"nameMap,omitempty"`
Preview *gojson.RawMessage `json:"preview,omitempty"`
AlsoKnownAs Strings `json:"alsoKnownAs,omitempty"`
Attachments *gojson.RawMessage `json:"attachment,omitempty"`
AttributedTo *gojson.RawMessage `json:"attributedTo,omitempty"`
Audiences *gojson.RawMessage `json:"audience,omitempty"`
CC Strings `json:"cc,omitempty"`
Content opt.Optional[string] `json:"content,omitempty"`
ContentMap Map `json:"contentMap,omitempty"`
Duration opt.Optional[string] `json:"duration,omitempty"`
EndTime opt.Optional[string] `json:"endTime,omitempty"`
Generator *gojson.RawMessage `json:"generator,omitempty"`
Icon *gojson.RawMessage `json:"icon,omitempty"`
Image *gojson.RawMessage `json:"image,omitempty"`
InReplyTo Strings `json:"inReplyTo,omitempty"`
Location *gojson.RawMessage `json:"location,omitempty"`
MediaType opt.Optional[string] `json:"mediaType,omitempty"`
MovedTo opt.Optional[string] `json:"movedTo,omitempty"`
Published opt.Optional[string] `json:"published,omitempty"`
StartTime opt.Optional[string] `json:"startTime,omitempty"`
Summary nul.Nullable[string] `json:"summary,omitempty"`
SummaryMap Map `json:"summaryMap,omitempty"`
Tags *gojson.RawMessage `json:"tag,omitempty"`
To Strings `json:"to,omitempty"`
Updated opt.Optional[string] `json:"updated,omitempty"`
URL *gojson.RawMessage `json:"url,omitempty"`
Likes *gojson.RawMessage `json:"likes,omitempty"`
Replies *gojson.RawMessage `json:"replies,omitempty"`
Current *gojson.RawMessage `json:"current,omitempty"`
First *gojson.RawMessage `json:"first,omitempty"`
Items *gojson.RawMessage `json:"items,omitempty"`
Last *gojson.RawMessage `json:"last,omitempty"`
TotalItems nul.Nullable[WholeNumber] `json:"totalItems,omitempty"`
PartOf *gojson.RawMessage `json:"partOf,omitempty"`
Next *gojson.RawMessage `json:"next,omitempty"`
Prev *gojson.RawMessage `json:"prev,omitempty"`
}
RawCollectionPage is used by AnyCollectionPage.UnmarshalJSON to decode CollectionPage JSON in two passes.
Fields with concrete types are decoded directly by the first pass. Fields with interface types (ProtoNode, ProtoImage, ProtoEntity, ProtoCollection, ProtoCollectionOrProtoLink, ProtoCollectionPageOrProtoLink) are kept as raw JSON so they can be decoded in a second pass.
type RawImage ¶
type RawImage struct {
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
Name opt.Optional[string] `json:"name,omitempty"`
NameMap Map `json:"nameMap,omitempty"`
Preview *gojson.RawMessage `json:"preview,omitempty"`
AlsoKnownAs Strings `json:"alsoKnownAs,omitempty"`
Attachments *gojson.RawMessage `json:"attachment,omitempty"`
AttributedTo *gojson.RawMessage `json:"attributedTo,omitempty"`
Audiences *gojson.RawMessage `json:"audience,omitempty"`
CC Strings `json:"cc,omitempty"`
Content opt.Optional[string] `json:"content,omitempty"`
ContentMap Map `json:"contentMap,omitempty"`
Duration opt.Optional[string] `json:"duration,omitempty"`
EndTime opt.Optional[string] `json:"endTime,omitempty"`
Generator *gojson.RawMessage `json:"generator,omitempty"`
Icon *gojson.RawMessage `json:"icon,omitempty"`
Image *gojson.RawMessage `json:"image,omitempty"`
InReplyTo Strings `json:"inReplyTo,omitempty"`
Location *gojson.RawMessage `json:"location,omitempty"`
MediaType opt.Optional[string] `json:"mediaType,omitempty"`
MovedTo opt.Optional[string] `json:"movedTo,omitempty"`
Published opt.Optional[string] `json:"published,omitempty"`
StartTime opt.Optional[string] `json:"startTime,omitempty"`
Summary nul.Nullable[string] `json:"summary,omitempty"`
SummaryMap Map `json:"summaryMap,omitempty"`
Tags *gojson.RawMessage `json:"tag,omitempty"`
To Strings `json:"to,omitempty"`
Updated opt.Optional[string] `json:"updated,omitempty"`
URL *gojson.RawMessage `json:"url,omitempty"`
Likes *gojson.RawMessage `json:"likes,omitempty"`
Replies *gojson.RawMessage `json:"replies,omitempty"`
}
RawImage is used by AnyImage.UnmarshalJSON to decode Image JSON in two passes.
Fields with concrete types are decoded directly by the first pass. Fields with interface types (ProtoNode, ProtoImage, ProtoEntity) are kept as raw JSON so they can be decoded in a second pass.
type RawLink ¶
type RawLink struct {
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
Name opt.Optional[string] `json:"name,omitempty"`
NameMap Map `json:"nameMap,omitempty"`
Preview *gojson.RawMessage `json:"preview,omitempty"`
Height WholeNumber `json:"height,omitempty"`
HRef opt.Optional[string] `json:"href,omitempty"`
HRefLang opt.Optional[string] `json:"hreflang,omitempty"`
MediaType opt.Optional[string] `json:"mediaType,omitempty"`
Rel Strings `json:"rel,omitempty"`
Width WholeNumber `json:"width,omitempty"`
}
RawLink is used by AnyLink.UnmarshalJSON to decode Link JSON in two passes.
Fields with concrete types are decoded directly by the first pass. Fields with interface types (ProtoEntity) are kept as raw JSON so they can be decoded in a second pass.
type RawObject ¶
type RawObject struct {
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
Name opt.Optional[string] `json:"name,omitempty"`
NameMap Map `json:"nameMap,omitempty"`
Preview *gojson.RawMessage `json:"preview,omitempty"`
AlsoKnownAs Strings `json:"alsoKnownAs,omitempty"`
Attachments *gojson.RawMessage `json:"attachment,omitempty"`
AttributedTo *gojson.RawMessage `json:"attributedTo,omitempty"`
Audiences *gojson.RawMessage `json:"audience,omitempty"`
CC Strings `json:"cc,omitempty"`
Content opt.Optional[string] `json:"content,omitempty"`
ContentMap Map `json:"contentMap,omitempty"`
Duration opt.Optional[string] `json:"duration,omitempty"`
EndTime opt.Optional[string] `json:"endTime,omitempty"`
Generator *gojson.RawMessage `json:"generator,omitempty"`
Icon *gojson.RawMessage `json:"icon,omitempty"`
Image *gojson.RawMessage `json:"image,omitempty"`
InReplyTo Strings `json:"inReplyTo,omitempty"`
Location *gojson.RawMessage `json:"location,omitempty"`
MediaType opt.Optional[string] `json:"mediaType,omitempty"`
MovedTo opt.Optional[string] `json:"movedTo,omitempty"`
Published opt.Optional[string] `json:"published,omitempty"`
StartTime opt.Optional[string] `json:"startTime,omitempty"`
Summary nul.Nullable[string] `json:"summary,omitempty"`
SummaryMap Map `json:"summaryMap,omitempty"`
Tags *gojson.RawMessage `json:"tag,omitempty"`
To Strings `json:"to,omitempty"`
Updated opt.Optional[string] `json:"updated,omitempty"`
URL *gojson.RawMessage `json:"url,omitempty"`
Likes *gojson.RawMessage `json:"likes,omitempty"`
Replies *gojson.RawMessage `json:"replies,omitempty"`
}
RawObject is used by AnyObject.UnmarshalJSON to decode Object JSON in two passes.
Fields with concrete types are decoded directly by the first pass. Fields with interface types (ProtoNode, ProtoImage, ProtoEntity) are kept as raw JSON so they can be decoded in a second pass.
type RawRelationship ¶
type RawRelationship struct {
ID jsonld.ID `json:"id,omitempty"`
Type jsonld.Types `json:"type,omitempty"`
Name opt.Optional[string] `json:"name,omitempty"`
NameMap Map `json:"nameMap,omitempty"`
Preview *gojson.RawMessage `json:"preview,omitempty"`
AlsoKnownAs Strings `json:"alsoKnownAs,omitempty"`
Attachments *gojson.RawMessage `json:"attachment,omitempty"`
AttributedTo *gojson.RawMessage `json:"attributedTo,omitempty"`
Audiences *gojson.RawMessage `json:"audience,omitempty"`
CC Strings `json:"cc,omitempty"`
Content opt.Optional[string] `json:"content,omitempty"`
ContentMap Map `json:"contentMap,omitempty"`
Duration opt.Optional[string] `json:"duration,omitempty"`
EndTime opt.Optional[string] `json:"endTime,omitempty"`
Generator *gojson.RawMessage `json:"generator,omitempty"`
Icon *gojson.RawMessage `json:"icon,omitempty"`
Image *gojson.RawMessage `json:"image,omitempty"`
InReplyTo Strings `json:"inReplyTo,omitempty"`
Location *gojson.RawMessage `json:"location,omitempty"`
MediaType opt.Optional[string] `json:"mediaType,omitempty"`
MovedTo opt.Optional[string] `json:"movedTo,omitempty"`
Published opt.Optional[string] `json:"published,omitempty"`
StartTime opt.Optional[string] `json:"startTime,omitempty"`
Summary nul.Nullable[string] `json:"summary,omitempty"`
SummaryMap Map `json:"summaryMap,omitempty"`
Tags *gojson.RawMessage `json:"tag,omitempty"`
To Strings `json:"to,omitempty"`
Updated opt.Optional[string] `json:"updated,omitempty"`
URL *gojson.RawMessage `json:"url,omitempty"`
Likes *gojson.RawMessage `json:"likes,omitempty"`
Replies *gojson.RawMessage `json:"replies,omitempty"`
Object *gojson.RawMessage `json:"object,omitempty"` // https://www.w3.org/ns/activitystreams#object
Relationship *gojson.RawMessage `json:"relationship,omitempty"` // https://www.w3.org/ns/activitystreams#relationship
Subject *gojson.RawMessage `json:"subject,omitempty"` // https://www.w3.org/ns/activitystreams#subject
}
RawRelationship is used by AnyRelationship.UnmarshalJSON to decode Relationship JSON in two passes.
Fields with concrete types are decoded directly by the first pass. Fields with interface types (ProtoNode, ProtoImage, ProtoEntity, ProtoObject, ProtoObjectOrProtoLink) are kept as raw JSON so they can be decoded in a second pass.
type Read ¶
type Read struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Read"`
CoreEntity
CoreObject
CoreActivity
}
Read represents an ActivityPub / ActivityStream Activity type "Read".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-read
Read is similar to AnyObject except its `Type` field is hard-coded to "Read".
func (Read) ProtoActivity ¶
func (receiver Read) ProtoActivity() AnyActivity
func (Read) ProtoEntity ¶
func (Read) ProtoObject ¶
func (Read) ProtoObjectOrProtoLink ¶
func (Read) ProtoObjectOrProtoLink()
type Reject ¶
type Reject struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Reject"`
CoreEntity
CoreObject
CoreActivity
}
Reject represents an ActivityPub / ActivityStream Activity type "Reject".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-reject
Reject is similar to AnyObject except its `Type` field is hard-coded to "Reject".
func (Reject) ProtoActivity ¶
func (receiver Reject) ProtoActivity() AnyActivity
func (Reject) ProtoEntity ¶
func (Reject) ProtoObject ¶
func (Reject) ProtoObjectOrProtoLink ¶
func (Reject) ProtoObjectOrProtoLink()
type Relationship ¶
type Relationship struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Relationship"`
CoreEntity
CoreObject
CoreRelationship
}
Relationship represents an ActivityPub / ActivityStream Object type "Relationship".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-relationship
func (Relationship) ProtoEntity ¶
func (receiver Relationship) ProtoEntity() AnyEntity
func (Relationship) ProtoNode ¶
func (receiver Relationship) ProtoNode() AnyNode
func (Relationship) ProtoObject ¶
func (receiver Relationship) ProtoObject() AnyObject
func (Relationship) ProtoObjectOrProtoLink ¶
func (Relationship) ProtoObjectOrProtoLink()
func (Relationship) ProtoRelationship ¶
func (receiver Relationship) ProtoRelationship() AnyRelationship
type Remove ¶
type Remove struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Remove"`
CoreEntity
CoreObject
CoreActivity
}
Remove represents an ActivityPub / ActivityStream Activity type "Remove".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-remove
Remove is similar to AnyObject except its `Type` field is hard-coded to "Remove".
func (Remove) ProtoActivity ¶
func (receiver Remove) ProtoActivity() AnyActivity
func (Remove) ProtoEntity ¶
func (Remove) ProtoObject ¶
func (Remove) ProtoObjectOrProtoLink ¶
func (Remove) ProtoObjectOrProtoLink()
type Service ¶
type Service struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Service"`
CoreEntity
CoreObject
CoreActor
}
Service represents an ActivityPub / ActivityStream Object type "Service".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-service
func (Service) ProtoActor ¶
func (Service) ProtoEntity ¶
func (Service) ProtoObject ¶
func (Service) ProtoObjectOrProtoLink ¶
func (Service) ProtoObjectOrProtoLink()
type Strings ¶
type Strings struct {
// contains filtered or unexported fields
}
Strings represents an ActivityStreams "type" field that is zero, one, or many strings.
And, the way it marshals to JSON / JSON-LD is different depending on whether it is zero, one, or many strings.
If its value is NoStrings then its JSON / JSON-LD representation is the JSON / JSON-LD: null.
If its value is SomeString then its JSON / JSON-LD representation is the JSON / JSON-LD: string.
If its value is SomeStrings then its JSON / JSON-LD representation is the JSON / JSON-LD: array (of string).
func NoStrings ¶
func NoStrings() Strings
NoStrings returns a Strings with no strings in it.
This is more-or-less similar to the concept of "none" and "nothing" with optional-types. Note that "optional-types" are also known as 'option-types' and 'maybe-types'.
func SomeString ¶
SomeString returns a Strings with one string in it.
This is more-or-less similar to the concept of "some" and "something" with optional-types. Note that "optional-types" are also known as 'option-types' and 'maybe-types'.
func SomeStrings ¶
SomeStrings returns a Strings with many strings in it.
func (Strings) MarshalJSON ¶
MarshalJSON makes Strings fit the [json.Marshaler] interface.
type TentativeAccept ¶
type TentativeAccept struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"TentativeAccept"`
CoreEntity
CoreObject
CoreActivity
}
TentativeAccept represents an ActivityPub / ActivityStream Activity type "TentativeAccept".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-tentativeaccept
TentativeAccept is similar to AnyObject except its `Type` field is hard-coded to "TentativeAccept".
func (TentativeAccept) ProtoActivity ¶
func (receiver TentativeAccept) ProtoActivity() AnyActivity
func (TentativeAccept) ProtoEntity ¶
func (receiver TentativeAccept) ProtoEntity() AnyEntity
func (TentativeAccept) ProtoNode ¶
func (receiver TentativeAccept) ProtoNode() AnyNode
func (TentativeAccept) ProtoObject ¶
func (receiver TentativeAccept) ProtoObject() AnyObject
func (TentativeAccept) ProtoObjectOrProtoLink ¶
func (TentativeAccept) ProtoObjectOrProtoLink()
type TentativeReject ¶
type TentativeReject struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"TentativeReject"`
CoreEntity
CoreObject
CoreActivity
}
TentativeReject represents an ActivityPub / ActivityStream Activity type "TentativeReject".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-tentativereject
TentativeReject is similar to AnyObject except its `Type` field is hard-coded to "TentativeReject".
func (TentativeReject) ProtoActivity ¶
func (receiver TentativeReject) ProtoActivity() AnyActivity
func (TentativeReject) ProtoEntity ¶
func (receiver TentativeReject) ProtoEntity() AnyEntity
func (TentativeReject) ProtoNode ¶
func (receiver TentativeReject) ProtoNode() AnyNode
func (TentativeReject) ProtoObject ¶
func (receiver TentativeReject) ProtoObject() AnyObject
func (TentativeReject) ProtoObjectOrProtoLink ¶
func (TentativeReject) ProtoObjectOrProtoLink()
type Tombstone ¶
type Tombstone struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Tombstone"`
CoreEntity
CoreObject
}
Tombstone represents an ActivityPub / ActivityStream Object type "Tombstone".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-tombstone
func (Tombstone) ProtoEntity ¶
func (Tombstone) ProtoObject ¶
func (Tombstone) ProtoObjectOrProtoLink ¶
func (Tombstone) ProtoObjectOrProtoLink()
type Undo ¶
type Undo struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Undo"`
CoreEntity
CoreObject
CoreActivity
}
Undo represents an ActivityPub / ActivityStream Activity type "Undo".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-undo
Undo is similar to AnyObject except its `Type` field is hard-coded to "Undo".
func (Undo) ProtoActivity ¶
func (receiver Undo) ProtoActivity() AnyActivity
func (Undo) ProtoEntity ¶
func (Undo) ProtoObject ¶
func (Undo) ProtoObjectOrProtoLink ¶
func (Undo) ProtoObjectOrProtoLink()
func (Travel) ProtoObjectOrProtoLink() {}
type UnsafeObject ¶
type UnsafeObject struct {
// contains filtered or unexported fields
}
func UnsafeObjectWrap ¶
func UnsafeObjectWrap(bytes []byte) UnsafeObject
func (UnsafeObject) MarshalJSON ¶
func (receiver UnsafeObject) MarshalJSON() ([]byte, error)
func (UnsafeObject) ProtoEntity ¶
func (receiver UnsafeObject) ProtoEntity() AnyEntity
func (UnsafeObject) ProtoNode ¶
func (receiver UnsafeObject) ProtoNode() AnyNode
func (UnsafeObject) ProtoObject ¶
func (receiver UnsafeObject) ProtoObject() AnyObject
func (UnsafeObject) ProtoObjectOrProtoLink ¶
func (receiver UnsafeObject) ProtoObjectOrProtoLink()
type Update ¶
type Update struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Update"`
CoreEntity
CoreObject
CoreActivity
}
Update represents an ActivityPub / ActivityStream Activity type "Update".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-update
Update is similar to AnyObject except its `Type` field is hard-coded to "Update".
func (Update) ProtoActivity ¶
func (receiver Update) ProtoActivity() AnyActivity
func (Update) ProtoEntity ¶
func (Update) ProtoObject ¶
func (Update) ProtoObjectOrProtoLink ¶
func (Update) ProtoObjectOrProtoLink()
type Video ¶
type Video struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"Video"`
CoreEntity
CoreObject
}
Video represents an ActivityPub / ActivityStream Object type "Video".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-video
func (Video) ProtoEntity ¶
func (Video) ProtoObject ¶
func (Video) ProtoObjectOrProtoLink ¶
func (Video) ProtoObjectOrProtoLink()
type View ¶
type View struct {
NameSpace jsonld.NameSpace `jsonld:"https://www.w3.org/ns/activitystreams"`
Prefix jsonld.Prefix `jsonld:"as"`
ID jsonld.ID `json:"id,omitempty"`
Type json.Const[string] `json:"type" json.value:"View"`
CoreEntity
CoreObject
CoreActivity
}
View represents an ActivityPub / ActivityStream Activity type "View".
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-view
View is similar to AnyObject except its `Type` field is hard-coded to "View".
func (View) ProtoActivity ¶
func (receiver View) ProtoActivity() AnyActivity
func (View) ProtoEntity ¶
func (View) ProtoObject ¶
func (View) ProtoObjectOrProtoLink ¶
func (View) ProtoObjectOrProtoLink()
type WholeNumber ¶
type WholeNumber uint64
WholeNumber represents a non-negative integer.
func (WholeNumber) MarshalJSON ¶
func (receiver WholeNumber) MarshalJSON() ([]byte, error)
MarshalJSON makes WholeNumber fit the [json.Marshaler] interface.
func (*WholeNumber) UnmarshalJSON ¶
func (receiver *WholeNumber) UnmarshalJSON(data []byte) error
MarshalJSON makes WholeNumber fit the [json.Unmarshaler] interface.
Source Files
¶
- accept.go
- activity.go
- activitytypes.go
- actortypes.go
- add.go
- announce.go
- anyactivity.go
- anyactivity_unmarshaljson.go
- anyactor.go
- anyactor_unmarshaljson.go
- anycollection.go
- anycollection_unmarshaljson.go
- anycollectionpage.go
- anycollectionpage_unmarshaljson.go
- anyentity.go
- anyimage.go
- anyimage_unmarshaljson.go
- anyintransitiveactivity.go
- anylink.go
- anylink_unmarshaljson.go
- anynode.go
- anyobject.go
- anyobject_unmarshaljson.go
- anyorderedcollection.go
- anyorderedcollectionpage.go
- anyquestion.go
- anyrelationship.go
- anyrelationship_unmarshaljson.go
- application.go
- article.go
- audio.go
- block.go
- collection.go
- collectionpage.go
- collectiontypes.go
- contenttype.go
- create.go
- delete.go
- dislike.go
- doc.go
- document.go
- endpoints.go
- errors.go
- event.go
- flag.go
- follow.go
- group.go
- hashtag.go
- href.go
- httperror.go
- ignore.go
- image.go
- invite.go
- is.go
- join.go
- jsontype.go
- leave.go
- like.go
- link.go
- linktypes.go
- listen.go
- map.go
- marshal.go
- mention.go
- move.go
- note.go
- object.go
- objectid.go
- objecttypes.go
- objecturl.go
- offer.go
- orderedcollection.go
- orderedcollectionpage.go
- organization.go
- page.go
- person.go
- place.go
- profile.go
- protoactivity.go
- protoactivityunmarshaljson.go
- protoactor.go
- protoactorunmarshaljson.go
- protocollection.go
- protocollectionorprotolink.go
- protocollectionorprotolinkunmarshaljson.go
- protocollectionpage.go
- protocollectionpageorprotolink.go
- protocollectionpageorprotolinkunmarshaljson.go
- protocollectionpageunmarshaljson.go
- protocollectionunmarshaljson.go
- protoentity.go
- protoentityunmarshaljson.go
- protoimage.go
- protoimageunmarshaljson.go
- protointransitiveactivity.go
- protolink.go
- protolinkunmarshaljson.go
- protonode.go
- protonodeunmarshaljson.go
- protoobject.go
- protoobjectorprotolink.go
- protoobjectorprotolinkunmarshaljson.go
- protoobjectunmarshaljson.go
- protoorderedcollection.go
- protoquestion.go
- protorelationship.go
- protorelationshipunmarshaljson.go
- public.go
- question.go
- rawactivity.go
- rawactor.go
- rawcollection.go
- rawcollectionpage.go
- rawimage.go
- rawlink.go
- rawobject.go
- rawrelationship.go
- read.go
- reject.go
- relationship.go
- remove.go
- servehttp.go
- service.go
- strings.go
- tentative_accept.go
- tentative_reject.go
- tombstone.go
- type.go
- undo.go
- unmarshalobjectbytype.go
- unsafeobject.go
- update.go
- video.go
- view.go
- wholenumber.go