activitystreams

package module
v0.0.0-...-f968add Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: MIT Imports: 15 Imported by: 0

README

Activity Streams vocabulary for Go

MIT Licensed Build Status Test Coverage Go Report Card

Basic package for using activity pub API in Go.

Please see issue #1 before considering this project for real life applications.

Usage

import "github.com/go-ap/activitystreams"

Documentation

Index

Constants

View Source
const EmptyIRI = IRI("")
View Source
const EmptyObjectID = ObjectID("")
View Source
const PublicNS = IRI("https://www.w3.org/ns/activitystreams#Public")

Variables

View Source
var CollectionManagementActivityTypes = ActivityVocabularyTypes{
	AddType,
	MoveType,
	RemoveType,
}

CollectionManagementActivityTypes use case primarily deals with activities involving the management of content within collections. Examples of collections include things like folders, albums, friend lists, etc. This includes, for instance, activities such as "Sally added a file to Folder A", "John moved the file from Folder A to Folder B", etc.

View Source
var ContentExperienceActivityTypes = ActivityVocabularyTypes{
	ListenType,
	ReadType,
	ViewType,
}

ContentExperienceActivityTypes use case primarily deals with describing activities involving listening to, reading, or viewing content. For instance, "Sally read the article", "Joe listened to the song".

View Source
var ContentManagementActivityTypes = ActivityVocabularyTypes{
	CreateType,
	DeleteType,
	UpdateType,
}

ContentManagementActivityTypes use case primarily deals with activities that involve the creation, modification or deletion of content. This includes, for instance, activities such as "John created a new note", "Sally updated an article", and "Joe deleted the photo".

EventRSVPActivityTypes use case primarily deals with invitations to events and RSVP type responses.

View Source
var GenericLinkTypes = ActivityVocabularyTypes{
	LinkType,
}
View Source
var GenericTypes = append(GenericObjectTypes[:], GenericLinkTypes[:]...)
View Source
var GeoSocialEventsActivityTypes = ActivityVocabularyTypes{
	ArriveType,
	LeaveType,
	TravelType,
}

GeoSocialEventsActivityTypes use case primarily deals with activities involving geo-tagging type activities. For instance, it can include activities such as "Joe arrived at work", "Sally left work", and "John is travel from home to work".

View Source
var GroupManagementActivityTypes = ActivityVocabularyTypes{
	AddType,
	JoinType,
	LeaveType,
	RemoveType,
}

GroupManagementActivityTypes use case primarily deals with management of groups. It can include, for instance, activities such as "John added Sally to Group A", "Sally joined Group A", "Joe left Group A", etc.

View Source
var IntransitiveActivityTypes = ActivityVocabularyTypes{
	ArriveType,
	TravelType,
	QuestionType,
}
View Source
var NegatingActivityTypes = ActivityVocabularyTypes{
	UndoType,
}

NegatingActivityTypes use case primarily deals with the ability to redact previously completed activities. See 5.5 Inverse Activities and "Undo" for more information.

View Source
var NotificationActivityTypes = ActivityVocabularyTypes{
	AnnounceType,
}

NotificationActivityTypes use case primarily deals with calling attention to particular objects or notifications.

View Source
var OffersActivityTypes = ActivityVocabularyTypes{
	OfferType,
}

OffersActivityTypes use case deals with activities involving offering one object to another. It can include, for instance, activities such as "Company A is offering a discount on purchase of Product Z to Sally", "Sally is offering to add a File to Folder A", etc.

View Source
var QuestionActivityTypes = ActivityVocabularyTypes{
	QuestionType,
}

QuestionActivityTypes use case primarily deals with representing inquiries of any type. See 5.4 Representing Questions for more information.

ReactionsActivityTypes use case primarily deals with reactions to content. This can include activities such as liking or disliking content, ignoring updates, flagging content as being inappropriate, accepting or rejecting objects, etc.

RelationshipManagementActivityTypes use case primarily deals with representing activities involving the management of interpersonal and social relationships (e.g. friend requests, management of social network, etc). See 5.2 Representing Relationships Between Entities for more information.

Functions

func JSONGetBoolean

func JSONGetBoolean(data []byte, prop string) bool

func JSONGetDuration

func JSONGetDuration(data []byte, prop string) time.Duration

func JSONGetFloat

func JSONGetFloat(data []byte, prop string) float64

func JSONGetInt

func JSONGetInt(data []byte, prop string) int64

func JSONGetString

func JSONGetString(data []byte, prop string) string

func JSONGetTime

func JSONGetTime(data []byte, prop string) time.Time

func ValidLinkType

func ValidLinkType(typ ActivityVocabularyType) bool

ValidLinkType validates a type against the valid link types

Types

type Accept

type Accept = Activity

Accept indicates that the actor accepts the object. The target property can be used in certain circumstances to indicate the context into which the object has been accepted.

func AcceptNew

func AcceptNew(id ObjectID, ob Item) *Accept

AcceptNew initializes an Accept activity

type Activity

type Activity struct {
	// ID provides the globally unique identifier for anActivity Pub Object or Link.
	ID ObjectID `jsonld:"id,omitempty"`
	// Type identifies the Activity Pub Object or Link type. Multiple values may be specified.
	Type ActivityVocabularyType `jsonld:"type,omitempty"`
	// Name a simple, human-readable, plain-text name for the object.
	// HTML markup MUST NOT be included. The name MAY be expressed using multiple language-tagged values.
	Name NaturalLanguageValues `jsonld:"name,omitempty,collapsible"`
	// Attachment identifies a resource attached or related to an object that potentially requires special handling.
	// The intent is to provide a model that is at least semantically similar to attachments in email.
	Attachment Item `jsonld:"attachment,omitempty"`
	// AttributedTo identifies one or more entities to which this object is attributed. The attributed entities might not be Actors.
	// For instance, an object might be attributed to the completion of another activity.
	AttributedTo Item `jsonld:"attributedTo,omitempty"`
	// Audience identifies one or more entities that represent the total population of entities
	// for which the object can considered to be relevant.
	Audience ItemCollection `jsonld:"audience,omitempty"`
	// Content or textual representation of the Activity Pub Object encoded as a JSON string.
	// By default, the value of content is HTML.
	// The mediaType property can be used in the object to indicate a different content type.
	// (The content MAY be expressed using multiple language-tagged values.)
	Content NaturalLanguageValues `jsonld:"content,omitempty,collapsible"`
	// Context identifies the context within which the object exists or an activity was performed.
	// The notion of "context" used is intentionally vague.
	// The intended function is to serve as a means of grouping objects and activities that share a
	// common originating context or purpose. An example could be all activities relating to a common project or event.
	Context Item `jsonld:"context,omitempty"`
	// MediaType when used on an Object, identifies the MIME media type of the value of the content property.
	// If not specified, the content property is assumed to contain text/html content.
	MediaType MimeType `jsonld:"mediaType,omitempty"`
	// EndTime the date and time describing the actual or expected ending time of the object.
	// When used with an Activity object, for instance, the endTime property specifies the moment
	// the activity concluded or is expected to conclude.
	EndTime time.Time `jsonld:"endTime,omitempty"`
	// Generator identifies the entity (e.g. an application) that generated the object.
	Generator Item `jsonld:"generator,omitempty"`
	// Icon indicates an entity that describes an icon for this object.
	// The image should have an aspect ratio of one (horizontal) to one (vertical)
	// and should be suitable for presentation at a small size.
	Icon Item `jsonld:"icon,omitempty"`
	// Image indicates an entity that describes an image for this object.
	// Unlike the icon property, there are no aspect ratio or display size limitations assumed.
	Image Item `jsonld:"image,omitempty"`
	// InReplyTo indicates one or more entities for which this object is considered a response.
	InReplyTo Item `jsonld:"inReplyTo,omitempty"`
	// Location indicates one or more physical or logical locations associated with the object.
	Location Item `jsonld:"location,omitempty"`
	// Preview identifies an entity that provides a preview of this object.
	Preview Item `jsonld:"preview,omitempty"`
	// Published the date and time at which the object was published
	Published time.Time `jsonld:"published,omitempty"`
	// Replies identifies a Collection containing objects considered to be responses to this object.
	Replies Item `jsonld:"replies,omitempty"`
	// StartTime the date and time describing the actual or expected starting time of the object.
	// When used with an Activity object, for instance, the startTime property specifies
	// the moment the activity began or is scheduled to begin.
	StartTime time.Time `jsonld:"startTime,omitempty"`
	// Summary a natural language summarization of the object encoded as HTML.
	// *Multiple language tagged summaries may be provided.)
	Summary NaturalLanguageValues `jsonld:"summary,omitempty,collapsible"`
	// Tag one or more "tags" that have been associated with an objects. A tag can be any kind of Activity Pub Object.
	// The key difference between attachment and tag is that the former implies association by inclusion,
	// while the latter implies associated by reference.
	Tag ItemCollection `jsonld:"tag,omitempty"`
	// Updated the date and time at which the object was updated
	Updated time.Time `jsonld:"updated,omitempty"`
	// URL identifies one or more links to representations of the object
	URL LinkOrIRI `jsonld:"url,omitempty"`
	// To identifies an entity considered to be part of the public primary audience of an Activity Pub Object
	To ItemCollection `jsonld:"to,omitempty"`
	// Bto identifies anActivity Pub Object that is part of the private primary audience of this Activity Pub Object.
	Bto ItemCollection `jsonld:"bto,omitempty"`
	// CC identifies anActivity Pub Object that is part of the public secondary audience of this Activity Pub Object.
	CC ItemCollection `jsonld:"cc,omitempty"`
	// BCC identifies one or more Objects that are part of the private secondary audience of this Activity Pub Object.
	BCC ItemCollection `jsonld:"bcc,omitempty"`
	// Duration when the object describes a time-bound resource, such as an audio or video, a meeting, etc,
	// the duration property indicates the object's approximate duration.
	// The value must be expressed as an xsd:duration as defined by [ xmlschema11-2],
	// section 3.3.6 (e.g. a period of 5 seconds is represented as "PT5S").
	Duration time.Duration `jsonld:"duration,omitempty"`
	// Actor describes one or more entities that either performed or are expected to perform the activity.
	// Any single activity can have multiple actors. The actor may be specified using an indirect Link.
	Actor Item `jsonld:"actor,omitempty"`
	// Target describes the indirect object, or target, of the activity.
	// The precise meaning of the target is largely dependent on the type of action being described
	// but will often be the object of the English preposition "to".
	// For instance, in the activity "John added a movie to his wishlist",
	// the target of the activity is John's wishlist. An activity can have more than one target.
	Target Item `jsonld:"target,omitempty"`
	// Result describes the result of the activity. For instance, if a particular action results in the creation
	// of a new resource, the result property can be used to describe that new resource.
	Result Item `jsonld:"result,omitempty"`
	// Origin describes an indirect object of the activity from which the activity is directed.
	// The precise meaning of the origin is the object of the English preposition "from".
	// For instance, in the activity "John moved an item to List B from List A", the origin of the activity is "List A".
	Origin Item `jsonld:"origin,omitempty"`
	// Instrument identifies one or more objects used (or to be used) in the completion of an Activity.
	Instrument Item `jsonld:"instrument,omitempty"`
	// Object When used within an Activity, describes the direct object of the activity.
	// For instance, in the activity "John added a movie to his wishlist",
	// the object of the activity is the movie added.
	// When used within a Relationship describes the entity to which the subject is related.
	Object Item `jsonld:"object,omitempty"`
}

Activity is a subtype of Object that describes some form of action that may happen, is currently happening, or has already happened. The Activity type itself serves as an abstract base type for all types of activities. It is important to note that the Activity type itself does not carry any specific semantics about the kind of action being taken.

func ActivityNew

func ActivityNew(id ObjectID, typ ActivityVocabularyType, ob Item) *Activity

ActivityNew initializes a basic activity

func FlattenActivityProperties

func FlattenActivityProperties(act *Activity) *Activity

FlattenActivityProperties flattens the Activity's properties from Object type to IRI

func ToActivity

func ToActivity(it Item) (*Activity, error)

ToActivity

func (*Activity) Clean

func (a *Activity) Clean()

Clean removes Bto and BCC properties

func (Activity) GetID

func (a Activity) GetID() ObjectID

GetID returns the ObjectID corresponding to the Activity object

func (a Activity) GetLink() IRI

GetLink returns the IRI corresponding to the Activity object

func (Activity) GetType

func (a Activity) GetType() ActivityVocabularyType

GetType returns the ActivityVocabulary type of the current Activity

func (Activity) IsCollection

func (a Activity) IsCollection() bool

IsCollection returns false for Activity objects

func (a Activity) IsLink() bool

IsLink returns false for Activity objects

func (Activity) IsObject

func (a Activity) IsObject() bool

IsObject returns true for Activity objects

func (*Activity) Recipients

func (a *Activity) Recipients() ItemCollection

Recipients performs recipient de-duplication on the Activity's To, Bto, CC and BCC properties

func (*Activity) UnmarshalJSON

func (a *Activity) UnmarshalJSON(data []byte) error

UnmarshalJSON

type ActivityObject

type ActivityObject interface {
	// GetID returns the dereferenceable ActivityStreams object id
	GetID() ObjectID
	// GetType returns the ActivityStreams type
	GetType() ActivityVocabularyType
}

ActivityObject is a subtype of Object that describes some form of action that may happen, is currently happening, or has already happened

type ActivityVocabularyType

type ActivityVocabularyType string

ActivityVocabularyType is the data type for an Activity type object

const (
	AcceptType          ActivityVocabularyType = "Accept"
	AddType             ActivityVocabularyType = "Add"
	AnnounceType        ActivityVocabularyType = "Announce"
	ArriveType          ActivityVocabularyType = "Arrive"
	BlockType           ActivityVocabularyType = "Block"
	CreateType          ActivityVocabularyType = "Create"
	DeleteType          ActivityVocabularyType = "Delete"
	DislikeType         ActivityVocabularyType = "Dislike"
	FlagType            ActivityVocabularyType = "Flag"
	FollowType          ActivityVocabularyType = "Follow"
	IgnoreType          ActivityVocabularyType = "Ignore"
	InviteType          ActivityVocabularyType = "Invite"
	JoinType            ActivityVocabularyType = "Join"
	LeaveType           ActivityVocabularyType = "Leave"
	LikeType            ActivityVocabularyType = "Like"
	ListenType          ActivityVocabularyType = "Listen"
	MoveType            ActivityVocabularyType = "Move"
	OfferType           ActivityVocabularyType = "Offer"
	QuestionType        ActivityVocabularyType = "Question"
	RejectType          ActivityVocabularyType = "Reject"
	ReadType            ActivityVocabularyType = "Read"
	RemoveType          ActivityVocabularyType = "Remove"
	TentativeRejectType ActivityVocabularyType = "TentativeReject"
	TentativeAcceptType ActivityVocabularyType = "TentativeAccept"
	TravelType          ActivityVocabularyType = "Travel"
	UndoType            ActivityVocabularyType = "Undo"
	UpdateType          ActivityVocabularyType = "Update"
	ViewType            ActivityVocabularyType = "View"
)

Activity Types

