Documentation ¶
Index ¶
- Constants
- func UnmarshalItems(data any) ([]any, bool)
- type Client
- type Collection
- type CollectionPage
- type Context
- func (c *Context) Add(vocabulary string) *ContextEntry
- func (c Context) Head() *ContextEntry
- func (c Context) IsEmpty() bool
- func (c Context) IsEmptyTail() bool
- func (c Context) Length() int
- func (c Context) MarshalJSON() ([]byte, error)
- func (c Context) Tail() Context
- func (c *Context) UnmarshalJSON(data []byte) error
- type ContextEntry
- func (entry ContextEntry) HasExtensions() bool
- func (entry ContextEntry) IsLanguageDefined() bool
- func (entry ContextEntry) IsVocabularyOnly() bool
- func (entry ContextEntry) MarshalJSON() ([]byte, error)
- func (entry *ContextEntry) WithExtension(key string, value string) *ContextEntry
- func (entry *ContextEntry) WithLanguage(language string) *ContextEntry
- type DefaultClient
- type Document
- func (document Document) Accuracy() float64
- func (document Document) Actor() Document
- func (document Document) Altitude() float64
- func (document Document) AnyOf() Document
- func (document *Document) Append(name string, value any) bool
- func (document *Document) AppendBCC(value string) bool
- func (document *Document) AppendBTo(value string) bool
- func (document *Document) AppendCC(value string) bool
- func (document *Document) AppendString(name string, value string) bool
- func (document *Document) AppendTo(value string) bool
- func (document Document) AspectRatio() string
- func (document Document) AtContext() Document
- func (document Document) Attachment() Document
- func (document Document) AttributedTo() Document
- func (document Document) Audience() Document
- func (document Document) BCC() Document
- func (document Document) BTo() Document
- func (document Document) Blocked() Document
- func (document Document) Bool() bool
- func (document Document) CC() Document
- func (document Document) Channel() <-chan Document
- func (document *Document) Client() Client
- func (document Document) Clone() Document
- func (document Document) Closed() Document
- func (document Document) Content() string
- func (document Document) Context() string
- func (document Document) Current() Document
- func (document Document) Deleted() time.Time
- func (document Document) Describes() Document
- func (document Document) Duration() string
- func (document Document) EndTime() time.Time
- func (document Document) Endpoints() Document
- func (document Document) First() Document
- func (document Document) Float() float64
- func (document Document) Followers() Document
- func (document Document) Following() Document
- func (document Document) FormerType() string
- func (document Document) Generator() Document
- func (document Document) Get(key string) Document
- func (document Document) HTMLString() string
- func (document Document) HTTPHeader() http.Header
- func (document Document) HasContent() bool
- func (document Document) HasDimensions() bool
- func (document Document) HasImage() bool
- func (document Document) HasSummary() bool
- func (document Document) Head() Document
- func (document Document) Height() int
- func (document Document) Href() string
- func (document Document) Hreflang() string
- func (document Document) ID() string
- func (document Document) Icon() Image
- func (document Document) IconOrImage() Image
- func (document Document) Image() Image
- func (document Document) ImageOrIcon() Image
- func (document Document) InReplyTo() Document
- func (document Document) Inbox() Document
- func (document Document) Instrument() Document
- func (document Document) Int() int
- func (document Document) IsActivity() bool
- func (document Document) IsActor() bool
- func (document Document) IsBool() bool
- func (document Document) IsCollection() bool
- func (document Document) IsEmptyTail() bool
- func (document Document) IsFloat() bool
- func (document Document) IsInt() bool
- func (document Document) IsInt64() bool
- func (document Document) IsMap() bool
- func (document Document) IsNil() bool
- func (document Document) IsObject() bool
- func (document Document) IsSlice() bool
- func (document Document) IsString() bool
- func (document Document) Items() Document
- func (document Document) Last() Document
- func (document Document) Latitude() float64
- func (document Document) Len() int
- func (document Document) Liked() Document
- func (document Document) Likes() Document
- func (document Document) Load(options ...any) (Document, error)
- func (document Document) LoadLink(options ...any) Document
- func (document Document) Location() Document
- func (document Document) Longitude() float64
- func (document Document) Map(options ...string) map[string]any
- func (document Document) MapKeys() []string
- func (document Document) MarshalJSON() ([]byte, error)
- func (document Document) MediaType() string
- func (document Document) MustLoad(options ...any) Document
- func (document Document) Name() string
- func (document Document) Next() Document
- func (document Document) NotActivity() bool
- func (document Document) NotActor() bool
- func (document Document) NotCollection() bool
- func (document Document) NotNil() bool
- func (document Document) NotObject() bool
- func (document Document) Object() Document
- func (document Document) OneOf() Document
- func (document Document) Origin() Document
- func (document Document) Outbox() Document
- func (document Document) PartOf() Document
- func (document Document) PreferredUsername() string
- func (document Document) Prev() Document
- func (document Document) Preview() Document
- func (document Document) PublicKey() Document
- func (document Document) PublicKeyPEM() string
- func (document Document) Published() time.Time
- func (document Document) Radius() float64
- func (document Document) Rel() Document
- func (document Document) Relationship() string
- func (document Document) Replies() Document
- func (document Document) Result() Document
- func (document *Document) SetBCC(value ...string) bool
- func (document *Document) SetBTo(value ...string) bool
- func (document *Document) SetCC(value ...string) bool
- func (document *Document) SetHTTPHeader(httpHeader http.Header)
- func (document *Document) SetProperty(property string, value any)
- func (document *Document) SetString(name string, value ...string) bool
- func (document *Document) SetTo(value ...string) bool
- func (document *Document) SetValue(value property.Value)
- func (document Document) Slice() []any
- func (document Document) SliceOfDocuments() sliceof.Object[Document]
- func (document Document) StartIndex() int
- func (document Document) StartTime() time.Time
- func (document Document) Statistics() Statistics
- func (document Document) Streams() Document
- func (document Document) String() string
- func (document Document) Subject() Document
- func (document Document) Summary() string
- func (document Document) Tag() Document
- func (document Document) Tail() Document
- func (document Document) Target() Document
- func (document Document) Time() time.Time
- func (document Document) To() Document
- func (document Document) TotalItems() int
- func (document Document) Type() string
- func (document Document) URL() string
- func (document Document) URLOrID() string
- func (document Document) Units() string
- func (document *Document) UnmarshalJSON(bytes []byte) error
- func (document Document) UnwrapActivity() Document
- func (document Document) Updated() time.Time
- func (document Document) Username() string
- func (document Document) UsernameOrID() string
- func (document Document) Value() any
- func (document Document) Width() int
- func (document *Document) WithOptions(options ...DocumentOption)
- type DocumentOption
- type Image
- func (image Image) AspectRatio() float64
- func (image Image) HasDimensions() bool
- func (image Image) HasHeight() bool
- func (image Image) HasWidth() bool
- func (image Image) Height() int
- func (image Image) Href() string
- func (image Image) IsNil() bool
- func (image Image) MediaType() string
- func (image Image) NotNil() bool
- func (image Image) Summary() string
- func (image Image) URL() string
- func (image Image) Width() int
- type OrderedCollection
- type OrderedCollectionPage
- type Statistics
Constants ¶
const OptionStripContext = "STRIP_CONTEXT"
OptionStripContext instructs the Document.Map() method to remove the "@context" property from its ouput.
const OptionStripRecipients = "STRIP_RECCIPIENTS"
OptionStripRecipients instructs the Document.Map() method to remove all recipient properties from its output. (To, BTo, CC, BCC)
Variables ¶
This section is empty.
Functions ¶
func UnmarshalItems ¶
Types ¶
type Client ¶ added in v0.1.19
type Client interface { // Load returns a Document representing the specified URI. Load(uri string, options ...any) (Document, error) }
Client represents an HTTP client (or facades in front of one) that can load a JSON-LD document from a remote server. A Client is injected into each streams.Document record so that the Document can load additional linked data as needed.
func NewDefaultClient ¶ added in v0.1.19
func NewDefaultClient() Client
type Collection ¶
type Collection struct { Context Context `json:"@context,omitempty" bson:"context,omitempty"` ID string `json:"id,omitempty" bson:"id,omitempty"` Type string `json:"type,omitempty" bson:"type,omitempty"` Summary string `json:"summary,omitempty" bson:"summary,omitempty"` // A natural language summarization of the object encoded as HTML. Multiple language tagged summaries may be provided. TotalItems int `json:"totalItems,omitempty" bson:"totalItems,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. Current string `json:"current,omitempty" bson:"current,omitempty"` // In a paged Collection, indicates the page that contains the most recently updated member items. First string `json:"first,omitempty" bson:"first,omitempty"` // In a paged Collection, indicates the furthest preceding page of items in the collection. Last string `json:"last,omitempty" bson:"last,omitempty"` // In a paged Collection, indicates the furthest proceeding page of the collection. Items []any `json:"items,omitempty" bson:"items,omitempty"` // Identifies the items contained in a collection. The items might be ordered or unordered. }
Collection is a subtype of Object that represents ordered or unordered sets of Object or Link instances. https://www.w3.org/ns/activitystreams#Collection
func NewCollection ¶ added in v0.1.19
func NewCollection() Collection
func (*Collection) UnmarshalJSON ¶
func (c *Collection) UnmarshalJSON(data []byte) error
func (*Collection) UnmarshalMap ¶
func (c *Collection) UnmarshalMap(data mapof.Any) error
type CollectionPage ¶
type CollectionPage struct { Context Context `json:"@context,omitempty" bson:"context,omitempty"` Type string `json:"type,omitempty" bson:"type,omitempty"` Summary string `json:"summary,omitempty" bson:"summary,omitempty"` // A natural language summarization of the object encoded as HTML. Multiple language tagged summaries may be provided. TotalItems int `json:"totalItems,omitempty" bson:"totalItems,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. Current string `json:"current,omitempty" bson:"current,omitempty"` // In a paged Collection, indicates the page that contains the most recently updated member items. First string `json:"first,omitempty" bson:"first,omitempty"` // In a paged Collection, indicates the furthest preceding page of items in the collection. Last string `json:"last,omitempty" bson:"last,omitempty"` // In a paged Collection, indicates the furthest proceeding page of the collection. PartOf string `json:"partOf,omitempty" bson:"partOf,omitempty"` // dentifies the Collection to which a CollectionPage objects items belong. Prev string `json:"prev,omitempty" bson:"prev,omitempty"` // In a paged Collection, identifies the previous page of items. Next string `json:"next,omitempty" bson:"next,omitempty"` // In a paged Collection, indicates the next page of items. Items []any `json:"items,omitempty" bson:"items,omitempty"` // Identifies the items contained in a collection. The items might be ordered or unordered. }
CollectionPage is used to represent distinct subsets of items from a Collection. Refer to the Activity Streams 2.0 Core for a complete description of the CollectionPage object. https://www.w3.org/ns/activitystreams#CollectionPage
func NewCollectionPage ¶ added in v0.1.19
func NewCollectionPage() CollectionPage
func (*CollectionPage) UnmarshalJSON ¶
func (c *CollectionPage) UnmarshalJSON(data []byte) error
*****************************************
- JSON Marshalling *****************************************
func (*CollectionPage) UnmarshalMap ¶
func (c *CollectionPage) UnmarshalMap(data mapof.Any) error
type Context ¶
type Context []ContextEntry
func DefaultContext ¶
func DefaultContext() Context
DefaultContext represents the standard context defined by the W3C
func NewContext ¶
func (*Context) Add ¶
func (c *Context) Add(vocabulary string) *ContextEntry
Add puts a new ContextEntry into the list and returns a pointer to it so that additional properties can be set.
func (Context) Head ¶
func (c Context) Head() *ContextEntry
func (Context) IsEmptyTail ¶
func (Context) MarshalJSON ¶
func (*Context) UnmarshalJSON ¶
type ContextEntry ¶
type ContextEntry struct { Vocabulary string // The primary vocabulary represented by the context/document. Language string // The language Extensions map[string]string // a map of additional namespaces that are included in this context/document. }
ContextEntry https://www.w3.org/TR/json-ld/#the-context
func NewContextEntry ¶
func NewContextEntry(vocabulary string) ContextEntry
func (ContextEntry) HasExtensions ¶
func (entry ContextEntry) HasExtensions() bool
func (ContextEntry) IsLanguageDefined ¶
func (entry ContextEntry) IsLanguageDefined() bool
func (ContextEntry) IsVocabularyOnly ¶
func (entry ContextEntry) IsVocabularyOnly() bool
func (ContextEntry) MarshalJSON ¶
func (entry ContextEntry) MarshalJSON() ([]byte, error)
func (*ContextEntry) WithExtension ¶
func (entry *ContextEntry) WithExtension(key string, value string) *ContextEntry
func (*ContextEntry) WithLanguage ¶
func (entry *ContextEntry) WithLanguage(language string) *ContextEntry
type DefaultClient ¶ added in v0.1.19
type DefaultClient struct{}
func (DefaultClient) Load ¶ added in v0.1.19
func (client DefaultClient) Load(url string, options ...any) (Document, error)
Load implements the hannibal.Client interface, which loads an ActivityStream document from a remote server. For the hannibal default client, this method simply loads the document from a remote server with no other processing.
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
Document represents a single ActivityStream document or document fragment. Due to the flexibility of ActivityStreams (and JSON-LD), this may be a data structure such as a `map[string]any`, `[]any`, or a primitive type, like a `string`, `float`, `int` or `bool`.
func NewDocument ¶
func NewDocument(value any, options ...DocumentOption) Document
NewDocument creates a new Document object from a JSON-LD map[string]any
func NilDocument ¶
func NilDocument(options ...DocumentOption) Document
NilDocument returns a new, empty Document.
func (Document) Accuracy ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-accuracy
func (Document) Altitude ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-altitude
func (*Document) AppendBCC ¶ added in v0.1.19
AppendBCC appends a value to the "bcc" property of the document
func (*Document) AppendBTo ¶ added in v0.1.19
AppendBTo appends a value to the "bto" property of the document
func (*Document) AppendCC ¶ added in v0.1.19
AppendCC appends a value to the "cc" property of the document
func (*Document) AppendString ¶ added in v0.1.19
AppendString appends a string to a property on the document
func (*Document) AppendTo ¶ added in v0.1.19
AppendTo appends a value to the "to" property of the document
func (Document) AspectRatio ¶ added in v0.1.19
func (Document) Audience ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-audience
func (Document) Channel ¶ added in v0.1.19
Channel returns a channel that iterates over all of the sub-documents in the current document.
func (Document) Closed ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-closed
func (Document) Content ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-content
func (Document) Context ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-context IMPORTANT: THIS IS NOT THE @context PROPERTY REQUIRED FOR EVERY JSON-LD DOCUMENT
func (Document) Current ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-current
func (Document) Deleted ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-deleted
func (Document) Duration ¶
TODO: Implement Durations per https://www.w3.org/TR/activitystreams-vocabulary/#dfn-duration
func (Document) EndTime ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-endtime
func (Document) HTMLString ¶ added in v0.1.19
StringHTML returns the current object as an HTML string. This value is filtered by blueMonday, so it is safe to use in HTML.
func (Document) HTTPHeader ¶ added in v0.1.19
HTTPHeader returns the http.Header object associated with this document
func (Document) HasContent ¶ added in v0.1.19
HasContent returns TRUE if this document has a valid Content property
func (Document) HasDimensions ¶ added in v0.1.19
func (Document) HasImage ¶ added in v0.1.19
HasImage returns TRUE if this document has a valid Image property
func (Document) HasSummary ¶ added in v0.1.19
HasSummary returns TRUE if this document has a valid Summary property
func (Document) Head ¶
Head returns the first object in a slice. For all other document types, it returns the current document.
func (Document) Height ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-height
func (Document) Hreflang ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-hreflang
func (Document) IconOrImage ¶ added in v0.1.19
IconOrImage is a hybrid accessor that returns the "icon" property (if not nil), otherwise it returns the "image" property. This is useful for working with different ActivityPub objects, which may use either property.
func (Document) ImageOrIcon ¶ added in v0.1.19
ImageOrIcon is a hybrid accessor that returns the "image" property (if not nil), otherwise it returns the "icon" property. This is useful for working with different ActivityPub objects, which may use either property.
func (Document) IsActivity ¶ added in v0.1.19
IsActivity returns TRUE if this document represents an Activity
func (Document) IsActor ¶ added in v0.1.19
IsActor returns TRUE if this document represents an Actor
func (Document) IsCollection ¶ added in v0.1.19
IsCollection returns TRUE if this document represents a Collection or CollectionPage
func (Document) IsEmptyTail ¶
IsEmpty return TRUE if the current object is empty
func (Document) IsObject ¶
IsObject returns TRUE if this document represents an Object type (Article, Note, etc)
func (Document) Items ¶
Items returns the items collection for this Document. If the document contains an "orderedItems" collection, then it is returned instead.
func (Document) Latitude ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-latitude
func (Document) Len ¶ added in v0.1.19
Len returns the length of the document. If the document is nil, then this method returns 0 If the document is a slice, then this method returns the length of the slice Otherwise, this method returns 1
func (Document) LoadLink ¶ added in v0.1.19
LoadLink loads a new JSON-LD document from a link or ID string. If the current document has already been loaded (because it's a map) then it is returned as-is.
func (Document) Location ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-location
func (Document) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface, and provides a custom marshalling into JSON -- essentially just aiming the marshaller at the Document's value.
func (Document) MustLoad ¶ added in v0.1.19
MustLoad retrieves a JSON-LD document from its remote server. It silently reports errors, but does not return them.
func (Document) NotActivity ¶ added in v0.1.19
NotActivity returns TRUE if this document does NOT represent an Activity
func (Document) NotActor ¶ added in v0.1.19
NotActor returns TRUE if this document does NOT represent an Actor
func (Document) NotCollection ¶ added in v0.1.19
NotCollection returns TRUE if the document does NOT represent a Collection or CollectionPage
func (Document) NotObject ¶ added in v0.1.19
NotObject returns TRUE if this document does NOT represent an Object type (Article, Note, etc)
func (Document) Object ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object
func (Document) Origin ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-origin
func (Document) PartOf ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-partof
func (Document) PreferredUsername ¶ added in v0.1.19
func (Document) Preview ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-preview
func (Document) PublicKeyPEM ¶ added in v0.1.19
func (Document) Radius ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-radius
func (Document) Rel ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-rel Rel is expected to be a string, but this function returns a document because it may contain multiple values (rel:["canonical", "preview"])
func (Document) Replies ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-replies
func (Document) Result ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-result
func (*Document) SetHTTPHeader ¶ added in v0.1.19
SetHTTPHeader sets the http.Header object associated with this document
func (*Document) SetProperty ¶ added in v0.1.19
SetProperty sets an individual property within this document.
func (*Document) SetValue ¶ added in v0.1.19
SetValue sets the value of this document to a new value.
func (Document) SliceOfDocuments ¶ added in v0.1.19
SliceOfDocuments transforms the current object into a slice of separate Document objects, one for each value in the current document array.
func (Document) Statistics ¶ added in v0.1.19
func (document Document) Statistics() Statistics
Statistics returns counts for various interactions: Announces, Replies, Likes, and Dislikes
func (Document) String ¶ added in v0.1.19
String returns the current object as a pure string (no HTML). This value is filtered by blueMonday, so it is safe to use in HTML.
func (Document) Subject ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-subject
func (Document) Summary ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-summary TODO: Implement Language Maps
func (Document) Tail ¶
Tail returns all records after the first in a slice. For all other document types, it returns a nil document.
func (Document) Target ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-target
func (Document) URLOrID ¶ added in v0.1.19
URLOrID returns the URL of the document, if it exists, otherwise it returns the ID.
func (*Document) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface, and provides a custom un-marshalling from JSON -- essentially just aiming the unmashaller at the Document's value
func (Document) UnwrapActivity ¶ added in v0.1.19
If this document is an activity (create, update, delete, etc), then this method returns the activity's Object. Otherwise, it returns the document itself.
func (Document) Updated ¶
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-updated
func (Document) UsernameOrID ¶ added in v0.1.19
func (*Document) WithOptions ¶ added in v0.1.19
func (document *Document) WithOptions(options ...DocumentOption)
type DocumentOption ¶ added in v0.1.19
type DocumentOption func(*Document)
func WithClient ¶ added in v0.1.19
func WithClient(client Client) DocumentOption
WithClient option sets the HTTP client that can load remote documents if necessary
func WithHTTPHeader ¶ added in v0.1.19
func WithHTTPHeader(httpHeader http.Header) DocumentOption
WithHTTPHeader attaches an HTTP header to the document
func WithStats ¶ added in v0.1.19
func WithStats(statistics Statistics) DocumentOption
WithStats attaches statistics to the document
type Image ¶ added in v0.1.19
type Image struct {
// contains filtered or unexported fields
}
https://www.w3.org/ns/activitystreams#Image
func NewImage ¶ added in v0.1.19
NewImage creates a new Image object from a JSON-LD value (string, map[string]any, or []any)
func (Image) AspectRatio ¶ added in v0.1.19
AspectRatio calculates the aspect ratio of the image (width / height) If height and width are not available, then 0 is returned
func (Image) HasDimensions ¶ added in v0.1.19
HasDimensions returns TRUE if this image has both a height and width defined
func (Image) Height ¶ added in v0.1.19
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-height
func (Image) Href ¶ added in v0.1.19
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-href Note: This method searches both the "href" and "url" properties in maps.
func (Image) MediaType ¶ added in v0.1.19
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-mediatype
func (Image) Summary ¶ added in v0.1.19
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-summary
func (Image) URL ¶ added in v0.1.19
https://www.w3.org/TR/activitystreams-vocabulary/#dfn-href Note: URL is an alias for Href, which is the proper name to use
type OrderedCollection ¶
type OrderedCollection struct { Context Context `json:"@context,omitempty" bson:"@context,omitempty"` ID string `json:"id,omitempty" bson:"id,omitempty"` Type string `json:"type,omitempty" bson:"type,omitempty"` Summary string `json:"summary,omitempty" bson:"summary,omitempty"` // A natural language summarization of the object encoded as HTML. Multiple language tagged summaries may be provided. TotalItems int `json:"totalItems,omitempty" bson:"totalItems,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. OrderedItems []any `json:"orderedItems,omitempty" bson:"orderedItems,omitempty"` // Identifies the items contained in a collection. The items might be ordered or unordered. Current string `json:"current,omitempty" bson:"current,omitempty"` // In a paged Collection, indicates the page that contains the most recently updated member items. First string `json:"first,omitempty" bson:"first,omitempty"` // In a paged Collection, indicates the furthest preceding page of items in the collection. Last string `json:"last,omitempty" bson:"last,omitempty"` // In a paged Collection, indicates the furthest proceeding page of the collection. }
OrderedCollection is a subtype of Collection in which members of the logical collection are assumed to always be strictly ordered. https://www.w3.org/ns/activitystreams#OrderedCollection
func NewOrderedCollection ¶ added in v0.1.19
func NewOrderedCollection() OrderedCollection
func (*OrderedCollection) UnmarshalJSON ¶
func (c *OrderedCollection) UnmarshalJSON(data []byte) error
func (*OrderedCollection) UnmarshalMap ¶
func (c *OrderedCollection) UnmarshalMap(data mapof.Any) error
type OrderedCollectionPage ¶
type OrderedCollectionPage struct { Context Context `json:"@context,omitempty" bson:"context,omitempty"` Type string `json:"type,omitempty" bson:"type,omitempty"` Summary string `json:"summary,omitempty" bson:"summary,omitempty"` // A natural language summarization of the object encoded as HTML. Multiple language tagged summaries may be provided. TotalItems int `json:"totalItems,omitempty" bson:"totalItems,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. Current string `json:"current,omitempty" bson:"current,omitempty"` // In a paged Collection, indicates the page that contains the most recently updated member items. First string `json:"first,omitempty" bson:"first,omitempty"` // In a paged Collection, indicates the furthest preceding page of items in the collection. Last string `json:"last,omitempty" bson:"last,omitempty"` // In a paged Collection, indicates the furthest proceeding page of the collection. StartIndex int `json:"startIndex,omitempty" bson:"startIndex,omitempty"` // A non-negative integer value identifying the relative position within the logical view of a strictly ordered collection. PartOf string `json:"partOf,omitempty" bson:"partOf,omitempty"` // dentifies the Collection to which a CollectionPage objects items belong. Prev string `json:"prev,omitempty" bson:"prev,omitempty"` // In a paged Collection, identifies the previous page of items. Next string `json:"next,omitempty" bson:"next,omitempty"` // In a paged Collection, indicates the next page of items. OrderedItems []any `json:"orderedItems,omitempty" bson:"orderedItems,omitempty"` // Identifies the items contained in a collection. The items might be ordered or unordered. }
OrderedCollectionPage is used to represent ordered subsets of items from an OrderedCollection. Refer to the Activity Streams 2.0 Core for a complete description of the OrderedCollectionPage object. https://www.w3.org/ns/activitystreams#OrderedCollectionPage
func NewOrderedCollectionPage ¶ added in v0.1.19
func NewOrderedCollectionPage() OrderedCollectionPage
func (*OrderedCollectionPage) UnmarshalJSON ¶
func (c *OrderedCollectionPage) UnmarshalJSON(data []byte) error
func (*OrderedCollectionPage) UnmarshalMap ¶
func (c *OrderedCollectionPage) UnmarshalMap(data mapof.Any) error
type Statistics ¶ added in v0.1.19
type Statistics struct { Replies int64 `json:"replies" bson:"replies,omitempty"` // Replies is the number of replies to this document Likes int64 `json:"likes" bson:"likes,omitempty"` // Likes is the number of times this document has been liked Dislikes int64 `json:"dislikes" bson:"dislikes,omitempty"` // Dislikes is the number of times this document has been disliked Announces int64 `json:"announces" bson:"announces,omitempty"` // Announces is the number of times this document has been announced / reposted }
Statistics contains totals for various interactions with a document
func NewStatistics ¶ added in v0.1.19
func NewStatistics() Statistics
NewStatistics returns a fully initialized Statistics object
func (Statistics) HasAnnounces ¶ added in v0.1.19
func (stats Statistics) HasAnnounces() bool
func (Statistics) HasDislikes ¶ added in v0.1.19
func (stats Statistics) HasDislikes() bool
func (Statistics) HasLikes ¶ added in v0.1.19
func (stats Statistics) HasLikes() bool
func (Statistics) HasReplies ¶ added in v0.1.19
func (stats Statistics) HasReplies() bool
func (Statistics) IsEmpty ¶ added in v0.1.19
func (stats Statistics) IsEmpty() bool
func (Statistics) NotEmpty ¶ added in v0.1.19
func (stats Statistics) NotEmpty() bool
Source Files ¶
- client.go
- client_http.go
- collection.go
- collectionPage.go
- context.go
- contextEntry.go
- documentOption.go
- document_.go
- document_actor.go
- document_header.go
- document_json.go
- document_set.go
- document_special.go
- document_vocabulary.go
- image.go
- items.go
- options.go
- orderedCollection.go
- orderedCollectionPage.go
- statistics.go