vocab

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2021 License: Apache-2.0 Imports: 6 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func Marshal(o interface{}) ([]byte, error)

Marshal marshals the given object to a JSON representation without escaping characters such as '&', '<' and '>'.

func MarshalJSON

func MarshalJSON(o interface{}, others ...interface{}) ([]byte, error)

MarshalJSON marshals the given objects (merging them into one document) and returns the marshalled JSON result.

func MustParseURL added in v0.1.1

func MustParseURL(raw string) *url.URL

MustParseURL parses the string and returns the URL. This function panics if the string is not a valid URL.

func UnmarshalJSON

func UnmarshalJSON(b []byte, objects ...interface{}) error

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

func NewService(id *url.URL, opts ...Opt) *ActorType

NewService returns a new 'Service' actor type.

func (*ActorType) Followers

func (t *ActorType) Followers() *url.URL

Followers returns the URL of the actor's followers.

func (*ActorType) Following

func (t *ActorType) Following() *url.URL

Following returns the URL of what the actor is following.

func (*ActorType) Inbox

func (t *ActorType) Inbox() *url.URL

Inbox returns the URL of the actor's inbox.

func (*ActorType) Liked

func (t *ActorType) Liked() *url.URL

Liked returns the URL of what the actor has liked.

func (*ActorType) MarshalJSON

func (t *ActorType) MarshalJSON() ([]byte, error)

MarshalJSON mmarshals the object to JSON.

func (*ActorType) Outbox

func (t *ActorType) Outbox() *url.URL

Outbox returns the URL of the actor's outbox.

func (*ActorType) PublicKey

func (t *ActorType) PublicKey() *PublicKeyType

PublicKey returns the actor's public key.

func (*ActorType) UnmarshalJSON

func (t *ActorType) UnmarshalJSON(bytes []byte) error

UnmarshalJSON ummarshals the object from JSON.

func (*ActorType) Witnesses

func (t *ActorType) Witnesses() *url.URL

Witnesses returns the URL of the actor's witnesses.

func (*ActorType) Witnessing

func (t *ActorType) Witnessing() *url.URL

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

Object returns the embedded object (if any).

func (*AnchorCredentialReferenceType) Target

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

func MarshalToDoc(obj interface{}) (Document, error)

MarshalToDoc marshals the given object to a Document.

func MustUnmarshalToDoc

func MustUnmarshalToDoc(raw []byte) Document

MustUnmarshalToDoc unmarshals the given bytes to a Document. If an error occurs then the function panics.

func UnmarshalToDoc

func UnmarshalToDoc(raw []byte) (Document, error)

UnmarshalToDoc unmarshals the given bytes to a Document.

func (Document) MergeWith

func (doc Document) MergeWith(other Document)

MergeWith merges the document with the given document. Any duplicate fields in the given document are ignored.

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 NewObject

func NewObject(opts ...Opt) *ObjectType

NewObject returns a new 'object'.

func NewObjectWithDocument

func NewObjectWithDocument(doc Document, opts ...Opt) (*ObjectType, error)

NewObjectWithDocument returns a new object initialized with the given document.

func (*ObjectType) CID

func (t *ObjectType) CID() string

CID returns the object's content ID.

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) ID

func (t *ObjectType) ID() *URLProperty

ID returns the object's ID.

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) SetID

func (t *ObjectType) SetID(id *url.URL)

SetID sets the object's ID.

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 WithActor

func WithActor(actor *url.URL) Opt

WithActor sets the 'actor' property on the activity.

func WithAnchorCredentialReference

func WithAnchorCredentialReference(ref *AnchorCredentialReferenceType) Opt

WithAnchorCredentialReference sets the 'object' property to an embedded anchored credential reference.

func WithCID

func WithCID(cid string) Opt

WithCID sets the 'cid' property on the object.

func WithCollection

func WithCollection(coll *CollectionType) Opt

WithCollection sets the 'object' property to an embedded collection.

func WithContext

func WithContext(context ...Context) Opt

WithContext sets the 'context' property on the object.

func WithCurrent

func WithCurrent(current *url.URL) Opt

WithCurrent sets the 'current' property on the collection or ordered collection.

func WithEndTime

func WithEndTime(t *time.Time) Opt

WithEndTime sets the 'endTime' property on the object.

func WithFirst

func WithFirst(first *url.URL) Opt

WithFirst sets the 'first' property on the collection or ordered collection.

func WithFollowers

func WithFollowers(followers *url.URL) Opt

WithFollowers sets the 'followers' property on the actor.

func WithFollowing

func WithFollowing(following *url.URL) Opt

WithFollowing sets the 'following' property on the actor.

func WithID

func WithID(id *url.URL) Opt

WithID sets the 'id' property on the object.

func WithIRI

func WithIRI(iri *url.URL) Opt

WithIRI sets the 'object' property to an IRI.

func WithInbox

func WithInbox(inbox *url.URL) Opt

WithInbox sets the 'inbox' property on the actor.

func WithLast

func WithLast(last *url.URL) Opt

WithLast sets the 'last' property on the collection or ordered collection.

func WithLiked

func WithLiked(liked *url.URL) Opt

WithLiked sets the 'liked' property on the actor.

func WithNext

func WithNext(next *url.URL) Opt

WithNext sets the 'next' property on a collection page or ordered collection page.

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

func WithOutbox(outbox *url.URL) Opt

WithOutbox sets the 'outbox' property on the actor.

func WithOwner

func WithOwner(owner *url.URL) Opt

WithOwner sets the 'owner' property on the public key.

func WithPartOf

func WithPartOf(partOf *url.URL) Opt

WithPartOf sets the 'partOf' property on a collection page or ordered collection page.

func WithPrev

func WithPrev(prev *url.URL) Opt

WithPrev sets the 'prev' 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

func WithPublicKeyPem(pem string) Opt

WithPublicKeyPem sets the 'publicKeyPem' property on the public key.

func WithPublishedTime

func WithPublishedTime(t *time.Time) Opt

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

func WithStartTime(t *time.Time) Opt

WithStartTime sets the 'startTime' property on the object.

func WithTarget

func WithTarget(target *ObjectProperty) Opt

WithTarget sets the 'target' property on the activity.

func WithTo

func WithTo(to ...*url.URL) Opt

WithTo sets the "to" property on the object.

func WithTotalItems

func WithTotalItems(totalItems int) Opt

WithTotalItems sets the 'totalItems' property on the collection or ordered collection.

func WithType

func WithType(t ...Type) Opt

WithType sets tye 'type' property on the object.

func WithWitnesses

func WithWitnesses(witnesses *url.URL) Opt

WithWitnesses sets the 'witnesses' property on the actor.

func WithWitnessing

func WithWitnessing(witnessing *url.URL) Opt

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

func NewOptions(opts ...Opt) *Options

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

type PublicKeyOptions struct {
	Owner        *url.URL
	PublicKeyPem string
}

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) Types

func (p *TypeProperty) Types() []Type

Types returns all types.

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) URL

func (p *URLProperty) URL() *url.URL

URL returns the contained URL.

func (*URLProperty) UnmarshalJSON

func (p *URLProperty) UnmarshalJSON(bytes []byte) error

UnmarshalJSON unmarshals the URL property.

type Urls added in v0.1.1

type Urls []*url.URL

Urls holds a collection of URLs.

func (Urls) Contains added in v0.1.1

func (u Urls) Contains(v fmt.Stringer) bool

Contains returns true if the collection of URLs contains the given URL.

Jump to

Keyboard shortcuts

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