const (
	ApplicationType  ActivityVocabularyType = "Application"
	GroupType        ActivityVocabularyType = "Group"
	OrganizationType ActivityVocabularyType = "Organization"
	PersonType       ActivityVocabularyType = "Person"
	ServiceType      ActivityVocabularyType = "Service"
)

Actor Types

const (
	// ActivityBaseURI the basic URI for the activity streams namespaces
	ActivityBaseURI                                  = IRI("https://www.w3.org/ns/activitystreams")
	ObjectType                ActivityVocabularyType = "Object"
	LinkType                  ActivityVocabularyType = "Link"
	ActivityType              ActivityVocabularyType = "Activity"
	IntransitiveActivityType  ActivityVocabularyType = "IntransitiveActivity"
	ActorType                 ActivityVocabularyType = "Actor"
	CollectionType            ActivityVocabularyType = "Collection"
	OrderedCollectionType     ActivityVocabularyType = "OrderedCollection"
	CollectionPageType        ActivityVocabularyType = "CollectionPage"
	OrderedCollectionPageType ActivityVocabularyType = "OrderedCollectionPage"

	// Activity Pub Object Types
	ArticleType      ActivityVocabularyType = "Article"
	AudioType        ActivityVocabularyType = "Audio"
	DocumentType     ActivityVocabularyType = "Document"
	EventType        ActivityVocabularyType = "Event"
	ImageType        ActivityVocabularyType = "Image"
	NoteType         ActivityVocabularyType = "Note"
	PageType         ActivityVocabularyType = "Page"
	PlaceType        ActivityVocabularyType = "Place"
	ProfileType      ActivityVocabularyType = "Profile"
	RelationshipType ActivityVocabularyType = "Relationship"
	TombstoneType    ActivityVocabularyType = "Tombstone"
	VideoType        ActivityVocabularyType = "Video"

	// MentionType is a link type for @mentions
	MentionType ActivityVocabularyType = "Mention"
)
const CollectionOfItems ActivityVocabularyType = "ItemCollection"

func JSONGetType

func JSONGetType(data []byte) ActivityVocabularyType

type ActivityVocabularyTypes

type ActivityVocabularyTypes []ActivityVocabularyType

func (ActivityVocabularyTypes) Contains

type Actor

type Actor Item

Actor is generally one of the ActivityStreams Actor Types, but they don't have to be. For example, a Profile object might be used as an actor, or a type from an ActivityStreams extension. Actors are retrieved like any other Object in ActivityPub. Like other ActivityStreams objects, actors have an id, which is a URI.

type Add

type Add = Activity

Add indicates that the actor has added the object to the target. If the target property is not explicitly specified, the target would need to be determined implicitly by context. The origin can be used to identify the context from which the object originated.

func AddNew

func AddNew(id ObjectID, ob Item, trgt Item) *Add

AddNew initializes an Add activity

type Announce

type Announce = Activity

Announce indicates that the actor is calling the target's attention the object. The origin typically has no defined meaning.

func AnnounceNew

func AnnounceNew(id ObjectID, ob Item) *Announce

AnnounceNew initializes an Announce activity

type Application

type Application = Object

Application describes a software application.

func ApplicationNew

func ApplicationNew(id ObjectID) *Application

ApplicationNew initializes an Application type actor

type Arrive

type Arrive = IntransitiveActivity

Arrive is an IntransitiveActivity that indicates that the actor has arrived at the location. The origin can be used to identify the context from which the actor originated. The target typically has no defined meaning.

func ArriveNew

func ArriveNew(id ObjectID) *Arrive

ArriveNew initializes an Arrive activity

type Article

type Article = Object

Article represents any kind of multi-paragraph written work.

type Audio

type Audio = Document

Audio represents an audio document of any kind.

type Block

type Block = Ignore

Block indicates that the actor is blocking the object. Blocking is a stronger form of Ignore. The typical use is to support social systems that allow one user to block activities or content of other users. The target and origin typically have no defined meaning.

func BlockNew

func BlockNew(id ObjectID, ob Item) *Block

BlockNew initializes a Block activity

type Collection

type Collection struct {
	// ID provides the globally unique identifier for anActivity Pub Object or Link.
	ID ObjectID `jsonld:"id,omitempty"`
	// Type identifies the Activity Pub Object or Link type. Multiple values may be specified.
	Type ActivityVocabularyType `jsonld:"type,omitempty"`
	// Name a simple, human-readable, plain-text name for the object.
	// HTML markup MUST NOT be included. The name MAY be expressed using multiple language-tagged values.
	Name NaturalLanguageValues `jsonld:"name,omitempty,collapsible"`
	// Attachment identifies a resource attached or related to an object that potentially requires special handling.
	// The intent is to provide a model that is at least semantically similar to attachments in email.
	Attachment Item `jsonld:"attachment,omitempty"`
	// AttributedTo identifies one or more entities to which this object is attributed. The attributed entities might not be Actors.
	// For instance, an object might be attributed to the completion of another activity.
	AttributedTo Item `jsonld:"attributedTo,omitempty"`
	// Audience identifies one or more entities that represent the total population of entities
	// for which the object can considered to be relevant.
	Audience ItemCollection `jsonld:"audience,omitempty"`
	// Content or textual representation of the Activity Pub Object encoded as a JSON string.
	// By default, the value of content is HTML.
	// The mediaType property can be used in the object to indicate a different content type.
	// (The content MAY be expressed using multiple language-tagged values.)
	Content NaturalLanguageValues `jsonld:"content,omitempty,collapsible"`
	// Context identifies the context within which the object exists or an activity was performed.
	// The notion of "context" used is intentionally vague.
	// The intended function is to serve as a means of grouping objects and activities that share a
	// common originating context or purpose. An example could be all activities relating to a common project or event.
	Context Item `jsonld:"context,omitempty"`
	// MediaType when used on an Object, identifies the MIME media type of the value of the content property.
	// If not specified, the content property is assumed to contain text/html content.
	MediaType MimeType `jsonld:"mediaType,omitempty"`
	// EndTime the date and time describing the actual or expected ending time of the object.
	// When used with an Activity object, for instance, the endTime property specifies the moment
	// the activity concluded or is expected to conclude.
	EndTime time.Time `jsonld:"endTime,omitempty"`
	// Generator identifies the entity (e.g. an application) that generated the object.
	Generator Item `jsonld:"generator,omitempty"`
	// Icon indicates an entity that describes an icon for this object.
	// The image should have an aspect ratio of one (horizontal) to one (vertical)
	// and should be suitable for presentation at a small size.
	Icon Item `jsonld:"icon,omitempty"`
	// Image indicates an entity that describes an image for this object.
	// Unlike the icon property, there are no aspect ratio or display size limitations assumed.
	Image Item `jsonld:"image,omitempty"`
	// InReplyTo indicates one or more entities for which this object is considered a response.
	InReplyTo Item `jsonld:"inReplyTo,omitempty"`
	// Location indicates one or more physical or logical locations associated with the object.
	Location Item `jsonld:"location,omitempty"`
	// Preview identifies an entity that provides a preview of this object.
	Preview Item `jsonld:"preview,omitempty"`
	// Published the date and time at which the object was published
	Published time.Time `jsonld:"published,omitempty"`
	// Replies identifies a Collection containing objects considered to be responses to this object.
	Replies Item `jsonld:"replies,omitempty"`
	// StartTime the date and time describing the actual or expected starting time of the object.
	// When used with an Activity object, for instance, the startTime property specifies
	// the moment the activity began or is scheduled to begin.
	StartTime time.Time `jsonld:"startTime,omitempty"`
	// Summary a natural language summarization of the object encoded as HTML.
	// *Multiple language tagged summaries may be provided.)
	Summary NaturalLanguageValues `jsonld:"summary,omitempty,collapsible"`
	// Tag one or more "tags" that have been associated with an objects. A tag can be any kind of Activity Pub Object.
	// The key difference between attachment and tag is that the former implies association by inclusion,
	// while the latter implies associated by reference.
	Tag ItemCollection `jsonld:"tag,omitempty"`
	// Updated the date and time at which the object was updated
	Updated time.Time `jsonld:"updated,omitempty"`
	// URL identifies one or more links to representations of the object
	URL LinkOrIRI `jsonld:"url,omitempty"`
	// To identifies an entity considered to be part of the public primary audience of an Activity Pub Object
	To ItemCollection `jsonld:"to,omitempty"`
	// Bto identifies anActivity Pub Object that is part of the private primary audience of this Activity Pub Object.
	Bto ItemCollection `jsonld:"bto,omitempty"`
	// CC identifies anActivity Pub Object that is part of the public secondary audience of this Activity Pub Object.
	CC ItemCollection `jsonld:"cc,omitempty"`
	// BCC identifies one or more Objects that are part of the private secondary audience of this Activity Pub Object.
	BCC ItemCollection `jsonld:"bcc,omitempty"`
	// Duration when the object describes a time-bound resource, such as an audio or video, a meeting, etc,
	// the duration property indicates the object's approximate duration.
	// The value must be expressed as an xsd:duration as defined by [ xmlschema11-2],
	// section 3.3.6 (e.g. a period of 5 seconds is represented as "PT5S").
	Duration time.Duration `jsonld:"duration,omitempty"`
	// In a paged Collection, indicates the page that contains the most recently updated member items.
	Current ObjectOrLink `jsonld:"current,omitempty"`
	// In a paged Collection, indicates the furthest preceeding page of items in the collection.
	First ObjectOrLink `jsonld:"first,omitempty"`
	// In a paged Collection, indicates the furthest proceeding page of the collection.
	Last ObjectOrLink `jsonld:"last,omitempty"`
	// A non-negative integer specifying the total number of objects contained by the logical view of the collection.
	// This number might not reflect the actual number of items serialized within the Collection object instance.
	TotalItems uint `jsonld:"totalItems"`
	// Identifies the items contained in a collection. The items might be ordered or unordered.
	Items ItemCollection `jsonld:"items,omitempty"`
}

Collection is a subtype of Activity Pub Object that represents ordered or unordered sets of Activity Pub Object or Link instances.

func CollectionNew

func CollectionNew(id ObjectID) *Collection

CollectionNew initializes a new Collection

func ToCollection

func ToCollection(it Item) (*Collection, error)

ToCollection

func (*Collection) Append

func (c *Collection) Append(ob Item) error

Append adds an element to a Collection

func (Collection) Collection

func (c Collection) Collection() ItemCollection

Collection returns the Collection's items

func (Collection) Contains

func (c Collection) Contains(r IRI) bool

Contains verifies if Collection array contains the received one

func (*Collection) Count

func (c *Collection) Count() uint

Count returns the maximum between the length of Items in collection and its TotalItems property

func (Collection) GetID

func (c Collection) GetID() ObjectID

GetID returns the ObjectID corresponding to the Collection object

func (c Collection) GetLink() IRI

GetLink returns the IRI corresponding to the Collection object

func (Collection) GetType

func (c Collection) GetType() ActivityVocabularyType

GetType returns the Collection's type

func (Collection) IsCollection

func (c Collection) IsCollection() bool

IsCollection returns true for Collection objects

func (c Collection) IsLink() bool

IsLink returns false for a Collection object

func (Collection) IsObject

func (c Collection) IsObject() bool

IsObject returns true for a Collection object

func (*Collection) UnmarshalJSON

func (c *Collection) UnmarshalJSON(data []byte) error

UnmarshalJSON

type CollectionInterface

type CollectionInterface interface {
	ObjectOrLink
	Collection() ItemCollection
	Append(ob Item) error
	Count() uint
	Contains(IRI) bool
}

type CollectionPage

type CollectionPage struct {
	// ID provides the globally unique identifier for anActivity Pub Object or Link.
	ID ObjectID `jsonld:"id,omitempty"`
	// Type identifies the Activity Pub Object or Link type. Multiple values may be specified.
	Type ActivityVocabularyType `jsonld:"type,omitempty"`
	// Name a simple, human-readable, plain-text name for the object.
	// HTML markup MUST NOT be included. The name MAY be expressed using multiple language-tagged values.
	Name NaturalLanguageValues `jsonld:"name,omitempty,collapsible"`
	// Attachment identifies a resource attached or related to an object that potentially requires special handling.
	// The intent is to provide a model that is at least semantically similar to attachments in email.
	Attachment Item `jsonld:"attachment,omitempty"`
	// AttributedTo identifies one or more entities to which this object is attributed. The attributed entities might not be Actors.
	// For instance, an object might be attributed to the completion of another activity.
	AttributedTo Item `jsonld:"attributedTo,omitempty"`
	// Audience identifies one or more entities that represent the total population of entities
	// for which the object can considered to be relevant.
	Audience ItemCollection `jsonld:"audience,omitempty"`
	// Content or textual representation of the Activity Pub Object encoded as a JSON string.
	// By default, the value of content is HTML.
	// The mediaType property can be used in the object to indicate a different content type.
	// (The content MAY be expressed using multiple language-tagged values.)
	Content NaturalLanguageValues `jsonld:"content,omitempty,collapsible"`
	// Context identifies the context within which the object exists or an activity was performed.
	// The notion of "context" used is intentionally vague.
	// The intended function is to serve as a means of grouping objects and activities that share a
	// common originating context or purpose. An example could be all activities relating to a common project or event.
	Context Item `jsonld:"context,omitempty"`
	// MediaType when used on an Object, identifies the MIME media type of the value of the content property.
	// If not specified, the content property is assumed to contain text/html content.
	MediaType MimeType `jsonld:"mediaType,omitempty"`
	// EndTime the date and time describing the actual or expected ending time of the object.
	// When used with an Activity object, for instance, the endTime property specifies the moment
	// the activity concluded or is expected to conclude.
	EndTime time.Time `jsonld:"endTime,omitempty"`
	// Generator identifies the entity (e.g. an application) that generated the object.
	Generator Item `jsonld:"generator,omitempty"`
	// Icon indicates an entity that describes an icon for this object.
	// The image should have an aspect ratio of one (horizontal) to one (vertical)
	// and should be suitable for presentation at a small size.
	Icon Item `jsonld:"icon,omitempty"`
	// Image indicates an entity that describes an image for this object.
	// Unlike the icon property, there are no aspect ratio or display size limitations assumed.
	Image Item `jsonld:"image,omitempty"`
	// InReplyTo indicates one or more entities for which this object is considered a response.
	InReplyTo Item `jsonld:"inReplyTo,omitempty"`
	// Location indicates one or more physical or logical locations associated with the object.
	Location Item `jsonld:"location,omitempty"`
	// Preview identifies an entity that provides a preview of this object.
	Preview Item `jsonld:"preview,omitempty"`
	// Published the date and time at which the object was published
	Published time.Time `jsonld:"published,omitempty"`
	// Replies identifies a Collection containing objects considered to be responses to this object.
	Replies Item `jsonld:"replies,omitempty"`
	// StartTime the date and time describing the actual or expected starting time of the object.
	// When used with an Activity object, for instance, the startTime property specifies
	// the moment the activity began or is scheduled to begin.
	StartTime time.Time `jsonld:"startTime,omitempty"`
	// Summary a natural language summarization of the object encoded as HTML.
	// *Multiple language tagged summaries may be provided.)
	Summary NaturalLanguageValues `jsonld:"summary,omitempty,collapsible"`
	// Tag one or more "tags" that have been associated with an objects. A tag can be any kind of Activity Pub Object.
	// The key difference between attachment and tag is that the former implies association by inclusion,
	// while the latter implies associated by reference.
	Tag ItemCollection `jsonld:"tag,omitempty"`
	// Updated the date and time at which the object was updated
	Updated time.Time `jsonld:"updated,omitempty"`
	// URL identifies one or more links to representations of the object
	URL LinkOrIRI `jsonld:"url,omitempty"`
	// To identifies an entity considered to be part of the public primary audience of an Activity Pub Object
	To ItemCollection `jsonld:"to,omitempty"`
	// Bto identifies anActivity Pub Object that is part of the private primary audience of this Activity Pub Object.
	Bto ItemCollection `jsonld:"bto,omitempty"`
	// CC identifies anActivity Pub Object that is part of the public secondary audience of this Activity Pub Object.
	CC ItemCollection `jsonld:"cc,omitempty"`
	// BCC identifies one or more Objects that are part of the private secondary audience of this Activity Pub Object.
	BCC ItemCollection `jsonld:"bcc,omitempty"`
	// Duration when the object describes a time-bound resource, such as an audio or video, a meeting, etc,
	// the duration property indicates the object's approximate duration.
	// The value must be expressed as an xsd:duration as defined by [ xmlschema11-2],
	// section 3.3.6 (e.g. a period of 5 seconds is represented as "PT5S").
	Duration time.Duration `jsonld:"duration,omitempty"`
	// In a paged Collection, indicates the page that contains the most recently updated member items.
	Current ObjectOrLink `jsonld:"current,omitempty"`
	// In a paged Collection, indicates the furthest preceeding page of items in the collection.
	First ObjectOrLink `jsonld:"first,omitempty"`
	// In a paged Collection, indicates the furthest proceeding page of the collection.
	Last ObjectOrLink `jsonld:"last,omitempty"`
	// A non-negative integer specifying the total number of objects contained by the logical view of the collection.
	// This number might not reflect the actual number of items serialized within the Collection object instance.
	TotalItems uint `jsonld:"totalItems"`
	// Identifies the items contained in a collection. The items might be unordered.
	Items ItemCollection `jsonld:"items,omitempty"`
	// Identifies the Collection to which a CollectionPage objects items belong.
	PartOf Item `jsonld:"partOf,omitempty"`
	// In a paged Collection, indicates the next page of items.
	Next Item `jsonld:"next,omitempty"`
	// In a paged Collection, identifies the previous page of items.
	Prev Item `jsonld:"prev,omitempty"`
}

