Documentation ¶
Index ¶
- Variables
- func Marshal(o interface{}) ([]byte, error)
- func MarshalJSON(o interface{}, others ...interface{}) ([]byte, error)
- func MustParseURL(raw string) *url.URL
- func UnmarshalJSON(b []byte, objects ...interface{}) error
- type ActivityOptions
- type ActivityType
- func NewAcceptActivity(obj *ObjectProperty, opts ...Opt) *ActivityType
- func NewAnnounceActivity(obj *ObjectProperty, opts ...Opt) *ActivityType
- func NewCreateActivity(obj *ObjectProperty, opts ...Opt) *ActivityType
- func NewFollowActivity(obj *ObjectProperty, opts ...Opt) *ActivityType
- func NewInviteWitnessActivity(obj *ObjectProperty, opts ...Opt) *ActivityType
- func NewLikeActivity(obj *ObjectProperty, opts ...Opt) *ActivityType
- func NewOfferActivity(obj *ObjectProperty, opts ...Opt) *ActivityType
- func NewRejectActivity(obj *ObjectProperty, opts ...Opt) *ActivityType
- func NewUndoActivity(obj *ObjectProperty, opts ...Opt) *ActivityType
- func (t *ActivityType) Actor() *url.URL
- func (t *ActivityType) MarshalJSON() ([]byte, error)
- func (t *ActivityType) Object() *ObjectProperty
- func (t *ActivityType) Result() *ObjectProperty
- func (t *ActivityType) SetActor(iri *url.URL)
- func (t *ActivityType) Target() *ObjectProperty
- func (t *ActivityType) UnmarshalJSON(bytes []byte) error
- type ActorOptions
- type ActorType
- func (t *ActorType) Followers() *url.URL
- func (t *ActorType) Following() *url.URL
- func (t *ActorType) Inbox() *url.URL
- func (t *ActorType) Liked() *url.URL
- func (t *ActorType) MarshalJSON() ([]byte, error)
- func (t *ActorType) Outbox() *url.URL
- func (t *ActorType) PublicKey() *PublicKeyType
- func (t *ActorType) UnmarshalJSON(bytes []byte) error
- func (t *ActorType) Witnesses() *url.URL
- func (t *ActorType) Witnessing() *url.URL
- type AnchorCredentialReferenceType
- type CollectionOptions
- type CollectionPageType
- type CollectionType
- func (t *CollectionType) Current() *url.URL
- func (t *CollectionType) First() *url.URL
- func (t *CollectionType) Items() []*ObjectProperty
- func (t *CollectionType) Last() *url.URL
- func (t *CollectionType) MarshalJSON() ([]byte, error)
- func (t *CollectionType) TotalItems() int
- func (t *CollectionType) UnmarshalJSON(bytes []byte) error
- type Context
- type ContextProperty
- func (p *ContextProperty) Contains(contexts ...Context) bool
- func (p *ContextProperty) ContainsAny(contexts ...Context) bool
- func (p *ContextProperty) Contexts() []Context
- func (p *ContextProperty) MarshalJSON() ([]byte, error)
- func (p *ContextProperty) String() string
- func (p *ContextProperty) UnmarshalJSON(bytes []byte) error
- type Document
- type ObjectProperty
- func (p *ObjectProperty) Activity() *ActivityType
- func (p *ObjectProperty) AnchorCredentialReference() *AnchorCredentialReferenceType
- func (p *ObjectProperty) Collection() *CollectionType
- func (p *ObjectProperty) IRI() *url.URL
- func (p *ObjectProperty) MarshalJSON() ([]byte, error)
- func (p *ObjectProperty) Object() *ObjectType
- func (p *ObjectProperty) OrderedCollection() *OrderedCollectionType
- func (p *ObjectProperty) Type() *TypeProperty
- func (p *ObjectProperty) UnmarshalJSON(bytes []byte) error
- type ObjectPropertyOptions
- type ObjectType
- func (t *ObjectType) CID() string
- func (t *ObjectType) Context() *ContextProperty
- func (t *ObjectType) EndTime() *time.Time
- func (t *ObjectType) ID() *URLProperty
- func (t *ObjectType) MarshalJSON() ([]byte, error)
- func (t *ObjectType) Published() *time.Time
- func (t *ObjectType) SetID(id *url.URL)
- func (t *ObjectType) StartTime() *time.Time
- func (t *ObjectType) To() Urls
- func (t *ObjectType) Type() *TypeProperty
- func (t *ObjectType) UnmarshalJSON(bytes []byte) error
- func (t *ObjectType) Value(key string) (interface{}, bool)
- type Opt
- func WithActivity(activity *ActivityType) Opt
- func WithActor(actor *url.URL) Opt
- func WithAnchorCredentialReference(ref *AnchorCredentialReferenceType) Opt
- func WithCID(cid string) Opt
- func WithCollection(coll *CollectionType) Opt
- func WithContext(context ...Context) Opt
- func WithCurrent(current *url.URL) Opt
- func WithEndTime(t *time.Time) Opt
- func WithFirst(first *url.URL) Opt
- func WithFollowers(followers *url.URL) Opt
- func WithFollowing(following *url.URL) Opt
- func WithID(id *url.URL) Opt
- func WithIRI(iri *url.URL) Opt
- func WithInbox(inbox *url.URL) Opt
- func WithLast(last *url.URL) Opt
- func WithLiked(liked *url.URL) Opt
- func WithNext(next *url.URL) Opt
- func WithObject(obj *ObjectType) Opt
- func WithOrderedCollection(coll *OrderedCollectionType) Opt
- func WithOutbox(outbox *url.URL) Opt
- func WithOwner(owner *url.URL) Opt
- func WithPartOf(partOf *url.URL) Opt
- func WithPrev(prev *url.URL) Opt
- func WithPublicKey(publicKey *PublicKeyType) Opt
- func WithPublicKeyPem(pem string) Opt
- func WithPublishedTime(t *time.Time) Opt
- func WithResult(result *ObjectProperty) Opt
- func WithStartTime(t *time.Time) Opt
- func WithTarget(target *ObjectProperty) Opt
- func WithTo(to ...*url.URL) Opt
- func WithTotalItems(totalItems int) Opt
- func WithType(t ...Type) Opt
- func WithWitnesses(witnesses *url.URL) Opt
- func WithWitnessing(witnessing *url.URL) Opt
- type Options
- type OrderedCollectionPageType
- type OrderedCollectionType
- type PublicKeyOptions
- type PublicKeyType
- type Type
- type TypeProperty
- type URLCollectionProperty
- type URLProperty
- type Urls
Constants ¶
This section is empty.
Variables ¶
var PublicIRI = MustParseURL("https://www.w3.org/ns/activitystreams#Public")
PublicIRI indicates that the object is public, i.e. it may be viewed by anyone.
Functions ¶
func Marshal ¶ added in v0.1.1
Marshal marshals the given object to a JSON representation without escaping characters such as '&', '<' and '>'.
func MarshalJSON ¶
MarshalJSON marshals the given objects (merging them into one document) and returns the marshalled JSON result.
func MustParseURL ¶ added in v0.1.1
MustParseURL parses the string and returns the URL. This function panics if the string is not a valid URL.
func UnmarshalJSON ¶
UnmarshalJSON unmarshals the given bytes to the set of provided objects.
Types ¶
type ActivityOptions ¶
type ActivityOptions struct { Result *ObjectProperty Actor *url.URL Target *ObjectProperty }
ActivityOptions holds the options for an Activity.
type ActivityType ¶
type ActivityType struct { *ObjectType // contains filtered or unexported fields }
ActivityType defines an 'activity'.
func NewAcceptActivity ¶
func NewAcceptActivity(obj *ObjectProperty, opts ...Opt) *ActivityType
NewAcceptActivity returns a new 'Accept' activity.
func NewAnnounceActivity ¶
func NewAnnounceActivity(obj *ObjectProperty, opts ...Opt) *ActivityType
NewAnnounceActivity returns a new 'Announce' activity.
func NewCreateActivity ¶
func NewCreateActivity(obj *ObjectProperty, opts ...Opt) *ActivityType
NewCreateActivity returns a new 'Create' activity.
func NewFollowActivity ¶
func NewFollowActivity(obj *ObjectProperty, opts ...Opt) *ActivityType
NewFollowActivity returns a new 'Follow' activity.
func NewInviteWitnessActivity ¶
func NewInviteWitnessActivity(obj *ObjectProperty, opts ...Opt) *ActivityType
NewInviteWitnessActivity returns a new 'InviteWitness' activity.
func NewLikeActivity ¶
func NewLikeActivity(obj *ObjectProperty, opts ...Opt) *ActivityType
NewLikeActivity returns a new 'Like' activity.
func NewOfferActivity ¶
func NewOfferActivity(obj *ObjectProperty, opts ...Opt) *ActivityType
NewOfferActivity returns a new 'Offer' activity.
func NewRejectActivity ¶
func NewRejectActivity(obj *ObjectProperty, opts ...Opt) *ActivityType
NewRejectActivity returns a new 'Reject' activity.
func NewUndoActivity ¶
func NewUndoActivity(obj *ObjectProperty, opts ...Opt) *ActivityType
NewUndoActivity returns a new 'Undo' activity.
func (*ActivityType) Actor ¶
func (t *ActivityType) Actor() *url.URL
Actor returns the actor for the activity.
func (*ActivityType) MarshalJSON ¶
func (t *ActivityType) MarshalJSON() ([]byte, error)
MarshalJSON marshals the activity.
func (*ActivityType) Object ¶
func (t *ActivityType) Object() *ObjectProperty
Object returns the object of the activity.
func (*ActivityType) Result ¶
func (t *ActivityType) Result() *ObjectProperty
Result returns the result.
func (*ActivityType) SetActor ¶
func (t *ActivityType) SetActor(iri *url.URL)
SetActor sets the actor for the activity.
func (*ActivityType) Target ¶
func (t *ActivityType) Target() *ObjectProperty
Target returns the target of the activity.
func (*ActivityType) UnmarshalJSON ¶
func (t *ActivityType) UnmarshalJSON(bytes []byte) error
UnmarshalJSON unmarshals the activity.
type ActorOptions ¶
type ActorOptions struct { PublicKey *PublicKeyType Inbox *url.URL Outbox *url.URL Followers *url.URL Following *url.URL Witnesses *url.URL Witnessing *url.URL Liked *url.URL }
ActorOptions holds the options for an Activity.
type ActorType ¶
type ActorType struct { *ObjectType // contains filtered or unexported fields }
ActorType defines an 'actor'.
func NewService ¶
NewService returns a new 'Service' actor type.
func (*ActorType) MarshalJSON ¶
MarshalJSON mmarshals the object to JSON.
func (*ActorType) PublicKey ¶
func (t *ActorType) PublicKey() *PublicKeyType
PublicKey returns the actor's public key.
func (*ActorType) UnmarshalJSON ¶
UnmarshalJSON ummarshals the object from JSON.
func (*ActorType) Witnessing ¶
Witnessing returns the URL of what the actor is witnessing.
type AnchorCredentialReferenceType ¶
type AnchorCredentialReferenceType struct { *ObjectType // contains filtered or unexported fields }
AnchorCredentialReferenceType defines an "AnchorCredentialReference" type.
func NewAnchorCredentialReference ¶
func NewAnchorCredentialReference(id, anchorCredID *url.URL, cid string, opts ...Opt) *AnchorCredentialReferenceType
NewAnchorCredentialReference returns a new "AnchorCredentialReference".
func NewAnchorCredentialReferenceWithDocument ¶
func NewAnchorCredentialReferenceWithDocument( id, anchorCredID *url.URL, cid string, doc Document, opts ...Opt) (*AnchorCredentialReferenceType, error)
NewAnchorCredentialReferenceWithDocument returns a new "AnchorCredentialReference" with the given document embedded.
func (*AnchorCredentialReferenceType) MarshalJSON ¶
func (t *AnchorCredentialReferenceType) MarshalJSON() ([]byte, error)
MarshalJSON mmarshals the object to JSON.
func (*AnchorCredentialReferenceType) Object ¶
func (t *AnchorCredentialReferenceType) Object() *ObjectProperty
Object returns the embedded object (if any).
func (*AnchorCredentialReferenceType) Target ¶
func (t *AnchorCredentialReferenceType) Target() *ObjectProperty
Target returns the target of the anchor credential reference.
func (*AnchorCredentialReferenceType) UnmarshalJSON ¶
func (t *AnchorCredentialReferenceType) UnmarshalJSON(bytes []byte) error
UnmarshalJSON ummarshals the object from JSON.
type CollectionOptions ¶
type CollectionOptions struct { TotalItems int First *url.URL Last *url.URL Current *url.URL PartOf *url.URL Next *url.URL Prev *url.URL }
CollectionOptions holds the options for a Collection or OrderedCollection.
type CollectionPageType ¶
type CollectionPageType struct { *CollectionType // contains filtered or unexported fields }
CollectionPageType defines a "CollectionPage" type.
func NewCollectionPage ¶
func NewCollectionPage(items []*ObjectProperty, opts ...Opt) *CollectionPageType
NewCollectionPage returns a new collection page.
func (*CollectionPageType) MarshalJSON ¶
func (t *CollectionPageType) MarshalJSON() ([]byte, error)
MarshalJSON marshals the collection page.
func (*CollectionPageType) Next ¶
func (t *CollectionPageType) Next() *url.URL
Next return the URL that may be used to retrieve the next page.
func (*CollectionPageType) PartOf ¶
func (t *CollectionPageType) PartOf() *url.URL
PartOf return the URL of the collection of which this page is a part.
func (*CollectionPageType) Prev ¶
func (t *CollectionPageType) Prev() *url.URL
Prev return the URL that may be used to retrieve the previous page.
func (*CollectionPageType) UnmarshalJSON ¶
func (t *CollectionPageType) UnmarshalJSON(bytes []byte) error
UnmarshalJSON unmarshals the collection page.
type CollectionType ¶
type CollectionType struct { *ObjectType // contains filtered or unexported fields }
CollectionType defines a "Collection" type.
func NewCollection ¶
func NewCollection(items []*ObjectProperty, opts ...Opt) *CollectionType
NewCollection returns a new collection.
func (*CollectionType) Current ¶
func (t *CollectionType) Current() *url.URL
Current returns the current item.
func (*CollectionType) First ¶
func (t *CollectionType) First() *url.URL
First returns a URL that may be used to retrieve the first item in the collection.
func (*CollectionType) Items ¶
func (t *CollectionType) Items() []*ObjectProperty
Items returns the items in the collection.
func (*CollectionType) Last ¶
func (t *CollectionType) Last() *url.URL
Last returns a URL that may be used to retrieve the last item in the collection.
func (*CollectionType) MarshalJSON ¶
func (t *CollectionType) MarshalJSON() ([]byte, error)
MarshalJSON marshals the object to JSON.
func (*CollectionType) TotalItems ¶
func (t *CollectionType) TotalItems() int
TotalItems returns the total number of items in the collection.
func (*CollectionType) UnmarshalJSON ¶
func (t *CollectionType) UnmarshalJSON(bytes []byte) error
UnmarshalJSON unmarshals the object from JSON.
type Context ¶
type Context string
Context defines the object context.
const ( // ContextActivityStreams is the ActivityStreams context. ContextActivityStreams Context = "https://www.w3.org/ns/activitystreams" // ContextSecurity is the security context. ContextSecurity Context = "https://w3id.org/security/v1" // ContextCredentials is the verifiable credential context. ContextCredentials Context = "https://www.w3.org/2018/credentials/v1" // ContextOrb is the Orb context. ContextOrb Context = "https://trustbloc.github.io/did-method-orb/contexts/anchor/v1" )
type ContextProperty ¶
type ContextProperty struct {
// contains filtered or unexported fields
}
ContextProperty holds one or more contexts.
func NewContextProperty ¶
func NewContextProperty(context ...Context) *ContextProperty
NewContextProperty returns a new 'context' property. Nil is returned if no context was provided.
func (*ContextProperty) Contains ¶
func (p *ContextProperty) Contains(contexts ...Context) bool
Contains returns true if the property contains all of the given contexts.
func (*ContextProperty) ContainsAny ¶
func (p *ContextProperty) ContainsAny(contexts ...Context) bool
ContainsAny returns true if the property contains any of the given contexts.
func (*ContextProperty) Contexts ¶
func (p *ContextProperty) Contexts() []Context
Contexts returns all of the contexts defined in the property.
func (*ContextProperty) MarshalJSON ¶
func (p *ContextProperty) MarshalJSON() ([]byte, error)
MarshalJSON marshals the context property.
func (*ContextProperty) String ¶
func (p *ContextProperty) String() string
String returns the string representation of the context property.
func (*ContextProperty) UnmarshalJSON ¶
func (p *ContextProperty) UnmarshalJSON(bytes []byte) error
UnmarshalJSON unmarshals the context property.
type Document ¶
type Document map[string]interface{}
Document defines a JSON document as a map.
func MarshalToDoc ¶
MarshalToDoc marshals the given object to a Document.
func MustUnmarshalToDoc ¶
MustUnmarshalToDoc unmarshals the given bytes to a Document. If an error occurs then the function panics.
func UnmarshalToDoc ¶
UnmarshalToDoc unmarshals the given bytes to a Document.
type ObjectProperty ¶
type ObjectProperty struct {
// contains filtered or unexported fields
}
ObjectProperty defines an 'object' property. The property may be a simple IRI or an embedded object such as 'Collection', 'OrderedCollection', 'Activity', etc.
func NewObjectProperty ¶
func NewObjectProperty(opts ...Opt) *ObjectProperty
NewObjectProperty returns a new 'object' property with the given options.
func (*ObjectProperty) Activity ¶
func (p *ObjectProperty) Activity() *ActivityType
Activity returns the activity or nil if the activity is not set.
func (*ObjectProperty) AnchorCredentialReference ¶
func (p *ObjectProperty) AnchorCredentialReference() *AnchorCredentialReferenceType
AnchorCredentialReference returns the anchored credential reference or nil if the anchored credential reference is not set.
func (*ObjectProperty) Collection ¶
func (p *ObjectProperty) Collection() *CollectionType
Collection returns the collection or nil if the collection is not set.
func (*ObjectProperty) IRI ¶
func (p *ObjectProperty) IRI() *url.URL
IRI returns the IRI or nil if the IRI is not set.
func (*ObjectProperty) MarshalJSON ¶
func (p *ObjectProperty) MarshalJSON() ([]byte, error)
MarshalJSON marshals the 'object' property.
func (*ObjectProperty) Object ¶
func (p *ObjectProperty) Object() *ObjectType
Object returns the object or nil if the object is not set.
func (*ObjectProperty) OrderedCollection ¶
func (p *ObjectProperty) OrderedCollection() *OrderedCollectionType
OrderedCollection returns the ordered collection or nil if the ordered collection is not set.
func (*ObjectProperty) Type ¶
func (p *ObjectProperty) Type() *TypeProperty
Type returns the type of the object property. If the property is an IRI then nil is returned.
func (*ObjectProperty) UnmarshalJSON ¶
func (p *ObjectProperty) UnmarshalJSON(bytes []byte) error
UnmarshalJSON unmarshals the 'object' property.
type ObjectPropertyOptions ¶
type ObjectPropertyOptions struct { Iri *url.URL Object *ObjectType Collection *CollectionType OrderedCollection *OrderedCollectionType Activity *ActivityType AnchorCredRef *AnchorCredentialReferenceType }
ObjectPropertyOptions holds options for an 'object' property.
type ObjectType ¶
type ObjectType struct {
// contains filtered or unexported fields
}
ObjectType defines an 'object'.
func NewObjectWithDocument ¶
func NewObjectWithDocument(doc Document, opts ...Opt) (*ObjectType, error)
NewObjectWithDocument returns a new object initialized with the given document.
func (*ObjectType) Context ¶
func (t *ObjectType) Context() *ContextProperty
Context returns the context property.
func (*ObjectType) EndTime ¶
func (t *ObjectType) EndTime() *time.Time
EndTime returns the end time.
func (*ObjectType) MarshalJSON ¶
func (t *ObjectType) MarshalJSON() ([]byte, error)
MarshalJSON marshals the object.
func (*ObjectType) Published ¶
func (t *ObjectType) Published() *time.Time
Published returns the time when the object was published.
func (*ObjectType) StartTime ¶
func (t *ObjectType) StartTime() *time.Time
StartTime returns the start time.
func (*ObjectType) To ¶
func (t *ObjectType) To() Urls
To returns a set of URLs to which the object should be sent.
func (*ObjectType) Type ¶
func (t *ObjectType) Type() *TypeProperty
Type returns the type of the object.
func (*ObjectType) UnmarshalJSON ¶
func (t *ObjectType) UnmarshalJSON(bytes []byte) error
UnmarshalJSON unmarshals the object.
func (*ObjectType) Value ¶
func (t *ObjectType) Value(key string) (interface{}, bool)
Value returns the value of a property.
type Opt ¶
type Opt func(opts *Options)
Opt is an for an object, activity, etc.
func WithActivity ¶
func WithActivity(activity *ActivityType) Opt
WithActivity sets the 'object' property to an embedded activity.
func WithAnchorCredentialReference ¶
func WithAnchorCredentialReference(ref *AnchorCredentialReferenceType) Opt
WithAnchorCredentialReference sets the 'object' property to an embedded anchored credential reference.
func WithCollection ¶
func WithCollection(coll *CollectionType) Opt
WithCollection sets the 'object' property to an embedded collection.
func WithContext ¶
WithContext sets the 'context' property on the object.
func WithCurrent ¶
WithCurrent sets the 'current' property on the collection or ordered collection.
func WithEndTime ¶
WithEndTime sets the 'endTime' property on the object.
func WithFollowers ¶
WithFollowers sets the 'followers' property on the actor.
func WithFollowing ¶
WithFollowing sets the 'following' property on the actor.
func WithObject ¶
func WithObject(obj *ObjectType) Opt
WithObject sets the 'object' property to an embedded object.
func WithOrderedCollection ¶
func WithOrderedCollection(coll *OrderedCollectionType) Opt
WithOrderedCollection sets the 'object' property to an embedded ordered collection.
func WithOutbox ¶
WithOutbox sets the 'outbox' property on the actor.
func WithPartOf ¶
WithPartOf sets the 'partOf' property on a collection page or ordered collection page.
func WithPublicKey ¶
func WithPublicKey(publicKey *PublicKeyType) Opt
WithPublicKey sets the 'publicKey' property on the actor.
func WithPublicKeyPem ¶
WithPublicKeyPem sets the 'publicKeyPem' property on the public key.
func WithPublishedTime ¶
WithPublishedTime sets the 'publishedTime' property on the object.
func WithResult ¶
func WithResult(result *ObjectProperty) Opt
WithResult sets the 'result' property on the activity.
func WithStartTime ¶
WithStartTime sets the 'startTime' property on the object.
func WithTarget ¶
func WithTarget(target *ObjectProperty) Opt
WithTarget sets the 'target' property on the activity.
func WithTotalItems ¶
WithTotalItems sets the 'totalItems' property on the collection or ordered collection.
func WithWitnesses ¶
WithWitnesses sets the 'witnesses' property on the actor.
func WithWitnessing ¶
WithWitnessing sets the 'witnessing' property on the actor.
type Options ¶
type Options struct { Context []Context ID *url.URL To []*url.URL Published *time.Time StartTime *time.Time EndTime *time.Time Types []Type CID string ObjectPropertyOptions CollectionOptions ActivityOptions ActorOptions PublicKeyOptions }
Options holds all of the options for building an ActivityPub object.
func NewOptions ¶
NewOptions returns an Options struct which is populated with the provided options.
type OrderedCollectionPageType ¶
type OrderedCollectionPageType struct { *OrderedCollectionType // contains filtered or unexported fields }
OrderedCollectionPageType defines a "OrderedCollectionPage" type.
func NewOrderedCollectionPage ¶
func NewOrderedCollectionPage(items []*ObjectProperty, opts ...Opt) *OrderedCollectionPageType
NewOrderedCollectionPage returns a new ordered collection page.
func (*OrderedCollectionPageType) MarshalJSON ¶
func (t *OrderedCollectionPageType) MarshalJSON() ([]byte, error)
MarshalJSON marshals the collection page.
func (*OrderedCollectionPageType) Next ¶
func (t *OrderedCollectionPageType) Next() *url.URL
Next return the URL that may be used to retrieve the next page.
func (*OrderedCollectionPageType) PartOf ¶
func (t *OrderedCollectionPageType) PartOf() *url.URL
PartOf return the URL of the collection of which this page is a part.
func (*OrderedCollectionPageType) Prev ¶
func (t *OrderedCollectionPageType) Prev() *url.URL
Prev return the URL that may be used to retrieve the previous page.
func (*OrderedCollectionPageType) UnmarshalJSON ¶
func (t *OrderedCollectionPageType) UnmarshalJSON(bytes []byte) error
UnmarshalJSON unmarshals the collection page.
type OrderedCollectionType ¶
type OrderedCollectionType struct { *CollectionType // contains filtered or unexported fields }
OrderedCollectionType defines an "OrderedCollection" type.
func NewOrderedCollection ¶
func NewOrderedCollection(items []*ObjectProperty, opts ...Opt) *OrderedCollectionType
NewOrderedCollection returns a new ordered collection.
func (*OrderedCollectionType) Items ¶
func (t *OrderedCollectionType) Items() []*ObjectProperty
Items returns the items in the ordered collection.
func (*OrderedCollectionType) MarshalJSON ¶
func (t *OrderedCollectionType) MarshalJSON() ([]byte, error)
MarshalJSON marshals the ordered collection.
func (*OrderedCollectionType) UnmarshalJSON ¶
func (t *OrderedCollectionType) UnmarshalJSON(bytes []byte) error
UnmarshalJSON unmarshals the ordered collection.
type PublicKeyOptions ¶
PublicKeyOptions holds the options for a Public Key.
type PublicKeyType ¶
type PublicKeyType struct { ID *URLProperty `json:"id"` Owner *URLProperty `json:"owner"` PublicKeyPem string `json:"publicKeyPem"` }
PublicKeyType defines a public key object.
func NewPublicKey ¶
func NewPublicKey(opts ...Opt) *PublicKeyType
NewPublicKey returns a new public key object.
type Type ¶
type Type string
Type indicates the type of the object.
const ( // TypeCollection specifies the 'Collection' object type. TypeCollection Type = "Collection" // TypeOrderedCollection specifies the 'OrderedCollection' object type. TypeOrderedCollection Type = "OrderedCollection" // TypeCollectionPage specifies the 'CollectionPage' object type. TypeCollectionPage Type = "CollectionPage" // TypeOrderedCollectionPage specifies the 'OrderedCollectionPage' object type. TypeOrderedCollectionPage Type = "OrderedCollectionPage" // TypeService specifies the 'Service' actor type. TypeService Type = "Service" // TypeCreate specifies the 'Create' activity type. TypeCreate Type = "Create" // TypeAnnounce specifies the 'Announce' activity type. TypeAnnounce Type = "Announce" // TypeFollow specifies the 'Follow' activity type. TypeFollow Type = "Follow" // TypeAccept specifies the 'Accept' activity type. TypeAccept Type = "Accept" // TypeReject specifies the 'Reject' activity type. TypeReject Type = "Reject" // TypeLike specifies the 'Like' activity type. TypeLike Type = "Like" // TypeInviteWitness specifies the 'InviteWitness' activity type. TypeInviteWitness Type = "InviteWitness" // TypeVerifiableCredential specifies the "VerifiableCredential" object type. TypeVerifiableCredential Type = "VerifiableCredential" // TypeContentAddressedStorage specifies the "ContentAddressedStorage" object type. TypeContentAddressedStorage Type = "ContentAddressedStorage" // TypeAnchorCredential specifies the "AnchorCredential" object type. TypeAnchorCredential Type = "AnchorCredential" // TypeAnchorCredentialRef specifies the "AnchorCredentialReference" object type. TypeAnchorCredentialRef Type = "AnchorCredentialReference" // TypeOffer specifies the "Offer" activity type. TypeOffer Type = "Offer" // TypeUndo specifies the "Undo" activity type. TypeUndo Type = "Undo" )
type TypeProperty ¶
type TypeProperty struct {
// contains filtered or unexported fields
}
TypeProperty defines a 'type' property on an abject which can hold one or more types.
func NewTypeProperty ¶
func NewTypeProperty(t ...Type) *TypeProperty
NewTypeProperty returns a new 'type' property. Nil is returned if no types were provided.
func (*TypeProperty) Is ¶
func (p *TypeProperty) Is(types ...Type) bool
Is returns true if the property has all of the given types.
func (*TypeProperty) IsAny ¶
func (p *TypeProperty) IsAny(types ...Type) bool
IsAny returns true if the property has any of the given types.
func (*TypeProperty) MarshalJSON ¶
func (p *TypeProperty) MarshalJSON() ([]byte, error)
MarshalJSON marshals the type property.
func (*TypeProperty) String ¶
func (p *TypeProperty) String() string
String returns the string representation of the type property.
func (*TypeProperty) UnmarshalJSON ¶
func (p *TypeProperty) UnmarshalJSON(bytes []byte) error
UnmarshalJSON unmarshals the type property.
type URLCollectionProperty ¶
type URLCollectionProperty struct {
// contains filtered or unexported fields
}
URLCollectionProperty contains a collection of URLs.
func NewURLCollectionProperty ¶
func NewURLCollectionProperty(urls ...*url.URL) *URLCollectionProperty
NewURLCollectionProperty returns a new URL collection property. Nil is returned if no URLs were provided.
func (*URLCollectionProperty) MarshalJSON ¶
func (p *URLCollectionProperty) MarshalJSON() ([]byte, error)
MarshalJSON marshals the URL collection.
func (*URLCollectionProperty) URLs ¶
func (p *URLCollectionProperty) URLs() []*url.URL
URLs returns the URLs.
func (*URLCollectionProperty) UnmarshalJSON ¶
func (p *URLCollectionProperty) UnmarshalJSON(bytes []byte) error
UnmarshalJSON unmarshals the URL collection.
type URLProperty ¶
type URLProperty struct {
// contains filtered or unexported fields
}
URLProperty holds a URL.
func NewURLProperty ¶
func NewURLProperty(u *url.URL) *URLProperty
NewURLProperty returns a new URL property with the given URL. Nil is returned if the provided URL is nil.
func (*URLProperty) MarshalJSON ¶
func (p *URLProperty) MarshalJSON() ([]byte, error)
MarshalJSON marshals the URL property.
func (*URLProperty) String ¶
func (p *URLProperty) String() string
String returns the string representation of the URL.
func (*URLProperty) UnmarshalJSON ¶
func (p *URLProperty) UnmarshalJSON(bytes []byte) error
UnmarshalJSON unmarshals the URL property.