CollectionPage is a Collection that contains a large number of items and when it becomes impractical for an implementation to serialize every item contained by a Collection using the items property alone. In such cases, the items within a Collection can be divided into distinct subsets or "pages".

func CollectionPageNew

func CollectionPageNew(parent CollectionInterface) *CollectionPage

CollectionNew initializes a new CollectionPage

func ToCollectionPage

func ToCollectionPage(it Item) (*CollectionPage, error)

ToCollectionPage

func (*CollectionPage) Append

func (c *CollectionPage) Append(ob Item) error

Append adds an element to a CollectionPage

func (CollectionPage) Collection

func (c CollectionPage) Collection() ItemCollection

Collection returns the ColleCollectionPagection items

func (CollectionPage) Contains

func (c CollectionPage) Contains(r IRI) bool

Contains verifies if CollectionPage array contains the received one

func (*CollectionPage) Count

func (c *CollectionPage) Count() uint

Count returns the maximum between the length of Items in the collection page and its TotalItems property

func (CollectionPage) GetID

func (c CollectionPage) GetID() ObjectID

GetID returns the ObjectID corresponding to the CollectionPage object

func (c CollectionPage) GetLink() IRI

GetLink returns the IRI corresponding to the CollectionPage object

func (CollectionPage) GetType

GetType returns the CollectionPage's type

func (CollectionPage) IsCollection

func (c CollectionPage) IsCollection() bool

IsCollection returns true for CollectionPage objects

func (c CollectionPage) IsLink() bool

IsLink returns false for a CollectionPage object

func (CollectionPage) IsObject

func (c CollectionPage) IsObject() bool

IsObject returns true for a CollectionPage object

func (*CollectionPage) UnmarshalJSON

func (c *CollectionPage) UnmarshalJSON(data []byte) error

UnmarshalJSON

type Create

type Create = Activity

Create indicates that the actor has created the object.

func CreateNew

func CreateNew(id ObjectID, ob Item) *Create

CreateNew initializes a Create activity

type Delete

type Delete = Activity

Delete indicates that the actor has deleted the object. If specified, the origin indicates the context from which the object was deleted.

func DeleteNew

func DeleteNew(id ObjectID, ob Item) *Delete

DeleteNew initializes a Delete activity

type Dislike

type Dislike = Activity

Dislike indicates that the actor dislikes the object.

func DislikeNew

func DislikeNew(id ObjectID, ob Item) *Dislike

DislikeNew initializes a Dislike activity

type Document

type Document = Object

Document represents a document of any kind.

type Event

type Event = Object

Event represents any kind of event.

type Flag

type Flag = Activity

Flag indicates that the actor is "flagging" the object. Flagging is defined in the sense common to many social platforms as reporting content as being inappropriate for any number of reasons.

func FlagNew

func FlagNew(id ObjectID, ob Item) *Flag

FlagNew initializes a Flag activity

type Follow

type Follow = Activity

Follow indicates that the actor is "following" the object. Following is defined in the sense typically used within Social systems in which the actor is interested in any activity performed by or on the object. The target and origin typically have no defined meaning.

func FollowNew

func FollowNew(id ObjectID, ob Item) *Follow

FollowNew initializes a Follow activity

type Group

type Group = Object

Group represents a formal or informal collective of Actors.

func GroupNew

func GroupNew(id ObjectID) *Group

GroupNew initializes a Group type actor

type HasRecipients

type HasRecipients interface {
	// Recipients is a method that should do a recipients de-duplication step and then return
	// the remaining recipients
	Recipients() ItemCollection
	Clean()
}

HasRecipients is an interface implemented by activities to return their audience for further propagation

type IRI

type IRI string

IRI is a Internationalized Resource Identifiers (IRIs) RFC3987

func JSONGetIRI

func JSONGetIRI(data []byte, prop string) IRI

func (IRI) Contains

func (i IRI) Contains(what IRI, checkScheme bool) bool

func (IRI) Equals

func (i IRI) Equals(with IRI, checkScheme bool) bool

Equals verifies if our receiver IRI is equals with the "with" IRI It ignores the protocol It tries to use the URL representation if possible and fallback to string comparison if unable to convert In URL representation checks hostname in a case insensitive way and the path and

func (IRI) GetID

func (i IRI) GetID() ObjectID

GetID

func (i IRI) GetLink() IRI

GetLink

func (IRI) GetType

func (i IRI) GetType() ActivityVocabularyType

GetType

func (IRI) IsCollection

func (i IRI) IsCollection() bool

IsCollection returns false for IRI objects

func (i IRI) IsLink() bool

IsLink

func (IRI) IsObject

func (i IRI) IsObject() bool

IsObject

func (IRI) String

func (i IRI) String() string

String returns the String value of the IRI object

func (IRI) URL

func (i IRI) URL() (*url.URL, error)

URL

func (*IRI) UnmarshalJSON

func (i *IRI) UnmarshalJSON(s []byte) error

UnmarshalJSON

type IRIs

type IRIs []IRI

func (IRIs) Contains

func (i IRIs) Contains(r IRI) bool

Contains verifies if IRIs array contains the received one

type Ignore

type Ignore = Activity

Ignore indicates that the actor is ignoring the object. The target and origin typically have no defined meaning.

func IgnoreNew

func IgnoreNew(id ObjectID, ob Item) *Ignore

IgnoreNew initializes an Ignore activity

type Image

type Image = Document

Image An image document of any kind

type IntransitiveActivity

type IntransitiveActivity struct {
	// ID provides the globally unique identifier for anActivity Pub Object or Link.
	ID ObjectID `jsonld:"id,omitempty"`
	// Type identifies the Activity Pub Object or Link type. Multiple values may be specified.
	Type ActivityVocabularyType `jsonld:"type,omitempty"`
	// Name a simple, human-readable, plain-text name for the object.
	// HTML markup MUST NOT be included. The name MAY be expressed using multiple language-tagged values.
	Name NaturalLanguageValues `jsonld:"name,omitempty,collapsible"`
	// Attachment identifies a resource attached or related to an object that potentially requires special handling.
	// The intent is to provide a model that is at least semantically similar to attachments in email.
	Attachment Item `jsonld:"attachment,omitempty"`
	// AttributedTo identifies one or more entities to which this object is attributed. The attributed entities might not be Actors.
	// For instance, an object might be attributed to the completion of another activity.
	AttributedTo Item `jsonld:"attributedTo,omitempty"`
	// Audience identifies one or more entities that represent the total population of entities
	// for which the object can considered to be relevant.
	Audience ItemCollection `jsonld:"audience,omitempty"`
	// Content or textual representation of the Activity Pub Object encoded as a JSON string.
	// By default, the value of content is HTML.
	// The mediaType property can be used in the object to indicate a different content type.
	// (The content MAY be expressed using multiple language-tagged values.)
	Content NaturalLanguageValues `jsonld:"content,omitempty,collapsible"`
	// Context identifies the context within which the object exists or an activity was performed.
	// The notion of "context" used is intentionally vague.
	// The intended function is to serve as a means of grouping objects and activities that share a
	// common originating context or purpose. An example could be all activities relating to a common project or event.
	Context Item `jsonld:"context,omitempty"`
	// MediaType when used on an Object, identifies the MIME media type of the value of the content property.
	// If not specified, the content property is assumed to contain text/html content.
	MediaType MimeType `jsonld:"mediaType,omitempty"`
	// EndTime the date and time describing the actual or expected ending time of the object.
	// When used with an Activity object, for instance, the endTime property specifies the moment
	// the activity concluded or is expected to conclude.
	EndTime time.Time `jsonld:"endTime,omitempty"`
	// Generator identifies the entity (e.g. an application) that generated the object.
	Generator Item `jsonld:"generator,omitempty"`
	// Icon indicates an entity that describes an icon for this object.
	// The image should have an aspect ratio of one (horizontal) to one (vertical)
	// and should be suitable for presentation at a small size.
	Icon Item `jsonld:"icon,omitempty"`
	// Image indicates an entity that describes an image for this object.
	// Unlike the icon property, there are no aspect ratio or display size limitations assumed.
	Image Item `jsonld:"image,omitempty"`
	// InReplyTo indicates one or more entities for which this object is considered a response.
	InReplyTo Item `jsonld:"inReplyTo,omitempty"`
	// Location indicates one or more physical or logical locations associated with the object.
	Location Item `jsonld:"location,omitempty"`
	// Preview identifies an entity that provides a preview of this object.
	Preview Item `jsonld:"preview,omitempty"`
	// Published the date and time at which the object was published
	Published time.Time `jsonld:"published,omitempty"`
	// Replies identifies a Collection containing objects considered to be responses to this object.
	Replies Item `jsonld:"replies,omitempty"`
	// StartTime the date and time describing the actual or expected starting time of the object.
	// When used with an Activity object, for instance, the startTime property specifies
	// the moment the activity began or is scheduled to begin.
	StartTime time.Time `jsonld:"startTime,omitempty"`
	// Summary a natural language summarization of the object encoded as HTML.
	// *Multiple language tagged summaries may be provided.)
	Summary NaturalLanguageValues `jsonld:"summary,omitempty,collapsible"`
	// Tag one or more "tags" that have been associated with an objects. A tag can be any kind of Activity Pub Object.
	// The key difference between attachment and tag is that the former implies association by inclusion,
	// while the latter implies associated by reference.
	Tag ItemCollection `jsonld:"tag,omitempty"`
	// Updated the date and time at which the object was updated
	Updated time.Time `jsonld:"updated,omitempty"`
	// URL identifies one or more links to representations of the object
	URL LinkOrIRI `jsonld:"url,omitempty"`
	// To identifies an entity considered to be part of the public primary audience of an Activity Pub Object
	To ItemCollection `jsonld:"to,omitempty"`
	// Bto identifies anActivity Pub Object that is part of the private primary audience of this Activity Pub Object.
	Bto ItemCollection `jsonld:"bto,omitempty"`
	// CC identifies anActivity Pub Object that is part of the public secondary audience of this Activity Pub Object.
	CC ItemCollection `jsonld:"cc,omitempty"`
	// BCC identifies one or more Objects that are part of the private secondary audience of this Activity Pub Object.
	BCC ItemCollection `jsonld:"bcc,omitempty"`
	// Duration when the object describes a time-bound resource, such as an audio or video, a meeting, etc,
	// the duration property indicates the object's approximate duration.
	// The value must be expressed as an xsd:duration as defined by [ xmlschema11-2],
	// section 3.3.6 (e.g. a period of 5 seconds is represented as "PT5S").
	Duration time.Duration `jsonld:"duration,omitempty"`
	// Actor describes one or more entities that either performed or are expected to perform the activity.
	// Any single activity can have multiple actors. The actor may be specified using an indirect Link.
	Actor Actor `jsonld:"actor,omitempty"`
	// Target describes the indirect object, or target, of the activity.
	// The precise meaning of the target is largely dependent on the type of action being described
	// but will often be the object of the English preposition "to".
	// For instance, in the activity "John added a movie to his wishlist",
	// the target of the activity is John's wishlist. An activity can have more than one target.
	Target Item `jsonld:"target,omitempty"`
	// Result describes the result of the activity. For instance, if a particular action results in the creation
	// of a new resource, the result property can be used to describe that new resource.
	Result Item `jsonld:"result,omitempty"`
	// Origin describes an indirect object of the activity from which the activity is directed.
	// The precise meaning of the origin is the object of the English preposition "from".
	// For instance, in the activity "John moved an item to List B from List A", the origin of the activity is "List A".
	Origin Item `jsonld:"origin,omitempty"`
	// Instrument identifies one or more objects used (or to be used) in the completion of an Activity.
	Instrument Item `jsonld:"instrument,omitempty"`
}

IntransitiveActivity Instances of IntransitiveActivity are a subtype of Activity representing intransitive actions. The object property is therefore inappropriate for these activities.

func FlattenIntransitiveActivityProperties

func FlattenIntransitiveActivityProperties(act *IntransitiveActivity) *IntransitiveActivity

FlattenIntransitiveActivityProperties flattens the IntransitiveActivity's properties from Object type to IRI

func IntransitiveActivityNew

func IntransitiveActivityNew(id ObjectID, typ ActivityVocabularyType) *IntransitiveActivity

IntransitiveActivityNew initializes a intransitive activity

func ToIntransitiveActivity

func ToIntransitiveActivity(it Item) (*IntransitiveActivity, error)

ToIntransitiveActivity

func (*IntransitiveActivity) Clean

func (i *IntransitiveActivity) Clean()

Clean removes Bto and BCC properties

func (IntransitiveActivity) GetID

func (i IntransitiveActivity) GetID() ObjectID

GetID returns the ObjectID corresponding to the IntransitiveActivity object

func (i IntransitiveActivity) GetLink() IRI

GetLink returns the IRI corresponding to the IntransitiveActivity object

func (IntransitiveActivity) GetType

GetType returns the ActivityVocabulary type of the current Intransitive Activity

func (IntransitiveActivity) IsCollection

func (i IntransitiveActivity) IsCollection() bool

IsCollection returns false for IntransitiveActivity objects

func (i IntransitiveActivity) IsLink() bool

IsLink returns false for Activity objects

func (IntransitiveActivity) IsObject

func (i IntransitiveActivity) IsObject() bool

IsObject returns true for IntransitiveActivity objects

func (*IntransitiveActivity) Recipients

func (i *IntransitiveActivity) Recipients() ItemCollection

Recipients performs recipient de-duplication on the Activity's To, Bto, CC and BCC properties

func (*IntransitiveActivity) UnmarshalJSON

func (i *IntransitiveActivity) UnmarshalJSON(data []byte) error

UnmarshalJSON

type Invite

type Invite = Offer

Invite is a specialization of Offer in which the actor is extending an invitation for the object to the target.

func InviteNew

func InviteNew(id ObjectID, ob Item) *Invite

InviteNew initializes an Invite activity

type Item

type Item ObjectOrLink

Item struct

func Flatten

func Flatten(it Item) Item

Flatten checks if Item can be flatten to an IRI or array of IRIs and returns it if so

func FlattenProperties

func FlattenProperties(it Item) Item

FlattenProperties flattens the Item's properties from Object types to IRI

func FlattenToIRI

func FlattenToIRI(it Item) Item

FlattenToIRI checks if Item can be flatten to an IRI and returns it if so

func JSONGetItem

func JSONGetItem(data []byte, prop string) Item

func JSONGetItemByType

func JSONGetItemByType(typ ActivityVocabularyType) (Item, error)

func JSONGetURIItem

func JSONGetURIItem(data []byte, prop string) Item

func JSONUnmarshalToItem

func JSONUnmarshalToItem(data []byte) Item

func UnmarshalJSON

func UnmarshalJSON(data []byte) (Item, error)

UnmarshalJSON tries to detect the type of the object in the json data and then outputs a matching ActivityStreams object, if possible

type ItemCollection

type ItemCollection []Item

ItemCollection represents an array of items

func FlattenItemCollection

func FlattenItemCollection(c ItemCollection) ItemCollection

FlattenItemCollection flattens the Collection's properties from Object type to IRI

func ItemCollectionDeduplication

func ItemCollectionDeduplication(recCols ...*ItemCollection) (ItemCollection, error)

ItemCollectionDeduplication normalizes the received arguments lists into a single unified one

func JSONGetItems

func JSONGetItems(data []byte, prop string) ItemCollection

func ToItemCollection

func ToItemCollection(it Item) (*ItemCollection, error)

ToItemCollection

func (*ItemCollection) Append

func (i *ItemCollection) Append(o Item) error

Append facilitates adding elements to Item arrays and ensures ItemCollection implements the Collection interface

func (*ItemCollection) Collection

func (i *ItemCollection) Collection() ItemCollection

Collection returns the current object as collection interface

func (ItemCollection) Contains

func (i ItemCollection) Contains(r IRI) bool

Contains verifies if IRIs array contains the received one

func (*ItemCollection) Count

func (i *ItemCollection) Count() uint

Count returns the length of Items in the item collection

func (ItemCollection) First

func (i ItemCollection) First() Item

First returns the ObjectID corresponding to ItemCollection

func (ItemCollection) GetID

func (i ItemCollection) GetID() ObjectID

GetID returns the ObjectID corresponding to ItemCollection

func (i ItemCollection) GetLink() IRI

GetLink returns the empty IRI

func (ItemCollection) GetType

GetType returns the ItemCollection's type

func (ItemCollection) IsCollection

func (i ItemCollection) IsCollection() bool

IsCollection returns true for ItemCollection arrays

func (i ItemCollection) IsLink() bool

IsLink returns false for an ItemCollection object

func (ItemCollection) IsObject

func (i ItemCollection) IsObject() bool

IsObject returns true for a ItemCollection object

type Join

type Join = Activity

Join indicates that the actor has joined the object. The target and origin typically have no defined meaning.

func JoinNew

func JoinNew(id ObjectID, ob Item) *Join

JoinNew initializes a Join activity

type LangRef

type LangRef string

LangRef is the type for a language reference code, should be an ISO639-1 language specifier.

const (
	NilLangRef LangRef = "-"
)

func JSONGetLangRefField

func JSONGetLangRefField(data []byte, prop string) LangRef

func (*LangRef) UnmarshalJSON

func (l *LangRef) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the JsonEncoder interface

func (*LangRef) UnmarshalText

func (l *LangRef) UnmarshalText(data []byte) error

UnmarshalText implements the TextEncoder interface

type LangRefValue

type LangRefValue struct {
	Ref   LangRef
	Value string
}

LangRefValue is a type for storing per language values

func (LangRefValue) MarshalJSON

func (l LangRefValue) MarshalJSON() ([]byte, error)

MarshalJSON serializes the LangRefValue into JSON

func (LangRefValue) MarshalText

func (l LangRefValue) MarshalText() ([]byte, error)

MarshalText serializes the LangRefValue into JSON

func (LangRefValue) String

func (l LangRefValue) String() string

String adds support for Stringer interface. It returns the Value[LangRef] text or just Value if LangRef is NIL

func (*LangRefValue) UnmarshalJSON

func (l *LangRefValue) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the JsonEncoder interface

func (*LangRefValue) UnmarshalText

func (l *LangRefValue) UnmarshalText(data []byte) error

UnmarshalText implements the TextEncoder interface

type Leave

type Leave = Activity

Leave indicates that the actor has left the object. The target and origin typically have no meaning.

func LeaveNew

func LeaveNew(id ObjectID, ob Item) *Leave

LeaveNew initializes a Leave activity

type Like

type Like = Activity

Like indicates that the actor likes, recommends or endorses the object. The target and origin typically have no defined meaning.

func LikeNew

func LikeNew(id ObjectID, ob Item) *Like

LikeNew initializes a Like activity

type Link struct {
	// Provides the globally unique identifier for an APObject or Link.
	ID ObjectID `jsonld:"id,omitempty"`
	// Identifies the APObject or Link type. Multiple values may be specified.
	Type ActivityVocabularyType `jsonld:"type,omitempty"`
	// A simple, human-readable, plain-text name for the object.
	// HTML markup MUST NOT be included. The name MAY be expressed using multiple language-tagged values.
	Name NaturalLanguageValues `jsonld:"name,omitempty,collapsible"`
	// A link relation associated with a Link. The value must conform to both the [HTML5] and
	// [RFC5988](https://tools.ietf.org/html/rfc5988) "link relation" definitions.
	// In the [HTML5], any string not containing the "space" U+0020, "tab" (U+0009), "LF" (U+000A),
	// "FF" (U+000C), "CR" (U+000D) or "," (U+002C) characters can be used as a valid link relation.
	Rel IRI `jsonld:"rel,omitempty"`
	// When used on a Link, identifies the MIME media type of the referenced resource.
	MediaType MimeType `jsonld:"mediaType,omitempty"`
	// On a Link, specifies a hint as to the rendering height in device-independent pixels of the linked resource.
	Height uint `jsonld:"height,omitempty"`
	// On a Link, specifies a hint as to the rendering width in device-independent pixels of the linked resource.
	Width uint `jsonld:"width,omitempty"`
	// Identifies an entity that provides a preview of this object.
	Preview Item `jsonld:"preview,omitempty"`
	// The target resource pointed to by a Link.
	Href IRI `jsonld:"href,omitempty"`
	// Hints as to the language used by the target resource.
	// Value must be a [BCP47](https://tools.ietf.org/html/bcp47) Language-Tag.
	HrefLang LangRef `jsonld:"hrefLang,omitempty"`
}

A Link is an indirect, qualified reference to a resource identified by a URL. The fundamental model for links is established by [ RFC5988]. Many of the properties defined by the Activity Vocabulary allow values that are either instances of APObject or Link. When a Link is used, it establishes a qualified relation connecting the subject (the containing object) to the resource identified by the href. Properties of the Link are properties of the reference as opposed to properties of the resource.

func LinkNew

func LinkNew(id ObjectID, typ ActivityVocabularyType) *Link

LinkNew initializes a new Link

func (Link) GetID

func (l Link) GetID() ObjectID

GetID returns the ObjectID corresponding to the Link object

func (l Link) GetLink() IRI

GetLink returns the IRI corresponding to the current Link

func (Link) GetType

func (l Link) GetType() ActivityVocabularyType

GetType returns the Type corresponding to the Mention object

func (Link) IsCollection

func (l Link) IsCollection() bool

IsCollection returns false for Link objects

func (l Link) IsLink() bool

IsLink validates if current Link is a Link

func (Link) IsObject

func (l Link) IsObject() bool

IsObject validates if current Link is an GetID

func (*Link) UnmarshalJSON

func (l *Link) UnmarshalJSON(data []byte) error

UnmarshalJSON

type LinkOrIRI

type LinkOrIRI interface {
	// GetLink returns the object id in IRI type
	GetLink() IRI
}

LinkOrIRI is an interface that Object and Link structs implement, and at the same time they are kept disjointed

type Listen

type Listen = Activity

Listen inherits all properties from Activity.

func ListenNew

func ListenNew(id ObjectID, ob Item) *Listen

ListenNew initializes a Listen activity

type Mapper

type Mapper interface {
	// FromActivityStreams maps an ActivityStreams object to another struct representation
	FromActivityStreams(Item) error
}

Mapper interface allows external objects to implement their own mechanism for loading information from an ActivityStreams vocabulary object

type Mention

type Mention = Link

Mention is a specialized Link that represents an @mention.

func MentionNew

func MentionNew(id ObjectID) *Mention

MentionNew initializes a new Mention

type MimeType

type MimeType string

MimeType is the type for representing MIME types in certain ActivityStreams properties

func JSONGetMimeType

func JSONGetMimeType(data []byte) MimeType

func (*MimeType) UnmarshalJSON

func (c *MimeType) UnmarshalJSON(data []byte) error

UnmarshalJSON

type Move

type Move = Activity

Move indicates that the actor has moved object from origin to target. If the origin or target are not specified, either can be determined by context.

func MoveNew

func MoveNew(id ObjectID, ob Item) *Move

MoveNew initializes a Move activity

type NaturalLanguageValues

type NaturalLanguageValues []LangRefValue

NaturalLanguageValues is a mapping for multiple language values

func JSONGetNaturalLanguageField

func JSONGetNaturalLanguageField(data []byte, prop string) NaturalLanguageValues

func NaturalLanguageValuesNew

func NaturalLanguageValuesNew() NaturalLanguageValues

func (*NaturalLanguageValues) Append

func (n *NaturalLanguageValues) Append(lang LangRef, value string) error

Append is syntactic sugar for resizing the NaturalLanguageValues map and appending an element

func (*NaturalLanguageValues) Count

func (n *NaturalLanguageValues) Count() uint

Count returns the length of Items in the item collection

func (NaturalLanguageValues) First

First returns the first element in the array

func (NaturalLanguageValues) Get

func (NaturalLanguageValues) MarshalJSON

func (n NaturalLanguageValues) MarshalJSON() ([]byte, error)

MarshalJSON serializes the NaturalLanguageValues into JSON

func (NaturalLanguageValues) MarshalText

func (n NaturalLanguageValues) MarshalText() ([]byte, error)

MarshalText serializes the NaturalLanguageValues into Text

func (*NaturalLanguageValues) Set

func (n *NaturalLanguageValues) Set(ref LangRef, v string) error

Set sets a language, value pair in a NaturalLanguageValues array

func (NaturalLanguageValues) String

func (n NaturalLanguageValues) String() string

func (*NaturalLanguageValues) UnmarshalJSON

func (n *NaturalLanguageValues) UnmarshalJSON(data []byte) error

UnmarshalJSON tries to load the NaturalLanguage array from the incoming json value

func (*NaturalLanguageValues) UnmarshalText

func (n *NaturalLanguageValues) UnmarshalText(data []byte) error

UnmarshalText tries to load the NaturalLanguage array from the incoming Text value

type Note

type Note = Object

Note represents a short written work typically less than a single paragraph in length.

type Object

type Object struct {
	// ID provides the globally unique identifier for anActivity Pub Object or Link.
	ID ObjectID `jsonld:"id,omitempty"`
	// Type identifies the Activity Pub Object or Link type. Multiple values may be specified.
	Type ActivityVocabularyType `jsonld:"type,omitempty"`
	// Name a simple, human-readable, plain-text name for the object.
	// HTML markup MUST NOT be included. The name MAY be expressed using multiple language-tagged values.
	Name NaturalLanguageValues `jsonld:"name,omitempty,collapsible"`
	// Attachment identifies a resource attached or related to an object that potentially requires special handling.
	// The intent is to provide a model that is at least semantically similar to attachments in email.
	Attachment Item `jsonld:"attachment,omitempty"`
	// AttributedTo identifies one or more entities to which this object is attributed. The attributed entities might not be Actors.
	// For instance, an object might be attributed to the completion of another activity.
	AttributedTo Item `jsonld:"attributedTo,omitempty"`
	// Audience identifies one or more entities that represent the total population of entities
	// for which the object can considered to be relevant.
	Audience ItemCollection `jsonld:"audience,omitempty"`
	// Content or textual representation of the Activity Pub Object encoded as a JSON string.
	// By default, the value of content is HTML.
	// The mediaType property can be used in the object to indicate a different content type.
	// (The content MAY be expressed using multiple language-tagged values.)
	Content NaturalLanguageValues `jsonld:"content,omitempty,collapsible"`
	// Context identifies the context within which the object exists or an activity was performed.
	// The notion of "context" used is intentionally vague.
	// The intended function is to serve as a means of grouping objects and activities that share a
	// common originating context or purpose. An example could be all activities relating to a common project or event.
	Context Item `jsonld:"context,omitempty"`
	// MediaType when used on an Object, identifies the MIME media type of the value of the content property.
	// If not specified, the content property is assumed to contain text/html content.
	MediaType MimeType `jsonld:"mediaType,omitempty"`
	// EndTime the date and time describing the actual or expected ending time of the object.
	// When used with an Activity object, for instance, the endTime property specifies the moment
	// the activity concluded or is expected to conclude.
	EndTime time.Time `jsonld:"endTime,omitempty"`
	// Generator identifies the entity (e.g. an application) that generated the object.
	Generator Item `jsonld:"generator,omitempty"`
	// Icon indicates an entity that describes an icon for this object.
	// The image should have an aspect ratio of one (horizontal) to one (vertical)
	// and should be suitable for presentation at a small size.
	Icon Item `jsonld:"icon,omitempty"`
	// Image indicates an entity that describes an image for this object.
	// Unlike the icon property, there are no aspect ratio or display size limitations assumed.
	Image Item `jsonld:"image,omitempty"`
	// InReplyTo indicates one or more entities for which this object is considered a response.
	InReplyTo Item `jsonld:"inReplyTo,omitempty"`
	// Location indicates one or more physical or logical locations associated with the object.
	Location Item `jsonld:"location,omitempty"`
	// Preview identifies an entity that provides a preview of this object.
	Preview Item `jsonld:"preview,omitempty"`
	// Published the date and time at which the object was published
	Published time.Time `jsonld:"published,omitempty"`
	// Replies identifies a Collection containing objects considered to be responses to this object.
	Replies Item `jsonld:"replies,omitempty"`
	// StartTime the date and time describing the actual or expected starting time of the object.
	// When used with an Activity object, for instance, the startTime property specifies
	// the moment the activity began or is scheduled to begin.
	StartTime time.Time `jsonld:"startTime,omitempty"`
	// Summary a natural language summarization of the object encoded as HTML.
	// *Multiple language tagged summaries may be provided.)
	Summary NaturalLanguageValues `jsonld:"summary,omitempty,collapsible"`
	// Tag one or more "tags" that have been associated with an objects. A tag can be any kind of Activity Pub Object.
	// The key difference between attachment and tag is that the former implies association by inclusion,
	// while the latter implies associated by reference.
	Tag ItemCollection `jsonld:"tag,omitempty"`
	// Updated the date and time at which the object was updated
	Updated time.Time `jsonld:"updated,omitempty"`
	// URL identifies one or more links to representations of the object
	URL LinkOrIRI `jsonld:"url,omitempty"`
	// To identifies an entity considered to be part of the public primary audience of an Activity Pub Object
	To ItemCollection `jsonld:"to,omitempty"`
	// Bto identifies anActivity Pub Object that is part of the private primary audience of this Activity Pub Object.
	Bto ItemCollection `jsonld:"bto,omitempty"`
	// CC identifies anActivity Pub Object that is part of the public secondary audience of this Activity Pub Object.
	CC ItemCollection `jsonld:"cc,omitempty"`
	// BCC identifies one or more Objects that are part of the private secondary audience of this Activity Pub Object.
	BCC ItemCollection `jsonld:"bcc,omitempty"`
	// Duration when the object describes a time-bound resource, such as an audio or video, a meeting, etc,
	// the duration property indicates the object's approximate duration.
	// The value must be expressed as an xsd:duration as defined by [ xmlschema11-2],
	// section 3.3.6 (e.g. a period of 5 seconds is represented as "PT5S").
	Duration time.Duration `jsonld:"duration,omitempty"`
}

Describes an object of any kind. The Activity Pub Object type serves as the base type for most of the other kinds of objects defined in the Activity Vocabulary, including other Core types such as Activity, IntransitiveActivity, Collection and OrderedCollection.

func ActorNew

func ActorNew(id ObjectID, typ ActivityVocabularyType) *Object

ActorNew initializes an Actor type actor

func FlattenObjectProperties

func FlattenObjectProperties(o *Object) *Object

FlattenObjectProperties flattens the Object's properties from Object types to IRI

func ObjectNew

func ObjectNew(typ ActivityVocabularyType) *Object

ObjectNew initializes a new Object

func ToObject

func ToObject(it Item) (*Object, error)

ToObject returns an Object pointer to the data in the current Item It relies on the fact that all the types in this package have a data layout compatible with Object.

func (*Object) Clean

func (o *Object) Clean()

Clean removes Bto and BCC properties

func (Object) GetID

func (o Object) GetID() ObjectID

GetID returns the ObjectID corresponding to the current Object

func (o Object) GetLink() IRI

GetLink returns the IRI corresponding to the current Object

func (Object) GetType

func (o Object) GetType() ActivityVocabularyType

GetType returns the type of the current Object

func (Object) IsCollection

func (o Object) IsCollection() bool

IsCollection returns false for Object objects

func (o Object) IsLink() bool

IsLink validates if currentActivity Pub Object is a Link

func (Object) IsObject

func (o Object) IsObject() bool

IsObject validates if currentActivity Pub Object is an Object

func (*Object) Recipients

func (o *Object) Recipients() ItemCollection

Recipients performs recipient de-duplication on the Object's To, Bto, CC and BCC properties

func (*Object) UnmarshalJSON

func (o *Object) UnmarshalJSON(data []byte) error

UnmarshalJSON

type ObjectID

type ObjectID IRI

ObjectID designates an unique global identifier. All Objects in [ActivityStreams] should have unique global identifiers. ActivityPub extends this requirement; all objects distributed by the ActivityPub protocol MUST have unique global identifiers, unless they are intentionally transient (short lived activities that are not intended to be able to be looked up, such as some kinds of chat messages or game notifications). These identifiers must fall into one of the following groups:

1. Publicly dereferenceable URIs, such as HTTPS URIs, with their authority belonging to that of their originating server. (Publicly facing content SHOULD use HTTPS URIs). 2. An ID explicitly specified as the JSON null object, which implies an anonymous object (a part of its parent context)

func JSONGetObjectID

func JSONGetObjectID(data []byte) ObjectID

func (*ObjectID) IsValid

func (i *ObjectID) IsValid() bool

func (*ObjectID) UnmarshalJSON

func (i *ObjectID) UnmarshalJSON(data []byte) error

UnmarshalJSON

type ObjectOrLink interface {
	ActivityObject
	LinkOrIRI
	// IsLink shows if current item represents a Link object or an IRI
	IsLink() bool
	// IsObject shows if current item represents an ActivityStreams object
	IsObject() bool
	// IsCollection shows if the current item represents an ItemCollection
	IsCollection() bool
}

Item describes the requirements of an ActivityStreams object

type Offer

type Offer = Activity

Offer indicates that the actor is offering the object. If specified, the target indicates the entity to which the object is being offered.

func OfferNew

func OfferNew(id ObjectID, ob Item) *Offer

OfferNew initializes an Offer activity

type OrderedCollection

type OrderedCollection struct {
	// ID provides the globally unique identifier for anActivity Pub Object or Link.
	ID ObjectID `jsonld:"id,omitempty"`
	// Type identifies the Activity Pub Object or Link type. Multiple values may be specified.
	Type ActivityVocabularyType `jsonld:"type,omitempty"`
	// Name a simple, human-readable, plain-text name for the object.
	// HTML markup MUST NOT be included. The name MAY be expressed using multiple language-tagged values.
	Name NaturalLanguageValues `jsonld:"name,omitempty,collapsible"`
	// Attachment identifies a resource attached or related to an object that potentially requires special handling.
	// The intent is to provide a model that is at least semantically similar to attachments in email.
	Attachment Item `jsonld:"attachment,omitempty"`
	// AttributedTo identifies one or more entities to which this object is attributed. The attributed entities might not be Actors.
	// For instance, an object might be attributed to the completion of another activity.
	AttributedTo Item `jsonld:"attributedTo,omitempty"`
	// Audience identifies one or more entities that represent the total population of entities
	// for which the object can considered to be relevant.
	Audience ItemCollection `jsonld:"audience,omitempty"`
	// Content or textual representation of the Activity Pub Object encoded as a JSON string.
	// By default, the value of content is HTML.
	// The mediaType property can be used in the object to indicate a different content type.
	// (The content MAY be expressed using multiple language-tagged values.)
	Content NaturalLanguageValues `jsonld:"content,omitempty,collapsible"`
	// Context identifies the context within which the object exists or an activity was performed.
	// The notion of "context" used is intentionally vague.
	// The intended function is to serve as a means of grouping objects and activities that share a
	// common originating context or purpose. An example could be all activities relating to a common project or event.
	Context Item `jsonld:"context,omitempty"`
	// MediaType when used on an Object, identifies the MIME media type of the value of the content property.
	// If not specified, the content property is assumed to contain text/html content.
	MediaType MimeType `jsonld:"mediaType,omitempty"`
	// EndTime the date and time describing the actual or expected ending time of the object.
	// When used with an Activity object, for instance, the endTime property specifies the moment
	// the activity concluded or is expected to conclude.
	EndTime time.Time `jsonld:"endTime,omitempty"`
	// Generator identifies the entity (e.g. an application) that generated the object.
	Generator Item `jsonld:"generator,omitempty"`
	// Icon indicates an entity that describes an icon for this object.
	// The image should have an aspect ratio of one (horizontal) to one (vertical)
	// and should be suitable for presentation at a small size.
	Icon Item `jsonld:"icon,omitempty"`
	// Image indicates an entity that describes an image for this object.
	// Unlike the icon property, there are no aspect ratio or display size limitations assumed.
	Image Item `jsonld:"image,omitempty"`
	// InReplyTo indicates one or more entities for which this object is considered a response.
	InReplyTo Item `jsonld:"inReplyTo,omitempty"`
	// Location indicates one or more physical or logical locations associated with the object.
	Location Item `jsonld:"location,omitempty"`
	// Preview identifies an entity that provides a preview of this object.
	Preview Item `jsonld:"preview,omitempty"`
	// Published the date and time at which the object was published
	Published time.Time `jsonld:"published,omitempty"`
	// Replies identifies a Collection containing objects considered to be responses to this object.
	Replies Item `jsonld:"replies,omitempty"`
	// StartTime the date and time describing the actual or expected starting time of the object.
	// When used with an Activity object, for instance, the startTime property specifies
	// the moment the activity began or is scheduled to begin.
	StartTime time.Time `jsonld:"startTime,omitempty"`
	// Summary a natural language summarization of the object encoded as HTML.
	// *Multiple language tagged summaries may be provided.)
	Summary NaturalLanguageValues `jsonld:"summary,omitempty,collapsible"`
	// Tag one or more "tags" that have been associated with an objects. A tag can be any kind of Activity Pub Object.
	// The key difference between attachment and tag is that the former implies association by inclusion,
	// while the latter implies associated by reference.
	Tag ItemCollection `jsonld:"tag,omitempty"`
	// Updated the date and time at which the object was updated
	Updated time.Time `jsonld:"updated,omitempty"`
	// URL identifies one or more links to representations of the object
	URL LinkOrIRI `jsonld:"url,omitempty"`
	// To identifies an entity considered to be part of the public primary audience of an Activity Pub Object
	To ItemCollection `jsonld:"to,omitempty"`
	// Bto identifies anActivity Pub Object that is part of the private primary audience of this Activity Pub Object.
	Bto ItemCollection `jsonld:"bto,omitempty"`
	// CC identifies anActivity Pub Object that is part of the public secondary audience of this Activity Pub Object.
	CC ItemCollection `jsonld:"cc,omitempty"`
	// BCC identifies one or more Objects that are part of the private secondary audience of this Activity Pub Object.
	BCC ItemCollection `jsonld:"bcc,omitempty"`
	// Duration when the object describes a time-bound resource, such as an audio or video, a meeting, etc,
	// the duration property indicates the object's approximate duration.
	// The value must be expressed as an xsd:duration as defined by [ xmlschema11-2],
	// section 3.3.6 (e.g. a period of 5 seconds is represented as "PT5S").
	Duration time.Duration `jsonld:"duration,omitempty"`
	// In a paged Collection, indicates the page that contains the most recently updated member items.
	Current ObjectOrLink `jsonld:"current,omitempty"`
	// In a paged Collection, indicates the furthest preceeding page of items in the collection.
	First ObjectOrLink `jsonld:"first,omitempty"`
	// In a paged Collection, indicates the furthest proceeding page of the collection.
	Last ObjectOrLink `jsonld:"last,omitempty"`
	// A non-negative integer specifying the total number of objects contained by the logical view of the collection.
	// This number might not reflect the actual number of items serialized within the Collection object instance.
	TotalItems uint `jsonld:"totalItems"`
	// Identifies the items contained in a collection. The items might be ordered or unordered.
	OrderedItems ItemCollection `jsonld:"orderedItems,omitempty"`
}

OrderedCollection is a subtype of Collection in which members of the logical collection are assumed to always be strictly ordered.

func OrderedCollectionNew

func OrderedCollectionNew(id ObjectID) *OrderedCollection

OrderedCollectionNew initializes a new OrderedCollection

func ToOrderedCollection

func ToOrderedCollection(it Item) (*OrderedCollection, error)

ToOrderedCollection

func (*OrderedCollection) Append

func (o *OrderedCollection) Append(ob Item) error

Append adds an element to an OrderedCollection

func (*OrderedCollection) Collection

func (o *OrderedCollection) Collection() ItemCollection

Collection returns the underlying Collection type

func (OrderedCollection) Contains

func (o OrderedCollection) Contains(r IRI) bool

Contains verifies if OrderedCollection array contains the received one

func (*OrderedCollection) Count

func (o *OrderedCollection) Count() uint

Count returns the maximum between the length of Items in collection and its TotalItems property

func (OrderedCollection) GetID

func (o OrderedCollection) GetID() ObjectID

GetID returns the ObjectID corresponding to the OrderedCollection

func (o OrderedCollection) GetLink() IRI

GetLink returns the IRI corresponding to the OrderedCollection object

func (OrderedCollection) GetType

GetType returns the OrderedCollection's type

func (OrderedCollection) IsCollection

func (o OrderedCollection) IsCollection() bool

IsCollection returns true for OrderedCollection objects

func (o OrderedCollection) IsLink() bool

IsLink returns false for an OrderedCollection object

func (OrderedCollection) IsObject

func (o OrderedCollection) IsObject() bool

IsObject returns true for am OrderedCollection object

func (*OrderedCollection) UnmarshalJSON

func (o *OrderedCollection) UnmarshalJSON(data []byte) error

UnmarshalJSON

type OrderedCollectionPage

type OrderedCollectionPage struct {
	// ID provides the globally unique identifier for anActivity Pub Object or Link.
	ID ObjectID `jsonld:"id,omitempty"`
	// Type identifies the Activity Pub Object or Link type. Multiple values may be specified.
	Type ActivityVocabularyType `jsonld:"type,omitempty"`
	// Name a simple, human-readable, plain-text name for the object.
	// HTML markup MUST NOT be included. The name MAY be expressed using multiple language-tagged values.
	Name NaturalLanguageValues `jsonld:"name,omitempty,collapsible"`
	// Attachment identifies a resource attached or related to an object that potentially requires special handling.
	// The intent is to provide a model that is at least semantically similar to attachments in email.
	Attachment Item `jsonld:"attachment,omitempty"`
	// AttributedTo identifies one or more entities to which this object is attributed. The attributed entities might not be Actors.
	// For instance, an object might be attributed to the completion of another activity.
	AttributedTo Item `jsonld:"attributedTo,omitempty"`
	// Audience identifies one or more entities that represent the total population of entities
	// for which the object can considered to be relevant.
	Audience ItemCollection `jsonld:"audience,omitempty"`
	// Content or textual representation of the Activity Pub Object encoded as a JSON string.
	// By default, the value of content is HTML.
	// The mediaType property can be used in the object to indicate a different content type.
	// (The content MAY be expressed using multiple language-tagged values.)
	Content NaturalLanguageValues `jsonld:"content,omitempty,collapsible"`
	// Context identifies the context within which the object exists or an activity was performed.
	// The notion of "context" used is intentionally vague.
	// The intended function is to serve as a means of grouping objects and activities that share a
	// common originating context or purpose. An example could be all activities relating to a common project or event.
	Context Item `jsonld:"context,omitempty"`
	// MediaType when used on an Object, identifies the MIME media type of the value of the content property.
	// If not specified, the content property is assumed to contain text/html content.
	MediaType MimeType `jsonld:"mediaType,omitempty"`
	// EndTime the date and time describing the actual or expected ending time of the object.
	// When used with an Activity object, for instance, the endTime property specifies the moment
	// the activity concluded or is expected to conclude.
	EndTime time.Time `jsonld:"endTime,omitempty"`
	// Generator identifies the entity (e.g. an application) that generated the object.
	Generator Item `jsonld:"generator,omitempty"`
	// Icon indicates an entity that describes an icon for this object.
	// The image should have an aspect ratio of one (horizontal) to one (vertical)
	// and should be suitable for presentation at a small size.
	Icon Item `jsonld:"icon,omitempty"`
	// Image indicates an entity that describes an image for this object.
	// Unlike the icon property, there are no aspect ratio or display size limitations assumed.
	Image Item `jsonld:"image,omitempty"`
	// InReplyTo indicates one or more entities for which this object is considered a response.
	InReplyTo Item `jsonld:"inReplyTo,omitempty"`
	// Location indicates one or more physical or logical locations associated with the object.
	Location Item `jsonld:"location,omitempty"`
	// Preview identifies an entity that provides a preview of this object.
	Preview Item `jsonld:"preview,omitempty"`
	// Published the date and time at which the object was published
	Published time.Time `jsonld:"published,omitempty"`
	// Replies identifies a Collection containing objects considered to be responses to this object.
	Replies Item `jsonld:"replies,omitempty"`
	// StartTime the date and time describing the actual or expected starting time of the object.
	// When used with an Activity object, for instance, the startTime property specifies
	// the moment the activity began or is scheduled to begin.
	StartTime time.Time `jsonld:"startTime,omitempty"`
	// Summary a natural language summarization of the object encoded as HTML.
	// *Multiple language tagged summaries may be provided.)
	Summary NaturalLanguageValues `jsonld:"summary,omitempty,collapsible"`
	// Tag one or more "tags" that have been associated with an objects. A tag can be any kind of Activity Pub Object.
	// The key difference between attachment and tag is that the former implies association by inclusion,
	// while the latter implies associated by reference.
	Tag ItemCollection `jsonld:"tag,omitempty"`
	// Updated the date and time at which the object was updated
	Updated time.Time `jsonld:"updated,omitempty"`
	// URL identifies one or more links to representations of the object
	URL LinkOrIRI `jsonld:"url,omitempty"`
	// To identifies an entity considered to be part of the public primary audience of an Activity Pub Object
	To ItemCollection `jsonld:"to,omitempty"`
	// Bto identifies anActivity Pub Object that is part of the private primary audience of this Activity Pub Object.
	Bto ItemCollection `jsonld:"bto,omitempty"`
	// CC identifies anActivity Pub Object that is part of the public secondary audience of this Activity Pub Object.
	CC ItemCollection `jsonld:"cc,omitempty"`
	// BCC identifies one or more Objects that are part of the private secondary audience of this Activity Pub Object.
	BCC ItemCollection `jsonld:"bcc,omitempty"`
	// Duration when the object describes a time-bound resource, such as an audio or video, a meeting, etc,
	// the duration property indicates the object's approximate duration.
	// The value must be expressed as an xsd:duration as defined by [ xmlschema11-2],
	// section 3.3.6 (e.g. a period of 5 seconds is represented as "PT5S").
	Duration time.Duration `jsonld:"duration,omitempty"`
	// In a paged Collection, indicates the page that contains the most recently updated member items.
	Current ObjectOrLink `jsonld:"current,omitempty"`
	// In a paged Collection, indicates the furthest preceeding page of items in the collection.
	First ObjectOrLink `jsonld:"first,omitempty"`
	// In a paged Collection, indicates the furthest proceeding page of the collection.
	Last ObjectOrLink `jsonld:"last,omitempty"`
	// A non-negative integer specifying the total number of objects contained by the logical view of the collection.
	// This number might not reflect the actual number of items serialized within the Collection object instance.
	TotalItems uint `jsonld:"totalItems"`
	// Identifies the items contained in a collection. The items might be ordered or unordered.
	OrderedItems ItemCollection `jsonld:"orderedItems,omitempty"`
	// Identifies the Collection to which a CollectionPage objects items belong.
	PartOf Item `jsonld:"partOf,omitempty"`
	// In a paged Collection, indicates the next page of items.
	Next Item `jsonld:"next,omitempty"`
	// In a paged Collection, identifies the previous page of items.
	Prev Item `jsonld:"prev,omitempty"`
	// A non-negative integer value identifying the relative position within the logical view of a strictly ordered collection.
	StartIndex uint `jsonld:"startIndex,omitempty"`
}

OrderedCollectionPage type extends from both CollectionPage and OrderedCollection. In addition to the properties inherited from each of those, the OrderedCollectionPage may contain an additional startIndex property whose value indicates the relative index position of the first item contained by the page within the OrderedCollection to which the page belongs.

func OrderedCollectionPageNew

func OrderedCollectionPageNew(parent CollectionInterface) *OrderedCollectionPage

OrderedCollectionPageNew initializes a new OrderedCollectionPage

func ToOrderedCollectionPage

func ToOrderedCollectionPage(it Item) (*OrderedCollectionPage, error)

ToOrderedCollectionPage

func (*OrderedCollectionPage) Append

func (o *OrderedCollectionPage) Append(ob Item) error

Append adds an element to an OrderedCollectionPage

func (*OrderedCollectionPage) Collection

func (o *OrderedCollectionPage) Collection() ItemCollection

Collection returns the underlying Collection type

func (OrderedCollectionPage) Contains

func (o OrderedCollectionPage) Contains(r IRI) bool

Contains verifies if OrderedCollectionPage array contains the received one

func (*OrderedCollectionPage) Count

func (o *OrderedCollectionPage) Count() uint

Count returns the maximum between the length of Items in the collection page and its TotalItems property

func (OrderedCollectionPage) GetID

func (o OrderedCollectionPage) GetID() ObjectID

GetID returns the ObjectID corresponding to the OrderedCollectionPage object

func (o OrderedCollectionPage) GetLink() IRI

GetLink returns the IRI corresponding to the OrderedCollectionPage object

func (OrderedCollectionPage) GetType

GetType returns the OrderedCollectionPage's type

func (OrderedCollectionPage) IsCollection

func (o OrderedCollectionPage) IsCollection() bool

IsCollection returns true for OrderedCollectionPage objects

func (o OrderedCollectionPage) IsLink() bool

IsLink returns false for a OrderedCollectionPage object

func (OrderedCollectionPage) IsObject

func (o OrderedCollectionPage) IsObject() bool

IsObject returns true for a OrderedCollectionPage object

func (*OrderedCollectionPage) UnmarshalJSON

func (o *OrderedCollectionPage) UnmarshalJSON(data []byte) error

UnmarshalJSON

type Organization

type Organization = Object

Organization represents an organization.

func OrganizationNew

func OrganizationNew(id ObjectID) *Organization

OrganizationNew initializes an Organization type actor

type Page

type Page = Document

Page represents a Web Page.

type Person

type Person = Object

Person represents an individual person.

func PersonNew

func PersonNew(id ObjectID) *Person

PersonNew initializes a Person type actor

type Place

type Place struct {
	// ID provides the globally unique identifier for anActivity Pub Object or Link.
	ID ObjectID `jsonld:"id,omitempty"`
	// Type identifies the Activity Pub Object or Link type. Multiple values may be specified.
	Type ActivityVocabularyType `jsonld:"type,omitempty"`
	// Name a simple, human-readable, plain-text name for the object.
	// HTML markup MUST NOT be included. The name MAY be expressed using multiple language-tagged values.
	Name NaturalLanguageValues `jsonld:"name,omitempty,collapsible"`
	// Attachment identifies a resource attached or related to an object that potentially requires special handling.
	// The intent is to provide a model that is at least semantically similar to attachments in email.
	Attachment Item `jsonld:"attachment,omitempty"`
	// AttributedTo identifies one or more entities to which this object is attributed. The attributed entities might not be Actors.
	// For instance, an object might be attributed to the completion of another activity.
	AttributedTo Item `jsonld:"attributedTo,omitempty"`
	// Audience identifies one or more entities that represent the total population of entities
	// for which the object can considered to be relevant.
	Audience ItemCollection `jsonld:"audience,omitempty"`
	// Content or textual representation of the Activity Pub Object encoded as a JSON string.
	// By default, the value of content is HTML.
	// The mediaType property can be used in the object to indicate a different content type.
	// (The content MAY be expressed using multiple language-tagged values.)
	Content NaturalLanguageValues `jsonld:"content,omitempty,collapsible"`
	// Context identifies the context within which the object exists or an activity was performed.
	// The notion of "context" used is intentionally vague.
	// The intended function is to serve as a means of grouping objects and activities that share a
	// common originating context or purpose. An example could be all activities relating to a common project or event.
	Context Item `jsonld:"context,omitempty"`
	// MediaType when used on an Object, identifies the MIME media type of the value of the content property.
	// If not specified, the content property is assumed to contain text/html content.
	MediaType MimeType `jsonld:"mediaType,omitempty"`
	// EndTime the date and time describing the actual or expected ending time of the object.
	// When used with an Activity object, for instance, the endTime property specifies the moment
	// the activity concluded or is expected to conclude.
	EndTime time.Time `jsonld:"endTime,omitempty"`
	// Generator identifies the entity (e.g. an application) that generated the object.
	Generator Item `jsonld:"generator,omitempty"`
	// Icon indicates an entity that describes an icon for this object.
	// The image should have an aspect ratio of one (horizontal) to one (vertical)
	// and should be suitable for presentation at a small size.
	Icon Item `jsonld:"icon,omitempty"`
	// Image indicates an entity that describes an image for this object.
	// Unlike the icon property, there are no aspect ratio or display size limitations assumed.
	Image Item `jsonld:"image,omitempty"`
	// InReplyTo indicates one or more entities for which this object is considered a response.
	InReplyTo Item `jsonld:"inReplyTo,omitempty"`
	// Location indicates one or more physical or logical locations associated with the object.
	Location Item `jsonld:"location,omitempty"`
	// Preview identifies an entity that provides a preview of this object.
	Preview Item `jsonld:"preview,omitempty"`
	// Published the date and time at which the object was published
	Published time.Time `jsonld:"published,omitempty"`
	// Replies identifies a Collection containing objects considered to be responses to this object.
	Replies Item `jsonld:"replies,omitempty"`
	// StartTime the date and time describing the actual or expected starting time of the object.
	// When used with an Activity object, for instance, the startTime property specifies
	// the moment the activity began or is scheduled to begin.
	StartTime time.Time `jsonld:"startTime,omitempty"`
	// Summary a natural language summarization of the object encoded as HTML.
	// *Multiple language tagged summaries may be provided.)
	Summary NaturalLanguageValues `jsonld:"summary,omitempty,collapsible"`
	// Tag one or more "tags" that have been associated with an objects. A tag can be any kind of Activity Pub Object.
	// The key difference between attachment and tag is that the former implies association by inclusion,
	// while the latter implies associated by reference.
	Tag ItemCollection `jsonld:"tag,omitempty"`
	// Updated the date and time at which the object was updated
	Updated time.Time `jsonld:"updated,omitempty"`
	// URL identifies one or more links to representations of the object
	URL LinkOrIRI `jsonld:"url,omitempty"`
	// To identifies an entity considered to be part of the public primary audience of an Activity Pub Object
	To ItemCollection `jsonld:"to,omitempty"`
	// Bto identifies anActivity Pub Object that is part of the private primary audience of this Activity Pub Object.
	Bto ItemCollection `jsonld:"bto,omitempty"`
	// CC identifies anActivity Pub Object that is part of the public secondary audience of this Activity Pub Object.
	CC ItemCollection `jsonld:"cc,omitempty"`
	// BCC identifies one or more Objects that are part of the private secondary audience of this Activity Pub Object.
	BCC ItemCollection `jsonld:"bcc,omitempty"`
	// Duration when the object describes a time-bound resource, such as an audio or video, a meeting, etc,
	// the duration property indicates the object's approximate duration.
	// The value must be expressed as an xsd:duration as defined by [ xmlschema11-2],
	// section 3.3.6 (e.g. a period of 5 seconds is represented as "PT5S").
	Duration time.Duration `jsonld:"duration,omitempty"`
	// Accuracy indicates the accuracy of position coordinates on a Place objects.
	// Expressed in properties of percentage. e.g. "94.0" means "94.0% accurate".
	Accuracy float64
	// Altitude indicates the altitude of a place. The measurement units is indicated using the units property.
	// If units is not specified, the default is assumed to be "m" indicating meters.
	Altitude float64
	// Latitude the latitude of a place
	Latitude float64
	// Longitude the longitude of a place
	Longitude float64
	// Radius the radius from the given latitude and longitude for a Place.
	// The units is expressed by the units property. If units is not specified,
	// the default is assumed to be "m" indicating "meters".
	Radius int64
	// Specifies the measurement units for the radius and altitude properties on a Place object.
	// If not specified, the default is assumed to be "m" for "meters".
	// Values "cm" | " feet" | " inches" | " km" | " m" | " miles" | xsd:anyURI
	Units string
}

Place represents a logical or physical location. See 5.3 Representing Places for additional information.

func ToPlace

func ToPlace(it Item) (*Place, error)

ToPlace

func (*Place) Clean

func (p *Place) Clean()

Clean removes Bto and BCC properties

func (Place) GetID

func (p Place) GetID() ObjectID

GetID returns the ID corresponding to the current Place

func (p Place) GetLink() IRI

GetLink returns the IRI corresponding to the current Place object

func (Place) GetType

func (p Place) GetType() ActivityVocabularyType

GetType returns the type of the current Place

func (Place) IsCollection

func (p Place) IsCollection() bool

IsCollection returns false for Place objects

func (p Place) IsLink() bool

IsLink returns false for Place objects

func (Place) IsObject

func (p Place) IsObject() bool

IsObject returns true for Place objects

func (*Place) Recipients

func (p *Place) Recipients() ItemCollection

Recipients performs recipient de-duplication on the Place object's To, Bto, CC and BCC properties

func (*Place) UnmarshalJSON

func (p *Place) UnmarshalJSON(data []byte) error

UnmarshalJSON

type Profile

type Profile struct {
	// ID provides the globally unique identifier for anActivity Pub Object or Link.
	ID ObjectID `jsonld:"id,omitempty"`
	// Type identifies the Activity Pub Object or Link type. Multiple values may be specified.
	Type ActivityVocabularyType `jsonld:"type,omitempty"`
	// Name a simple, human-readable, plain-text name for the object.
	// HTML markup MUST NOT be included. The name MAY be expressed using multiple language-tagged values.
	Name NaturalLanguageValues `jsonld:"name,omitempty,collapsible"`
	// Attachment identifies a resource attached or related to an object that potentially requires special handling.
	// The intent is to provide a model that is at least semantically similar to attachments in email.
	Attachment Item `jsonld:"attachment,omitempty"`
	// AttributedTo identifies one or more entities to which this object is attributed. The attributed entities might not be Actors.
	// For instance, an object might be attributed to the completion of another activity.
	AttributedTo Item `jsonld:"attributedTo,omitempty"`
	// Audience identifies one or more entities that represent the total population of entities
	// for which the object can considered to be relevant.
	Audience ItemCollection `jsonld:"audience,omitempty"`
	// Content or textual representation of the Activity Pub Object encoded as a JSON string.
	// By default, the value of content is HTML.
	// The mediaType property can be used in the object to indicate a different content type.
	// (The content MAY be expressed using multiple language-tagged values.)
	Content NaturalLanguageValues `jsonld:"content,omitempty,collapsible"`
	// Context identifies the context within which the object exists or an activity was performed.
	// The notion of "context" used is intentionally vague.
	// The intended function is to serve as a means of grouping objects and activities that share a
	// common originating context or purpose. An example could be all activities relating to a common project or event.
	Context Item `jsonld:"context,omitempty"`
	// MediaType when used on an Object, identifies the MIME media type of the value of the content property.
	// If not specified, the content property is assumed to contain text/html content.
	MediaType MimeType `jsonld:"mediaType,omitempty"`
	// EndTime the date and time describing the actual or expected ending time of the object.
	// When used with an Activity object, for instance, the endTime property specifies the moment
	// the activity concluded or is expected to conclude.
	EndTime time.Time `jsonld:"endTime,omitempty"`
	// Generator identifies the entity (e.g. an application) that generated the object.
	Generator Item `jsonld:"generator,omitempty"`
	// Icon indicates an entity that describes an icon for this object.
	// The image should have an aspect ratio of one (horizontal) to one (vertical)
	// and should be suitable for presentation at a small size.
	Icon Item `jsonld:"icon,omitempty"`
	// Image indicates an entity that describes an image for this object.
	// Unlike the icon property, there are no aspect ratio or display size limitations assumed.
	Image Item `jsonld:"image,omitempty"`
	// InReplyTo indicates one or more entities for which this object is considered a response.
	InReplyTo Item `jsonld:"inReplyTo,omitempty"`
	// Location indicates one or more physical or logical locations associated with the object.
	Location Item `jsonld:"location,omitempty"`
	// Preview identifies an entity that provides a preview of this object.
	Preview Item `jsonld:"preview,omitempty"`
	// Published the date and time at which the object was published
	Published time.Time `jsonld:"published,omitempty"`
	// Replies identifies a Collection containing objects considered to be responses to this object.
	Replies Item `jsonld:"replies,omitempty"`
	// StartTime the date and time describing the actual or expected starting time of the object.
	// When used with an Activity object, for instance, the startTime property specifies
	// the moment the activity began or is scheduled to begin.
	StartTime time.Time `jsonld:"startTime,omitempty"`
	// Summary a natural language summarization of the object encoded as HTML.
	// *Multiple language tagged summaries may be provided.)
	Summary NaturalLanguageValues `jsonld:"summary,omitempty,collapsible"`
	// Tag one or more "tags" that have been associated with an objects. A tag can be any kind of Activity Pub Object.
	// The key difference between attachment and tag is that the former implies association by inclusion,
	// while the latter implies associated by reference.
	Tag ItemCollection `jsonld:"tag,omitempty"`
	// Updated the date and time at which the object was updated
	Updated time.Time `jsonld:"updated,omitempty"`
	// URL identifies one or more links to representations of the object
	URL LinkOrIRI `jsonld:"url,omitempty"`
	// To identifies an entity considered to be part of the public primary audience of an Activity Pub Object
	To ItemCollection `jsonld:"to,omitempty"`
	// Bto identifies anActivity Pub Object that is part of the private primary audience of this Activity Pub Object.
	Bto ItemCollection `jsonld:"bto,omitempty"`
	// CC identifies anActivity Pub Object that is part of the public secondary audience of this Activity Pub Object.
	CC ItemCollection `jsonld:"cc,omitempty"`
	// BCC identifies one or more Objects that are part of the private secondary audience of this Activity Pub Object.
	BCC ItemCollection `jsonld:"bcc,omitempty"`
	// Duration when the object describes a time-bound resource, such as an audio or video, a meeting, etc,
	// the duration property indicates the object's approximate duration.
	// The value must be expressed as an xsd:duration as defined by [ xmlschema11-2],
	// section 3.3.6 (e.g. a period of 5 seconds is represented as "PT5S").
	Duration time.Duration `jsonld:"duration,omitempty"`
	// Describes On a Profile object, the describes property identifies the object described by the Profile.
	Describes Item `jsonld:"describes,omitempty"`
}

Profile a Profile is a content object that describes another Object, typically used to describe Actor Type objects. The describes property is used to reference the object being described by the profile.

func ToProfile

func ToProfile(it Item) (*Profile, error)

ToProfile

func (*Profile) Clean

func (p *Profile) Clean()

Clean removes Bto and BCC properties

func (Profile) GetID

func (p Profile) GetID() ObjectID

GetID returns the ID corresponding to the current Profile

func (p Profile) GetLink() IRI

GetLink returns the IRI corresponding to the current Profile object

func (Profile) GetType

func (p Profile) GetType() ActivityVocabularyType

GetType returns the type of the current Profile

func (Profile) IsCollection

func (p Profile) IsCollection() bool

IsCollection returns false for Profile objects

func (p Profile) IsLink() bool

IsLink returns false for Profile objects

func (Profile) IsObject

func (p Profile) IsObject() bool

IsObject returns true for Profile objects

func (*Profile) Recipients

func (p *Profile) Recipients() ItemCollection

Recipients performs recipient de-duplication on the Profile object's To, Bto, CC and BCC properties

func (*Profile) UnmarshalJSON

func (p *Profile) UnmarshalJSON(data []byte) error

UnmarshalJSON

type Question

type Question struct {
	// ID provides the globally unique identifier for anActivity Pub Object or Link.
	ID ObjectID `jsonld:"id,omitempty"`
	// Type identifies the Activity Pub Object or Link type. Multiple values may be specified.
	Type ActivityVocabularyType `jsonld:"type,omitempty"`
	// Name a simple, human-readable, plain-text name for the object.
	// HTML markup MUST NOT be included. The name MAY be expressed using multiple language-tagged values.
	Name NaturalLanguageValues `jsonld:"name,omitempty,collapsible"`
	// Attachment identifies a resource attached or related to an object that potentially requires special handling.
	// The intent is to provide a model that is at least semantically similar to attachments in email.
	Attachment Item `jsonld:"attachment,omitempty"`
	// AttributedTo identifies one or more entities to which this object is attributed. The attributed entities might not be Actors.
	// For instance, an object might be attributed to the completion of another activity.
	AttributedTo Item `jsonld:"attributedTo,omitempty"`
	// Audience identifies one or more entities that represent the total population of entities
	// for which the object can considered to be relevant.
	Audience ItemCollection `jsonld:"audience,omitempty"`
	// Content or textual representation of the Activity Pub Object encoded as a JSON string.
	// By default, the value of content is HTML.
	// The mediaType property can be used in the object to indicate a different content type.
	// (The content MAY be expressed using multiple language-tagged values.)
	Content NaturalLanguageValues `jsonld:"content,omitempty,collapsible"`
	// Context identifies the context within which the object exists or an activity was performed.
	// The notion of "context" used is intentionally vague.
	// The intended function is to serve as a means of grouping objects and activities that share a
	// common originating context or purpose. An example could be all activities relating to a common project or event.
	Context Item `jsonld:"context,omitempty"`
	// MediaType when used on an Object, identifies the MIME media type of the value of the content property.
	// If not specified, the content property is assumed to contain text/html content.
	MediaType MimeType `jsonld:"mediaType,omitempty"`
	// EndTime the date and time describing the actual or expected ending time of the object.
	// When used with an Activity object, for instance, the endTime property specifies the moment
	// the activity concluded or is expected to conclude.
	EndTime time.Time `jsonld:"endTime,omitempty"`
	// Generator identifies the entity (e.g. an application) that generated the object.
	Generator Item `jsonld:"generator,omitempty"`
	// Icon indicates an entity that describes an icon for this object.
	// The image should have an aspect ratio of one (horizontal) to one (vertical)
	// and should be suitable for presentation at a small size.
	Icon Item `jsonld:"icon,omitempty"`
	// Image indicates an entity that describes an image for this object.
	// Unlike the icon property, there are no aspect ratio or display size limitations assumed.
	Image Item `jsonld:"image,omitempty"`
	// InReplyTo indicates one or more entities for which this object is considered a response.
	InReplyTo Item `jsonld:"inReplyTo,omitempty"`
	// Location indicates one or more physical or logical locations associated with the object.
	Location Item `jsonld:"location,omitempty"`
	// Preview identifies an entity that provides a preview of this object.
	Preview Item `jsonld:"preview,omitempty"`
	// Published the date and time at which the object was published
	Published time.Time `jsonld:"published,omitempty"`
	// Replies identifies a Collection containing objects considered to be responses to this object.
	Replies Item `jsonld:"replies,omitempty"`
	// StartTime the date and time describing the actual or expected starting time of the object.
	// When used with an Activity object, for instance, the startTime property specifies
	// the moment the activity began or is scheduled to begin.
	StartTime time.Time `jsonld:"startTime,omitempty"`
	// Summary a natural language summarization of the object encoded as HTML.
	// *Multiple language tagged summaries may be provided.)
	Summary NaturalLanguageValues `jsonld:"summary,omitempty,collapsible"`
	// Tag one or more "tags" that have been associated with an objects. A tag can be any kind of Activity Pub Object.
	// The key difference between attachment and tag is that the former implies association by inclusion,
	// while the latter implies associated by reference.
	Tag ItemCollection `jsonld:"tag,omitempty"`
	// Updated the date and time at which the object was updated
	Updated time.Time `jsonld:"updated,omitempty"`
	// URL identifies one or more links to representations of the object
	URL LinkOrIRI `jsonld:"url,omitempty"`
	// To identifies an entity considered to be part of the public primary audience of an Activity Pub Object
	To ItemCollection `jsonld:"to,omitempty"`
	// Bto identifies anActivity Pub Object that is part of the private primary audience of this Activity Pub Object.
	Bto ItemCollection `jsonld:"bto,omitempty"`
	// CC identifies anActivity Pub Object that is part of the public secondary audience of this Activity Pub Object.
	CC ItemCollection `jsonld:"cc,omitempty"`
	// BCC identifies one or more Objects that are part of the private secondary audience of this Activity Pub Object.
	BCC ItemCollection `jsonld:"bcc,omitempty"`
	// Duration when the object describes a time-bound resource, such as an audio or video, a meeting, etc,
	// the duration property indicates the object's approximate duration.
	// The value must be expressed as an xsd:duration as defined by [ xmlschema11-2],
	// section 3.3.6 (e.g. a period of 5 seconds is represented as "PT5S").
	Duration time.Duration `jsonld:"duration,omitempty"`
	// Actor describes one or more entities that either performed or are expected to perform the activity.
	// Any single activity can have multiple actors. The actor may be specified using an indirect Link.
	Actor Actor `jsonld:"actor,omitempty"`
	// Target describes the indirect object, or target, of the activity.
	// The precise meaning of the target is largely dependent on the type of action being described
	// but will often be the object of the English preposition "to".
	// For instance, in the activity "John added a movie to his wishlist",
	// the target of the activity is John's wishlist. An activity can have more than one target.
	Target Item `jsonld:"target,omitempty"`
	// Result describes the result of the activity. For instance, if a particular action results in the creation
	// of a new resource, the result property can be used to describe that new resource.
	Result Item `jsonld:"result,omitempty"`
	// Origin describes an indirect object of the activity from which the activity is directed.
	// The precise meaning of the origin is the object of the English preposition "from".
	// For instance, in the activity "John moved an item to List B from List A", the origin of the activity is "List A".
	Origin Item `jsonld:"origin,omitempty"`
	// Instrument identifies one or more objects used (or to be used) in the completion of an Activity.
	Instrument Item `jsonld:"instrument,omitempty"`
	// OneOf identifies an exclusive option for a Question. Use of oneOf implies that the Question
	// can have only a single answer. To indicate that a Question can have multiple answers, use anyOf.
	OneOf Item `jsonld:"oneOf,omitempty"`
	// AnyOf identifies an inclusive option for a Question. Use of anyOf implies that the Question can have multiple answers.
	// To indicate that a Question can have only one answer, use oneOf.
	AnyOf Item `jsonld:"anyOf,omitempty"`
	// Closed indicates that a question has been closed, and answers are no longer accepted.
	Closed bool `jsonld:"closed,omitempty"`
}

Question represents a question being asked. Question objects are an extension of IntransitiveActivity. That is, the Question object is an Activity, but the direct object is the question itself and therefore it would not contain an object property. Either of the anyOf and oneOf properties may be used to express possible answers, but a Question object must not have both properties.

func QuestionNew

func QuestionNew(id ObjectID) *Question

QuestionNew initializes a Question activity

func ToQuestion

func ToQuestion(it Item) (*Question, error)

ToQuestion

func (Question) GetID

func (q Question) GetID() ObjectID

GetID returns the ObjectID corresponding to the Question object

func (q Question) GetLink() IRI

GetLink returns the IRI corresponding to the Question object

func (Question) GetType

func (q Question) GetType() ActivityVocabularyType

GetType returns the ActivityVocabulary type of the current Activity

func (Question) IsCollection

func (q Question) IsCollection() bool

IsCollection returns false for Question objects

func (q Question) IsLink() bool

IsLink returns false for Question objects

func (Question) IsObject

func (q Question) IsObject() bool

IsObject returns true for Question objects

func (*Question) UnmarshalJSON

func (q *Question) UnmarshalJSON(data []byte) error

UnmarshalJSON

type Read

type Read = Activity

Read indicates that the actor has read the object.

func ReadNew

func ReadNew(id ObjectID, ob Item) *Read

ReadNew initializes a Read activity

type Reject

type Reject = Activity

Reject indicates that the actor is rejecting the object. The target and origin typically have no defined meaning.

func RejectNew

func RejectNew(id ObjectID, ob Item) *Reject

RejectNew initializes a Reject activity

type Relationship

type Relationship struct {
	// ID provides the globally unique identifier for anActivity Pub Object or Link.
	ID ObjectID `jsonld:"id,omitempty"`
	// Type identifies the Activity Pub Object or Link type. Multiple values may be specified.
	Type ActivityVocabularyType `jsonld:"type,omitempty"`
	// Name a simple, human-readable, plain-text name for the object.
	// HTML markup MUST NOT be included. The name MAY be expressed using multiple language-tagged values.
	Name NaturalLanguageValues `jsonld:"name,omitempty,collapsible"`
	// Attachment identifies a resource attached or related to an object that potentially requires special handling.
	// The intent is to provide a model that is at least semantically similar to attachments in email.
	Attachment Item `jsonld:"attachment,omitempty"`
	// AttributedTo identifies one or more entities to which this object is attributed. The attributed entities might not be Actors.
	// For instance, an object might be attributed to the completion of another activity.
	AttributedTo Item `jsonld:"attributedTo,omitempty"`
	// Audience identifies one or more entities that represent the total population of entities
	// for which the object can considered to be relevant.
	Audience ItemCollection `jsonld:"audience,omitempty"`
	// Content or textual representation of the Activity Pub Object encoded as a JSON string.
	// By default, the value of content is HTML.
	// The mediaType property can be used in the object to indicate a different content type.
	// (The content MAY be expressed using multiple language-tagged values.)
	Content NaturalLanguageValues `jsonld:"content,omitempty,collapsible"`
	// Context identifies the context within which the object exists or an activity was performed.
	// The notion of "context" used is intentionally vague.
	// The intended function is to serve as a means of grouping objects and activities that share a
	// common originating context or purpose. An example could be all activities relating to a common project or event.
	Context Item `jsonld:"context,omitempty"`
	// MediaType when used on an Object, identifies the MIME media type of the value of the content property.
	// If not specified, the content property is assumed to contain text/html content.
	MediaType MimeType `jsonld:"mediaType,omitempty"`
	// EndTime the date and time describing the actual or expected ending time of the object.
	// When used with an Activity object, for instance, the endTime property specifies the moment
	// the activity concluded or is expected to conclude.
	EndTime time.Time `jsonld:"endTime,omitempty"`
	// Generator identifies the entity (e.g. an application) that generated the object.
	Generator Item `jsonld:"generator,omitempty"`
	// Icon indicates an entity that describes an icon for this object.
	// The image should have an aspect ratio of one (horizontal) to one (vertical)
	// and should be suitable for presentation at a small size.
	Icon Item `jsonld:"icon,omitempty"`
	// Image indicates an entity that describes an image for this object.
	// Unlike the icon property, there are no aspect ratio or display size limitations assumed.
	Image Item `jsonld:"image,omitempty"`
	// InReplyTo indicates one or more entities for which this object is considered a response.
	InReplyTo Item `jsonld:"inReplyTo,omitempty"`
	// Location indicates one or more physical or logical locations associated with the object.
	Location Item `jsonld:"location,omitempty"`
	// Preview identifies an entity that provides a preview of this object.
	Preview Item `jsonld:"preview,omitempty"`
	// Published the date and time at which the object was published
	Published time.Time `jsonld:"published,omitempty"`
	// Replies identifies a Collection containing objects considered to be responses to this object.
	Replies Item `jsonld:"replies,omitempty"`
	// StartTime the date and time describing the actual or expected starting time of the object.
	// When used with an Activity object, for instance, the startTime property specifies
	// the moment the activity began or is scheduled to begin.
	StartTime time.Time `jsonld:"startTime,omitempty"`
	// Summary a natural language summarization of the object encoded as HTML.
	// *Multiple language tagged summaries may be provided.)
	Summary NaturalLanguageValues `jsonld:"summary,omitempty,collapsible"`
	// Tag one or more "tags" that have been associated with an objects. A tag can be any kind of Activity Pub Object.
	// The key difference between attachment and tag is that the former implies association by inclusion,
	// while the latter implies associated by reference.
	Tag ItemCollection `jsonld:"tag,omitempty"`
	// Updated the date and time at which the object was updated
	Updated time.Time `jsonld:"updated,omitempty"`
	// URL identifies one or more links to representations of the object
	URL LinkOrIRI `jsonld:"url,omitempty"`
	// To identifies an entity considered to be part of the public primary audience of an Activity Pub Object
	To ItemCollection `jsonld:"to,omitempty"`
	// Bto identifies anActivity Pub Object that is part of the private primary audience of this Activity Pub Object.
	Bto ItemCollection `jsonld:"bto,omitempty"`
	// CC identifies anActivity Pub Object that is part of the public secondary audience of this Activity Pub Object.
	CC ItemCollection `jsonld:"cc,omitempty"`
	// BCC identifies one or more Objects that are part of the private secondary audience of this Activity Pub Object.
	BCC ItemCollection `jsonld:"bcc,omitempty"`
	// Duration when the object describes a time-bound resource, such as an audio or video, a meeting, etc,
	// the duration property indicates the object's approximate duration.
	// The value must be expressed as an xsd:duration as defined by [ xmlschema11-2],
	// section 3.3.6 (e.g. a period of 5 seconds is represented as "PT5S").
	Duration time.Duration `jsonld:"duration,omitempty"`
	// Subject Subject On a Relationship object, the subject property identifies one of the connected individuals.
	// For instance, for a Relationship object describing "John is related to Sally", subject would refer to John.
	Subject Item
	// Object
	Object Item
	// Relationship On a Relationship object, the relationship property identifies the kind
	// of relationship that exists between subject and object.
	Relationship Item
}

Relationship describes a relationship between two individuals. The subject and object properties are used to identify the connected individuals. See 5.2 Representing Relationships Between Entities for additional information. 5.2: The relationship property specifies the kind of relationship that exists between the two individuals identified by the subject and object properties. Used together, these three properties form what is commonly known as a "reified statement" where subject identifies the subject, relationship identifies the predicate, and object identifies the object.

func ToRelationship

func ToRelationship(it Item) (*Relationship, error)

ToRelationship

func (*Relationship) Clean

func (r *Relationship) Clean()

Clean removes Bto and BCC properties

func (Relationship) GetID

func (r Relationship) GetID() ObjectID

GetID returns the ID corresponding to the current Relationship

func (r Relationship) GetLink() IRI

GetLink returns the IRI corresponding to the current Relationship object

func (Relationship) GetType

GetType returns the type of the current Relationship

func (Relationship) IsCollection

func (r Relationship) IsCollection() bool

IsCollection returns false for Relationship objects

func (r Relationship) IsLink() bool

IsLink returns false for Relationship objects

func (Relationship) IsObject

func (r Relationship) IsObject() bool

IsObject returns true for Relationship objects

func (*Relationship) Recipients

func (r *Relationship) Recipients() ItemCollection

Recipients performs recipient de-duplication on the Relationship object's To, Bto, CC and BCC properties

func (*Relationship) UnmarshalJSON

func (r *Relationship) UnmarshalJSON(data []byte) error

UnmarshalJSON

type Remove

type Remove = Activity

Remove indicates that the actor is removing the object. If specified, the origin indicates the context from which the object is being removed.

func RemoveNew

func RemoveNew(id ObjectID, ob Item, trgt Item) *Remove

RemoveNew initializes a Remove activity

type Service

type Service = Object

Service represents a service of any kind.

func ServiceNew

func ServiceNew(id ObjectID) *Service

ServiceNew initializes a Service type actor

type TentativeAccept

type TentativeAccept = Accept

TentativeAccept is a specialization of Accept indicating that the acceptance is tentative.

func TentativeAcceptNew

func TentativeAcceptNew(id ObjectID, ob Item) *TentativeAccept

TentativeAcceptNew initializes a TentativeAccept activity

type TentativeReject

type TentativeReject = Reject

TentativeReject is a specialization of Reject in which the rejection is considered tentative.

func TentativeRejectNew

func TentativeRejectNew(id ObjectID, ob Item) *TentativeReject

TentativeRejectNew initializes a TentativeReject activity

type Tombstone

type Tombstone struct {
	// ID provides the globally unique identifier for anActivity Pub Object or Link.
	ID ObjectID `jsonld:"id,omitempty"`
	// Type identifies the Activity Pub Object or Link type. Multiple values may be specified.
	Type ActivityVocabularyType `jsonld:"type,omitempty"`
	// Name a simple, human-readable, plain-text name for the object.
	// HTML markup MUST NOT be included. The name MAY be expressed using multiple language-tagged values.
	Name NaturalLanguageValues `jsonld:"name,omitempty,collapsible"`
	// Attachment identifies a resource attached or related to an object that potentially requires special handling.
	// The intent is to provide a model that is at least semantically similar to attachments in email.
	Attachment Item `jsonld:"attachment,omitempty"`
	// AttributedTo identifies one or more entities to which this object is attributed. The attributed entities might not be Actors.
	// For instance, an object might be attributed to the completion of another activity.
	AttributedTo Item `jsonld:"attributedTo,omitempty"`
	// Audience identifies one or more entities that represent the total population of entities
	// for which the object can considered to be relevant.
	Audience ItemCollection `jsonld:"audience,omitempty"`
	// Content or textual representation of the Activity Pub Object encoded as a JSON string.
	// By default, the value of content is HTML.
	// The mediaType property can be used in the object to indicate a different content type.
	// (The content MAY be expressed using multiple language-tagged values.)
	Content NaturalLanguageValues `jsonld:"content,omitempty,collapsible"`
	// Context identifies the context within which the object exists or an activity was performed.
	// The notion of "context" used is intentionally vague.
	// The intended function is to serve as a means of grouping objects and activities that share a
	// common originating context or purpose. An example could be all activities relating to a common project or event.
	Context Item `jsonld:"context,omitempty"`
	// MediaType when used on an Object, identifies the MIME media type of the value of the content property.
	// If not specified, the content property is assumed to contain text/html content.
	MediaType MimeType `jsonld:"mediaType,omitempty"`
	// EndTime the date and time describing the actual or expected ending time of the object.
	// When used with an Activity object, for instance, the endTime property specifies the moment
	// the activity concluded or is expected to conclude.
	EndTime time.Time `jsonld:"endTime,omitempty"`
	// Generator identifies the entity (e.g. an application) that generated the object.
	Generator Item `jsonld:"generator,omitempty"`
	// Icon indicates an entity that describes an icon for this object.
	// The image should have an aspect ratio of one (horizontal) to one (vertical)
	// and should be suitable for presentation at a small size.
	Icon Item `jsonld:"icon,omitempty"`
	// Image indicates an entity that describes an image for this object.
	// Unlike the icon property, there are no aspect ratio or display size limitations assumed.
	Image Item `jsonld:"image,omitempty"`
	// InReplyTo indicates one or more entities for which this object is considered a response.
	InReplyTo Item `jsonld:"inReplyTo,omitempty"`
	// Location indicates one or more physical or logical locations associated with the object.
	Location Item `jsonld:"location,omitempty"`
	// Preview identifies an entity that provides a preview of this object.
	Preview Item `jsonld:"preview,omitempty"`
	// Published the date and time at which the object was published
	Published time.Time `jsonld:"published,omitempty"`
	// Replies identifies a Collection containing objects considered to be responses to this object.
	Replies Item `jsonld:"replies,omitempty"`
	// StartTime the date and time describing the actual or expected starting time of the object.
	// When used with an Activity object, for instance, the startTime property specifies
	// the moment the activity began or is scheduled to begin.
	StartTime time.Time `jsonld:"startTime,omitempty"`
	// Summary a natural language summarization of the object encoded as HTML.
	// *Multiple language tagged summaries may be provided.)
	Summary NaturalLanguageValues `jsonld:"summary,omitempty,collapsible"`
	// Tag one or more "tags" that have been associated with an objects. A tag can be any kind of Activity Pub Object.
	// The key difference between attachment and tag is that the former implies association by inclusion,
	// while the latter implies associated by reference.
	Tag ItemCollection `jsonld:"tag,omitempty"`
	// Updated the date and time at which the object was updated
	Updated time.Time `jsonld:"updated,omitempty"`
	// URL identifies one or more links to representations of the object
	URL LinkOrIRI `jsonld:"url,omitempty"`
	// To identifies an entity considered to be part of the public primary audience of an Activity Pub Object
	To ItemCollection `jsonld:"to,omitempty"`
	// Bto identifies anActivity Pub Object that is part of the private primary audience of this Activity Pub Object.
	Bto ItemCollection `jsonld:"bto,omitempty"`
	// CC identifies anActivity Pub Object that is part of the public secondary audience of this Activity Pub Object.
	CC ItemCollection `jsonld:"cc,omitempty"`
	// BCC identifies one or more Objects that are part of the private secondary audience of this Activity Pub Object.
	BCC ItemCollection `jsonld:"bcc,omitempty"`
	// Duration when the object describes a time-bound resource, such as an audio or video, a meeting, etc,
	// the duration property indicates the object's approximate duration.
	// The value must be expressed as an xsd:duration as defined by [ xmlschema11-2],
	// section 3.3.6 (e.g. a period of 5 seconds is represented as "PT5S").
	Duration time.Duration `jsonld:"duration,omitempty"`
	// FormerType On a Tombstone object, the formerType property identifies the type of the object that was deleted.
	FormerType ActivityVocabularyType `jsonld:"formerType,omitempty"`
	// Deleted On a Tombstone object, the deleted property is a timestamp for when the object was deleted.
	Deleted time.Time `jsonld:"deleted,omitempty"`
}

Tombstone a Tombstone represents a content object that has been deleted. It can be used in Collections to signify that there used to be an object at this position, but it has been deleted.

func ToTombstone

func ToTombstone(it Item) (*Tombstone, error)

ToTombstone

func (*Tombstone) Clean

func (t *Tombstone) Clean()

Clean removes Bto and BCC properties

func (Tombstone) GetID

func (t Tombstone) GetID() ObjectID

GetID returns the ID corresponding to the current Tombstone

func (t Tombstone) GetLink() IRI

GetLink returns the IRI corresponding to the current Tombstone object

func (Tombstone) GetType

func (t Tombstone) GetType() ActivityVocabularyType

GetType returns the type of the current Tombstone

func (Tombstone) IsCollection

func (t Tombstone) IsCollection() bool

IsCollection returns false for Tombstone objects

func (t Tombstone) IsLink() bool

IsLink returns false for Tombstone objects

func (Tombstone) IsObject

func (t Tombstone) IsObject() bool

IsObject returns true for Tombstone objects

func (*Tombstone) Recipients

func (t *Tombstone) Recipients() ItemCollection

Recipients performs recipient de-duplication on the Tombstone object's To, Bto, CC and BCC properties

func (*Tombstone) UnmarshalJSON

func (t *Tombstone) UnmarshalJSON(data []byte) error

UnmarshalJSON

type Travel

type Travel = IntransitiveActivity

Travel indicates that the actor is traveling to target from origin. Travel is an IntransitiveObject whose actor specifies the direct object. If the target or origin are not specified, either can be determined by context.

func TravelNew

func TravelNew(id ObjectID) *Travel

TravelNew initializes a Travel activity

type TyperFn

type TyperFn func(ActivityVocabularyType) (Item, error)

TyperFn is the type of the function which returns an activitystreams.Item struct instance for a specific ActivityVocabularyType

var ItemTyperFunc TyperFn

ItemTyperFunc will return an instance of a struct that implements activitystreams.Item The default for this package is JSONGetItemByType but can be overwritten

type Undo

type Undo = Activity

Undo indicates that the actor is undoing the object. In most cases, the object will be an Activity describing some previously performed action (for instance, a person may have previously "liked" an article but, for whatever reason, might choose to undo that like at some later point in time). The target and origin typically have no defined meaning.

func UndoNew

func UndoNew(id ObjectID, ob Item) *Undo

UndoNew initializes an Undo activity

type Update

type Update = Activity

Update indicates that the actor has updated the object. Note, however, that this vocabulary does not define a mechanism for describing the actual set of modifications made to object. The target and origin typically have no defined meaning.

func UpdateNew

func UpdateNew(id ObjectID, ob Item) *Update

UpdateNew initializes an Update activity

type Video

type Video = Document

Video represents a video document of any kind

type View

type View = Activity

View indicates that the actor has viewed the object.

func ViewNew

func ViewNew(id ObjectID, ob Item) *View

ViewNew initializes a View activity

Jump to

Keyboard shortcuts

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