Changes
7 changed files (+84/-87)
-
-
@@ -75,7 +75,7 @@ type Activity struct {// 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 ObjectOrLink `jsonld:"object"` Object ObjectOrLink `jsonld:"object"` } // Indicates that the actor accepts the object. The target property can be used in certain circumstances to indicate
-
@@ -193,12 +193,12 @@ type Question struct {*IntransitiveActivity // 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 ObjectOrLink `jsonld:"oneOf"` OneOf ObjectOrLink `jsonld:"oneOf"` // 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 ObjectOrLink `jsonld:"anyOf"` AnyOf ObjectOrLink `jsonld:"anyOf"` // Indicates that a question has been closed, and answers are no longer accepted. Closed bool `jsonld:"closed"` Closed bool `jsonld:"closed"` } // Instances of IntransitiveActivity are a subtype of Activity representing intransitive actions.
-
@@ -207,23 +207,23 @@ type IntransitiveActivity struct {*BaseObject // 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"` Actor Actor `jsonld:"actor"` // 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 ObjectOrLink `jsonld:"actor"` Target ObjectOrLink `jsonld:"actor"` // 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 ObjectOrLink `jsonld:"actor"` Result ObjectOrLink `jsonld:"actor"` // 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 ObjectOrLink `jsonld:"origin"` Origin ObjectOrLink `jsonld:"origin"` // Identifies one or more objects used (or to be used) in the completion of an Activity. Instrument ObjectOrLink `jsonld:"instrument"` Source Source Instrument ObjectOrLink `jsonld:"instrument"` Source Source } func AcceptNew(id ObjectId) *Accept {
-
@@ -394,4 +394,3 @@ func IntransitiveActivityNew(id ObjectId, _type string) *IntransitiveActivity {return &IntransitiveActivity{BaseObject: &o} }
-
-
-
@@ -64,7 +64,6 @@ func TestValidActivityType(t *testing.T) {} } func TestAcceptNew(t *testing.T) { var testValue = ObjectId("test")
-
@@ -419,7 +418,7 @@ func TestUpdateNew(t *testing.T) {func TestViewNew(t *testing.T) { var testValue = ObjectId("test") a := ViewNew(testValue) a := ViewNew(testValue) if a.Id != testValue { t.Errorf("Activity Id '%v' different than expected '%v'", a.Id, testValue)
-
@@ -427,4 +426,4 @@ func TestViewNew(t *testing.T) {if a.Type != ViewType { t.Errorf("Activity Type '%v' different than expected '%v'", a.Type, ViewType) } } }
-
-
-
@@ -19,25 +19,25 @@ var validActorTypes = [...]string{type Endpoints struct { // Upload endpoint URI for this user for binary data. UploadMedia ObjectOrLink `jsonld:"uploadMedia"` UploadMedia ObjectOrLink `jsonld:"uploadMedia"` // Endpoint URI so this actor's clients may access remote ActivityStreams objects which require authentication // to access. To use this endpoint, the client posts an x-www-form-urlencoded id parameter with the value being // the id of the requested ActivityStreams object. OauthAuthorizationEndpoint ObjectOrLink `jsonld:"oauthAuthorizationEndpoint"` OauthAuthorizationEndpoint ObjectOrLink `jsonld:"oauthAuthorizationEndpoint"` // If OAuth 2.0 bearer tokens [RFC6749] [RFC6750] are being used for authenticating client to server interactions, // this endpoint specifies a URI at which a browser-authenticated user may obtain a new authorization grant. OauthTokenEndpoint ObjectOrLink `jsonld:"oauthTokenEndpoint"` OauthTokenEndpoint ObjectOrLink `jsonld:"oauthTokenEndpoint"` // If OAuth 2.0 bearer tokens [RFC6749] [RFC6750] are being used for authenticating client to server interactions, // this endpoint specifies a URI at which a client may acquire an access token. ProvideClientKey ObjectOrLink `jsonld:"provideClientKey"` ProvideClientKey ObjectOrLink `jsonld:"provideClientKey"` // If Linked Data Signatures and HTTP Signatures are being used for authentication and authorization, // this endpoint specifies a URI at which browser-authenticated users may authorize a client's public // key for client to server interactions. SignClientKey ObjectOrLink `jsonld:"signClientKey"` SignClientKey ObjectOrLink `jsonld:"signClientKey"` // If Linked Data Signatures and HTTP Signatures are being used for authentication and authorization, // this endpoint specifies a URI at which a client key may be signed by the actor's key for a time window to // act on behalf of the actor in interacting with foreign servers. SharedInbox ObjectOrLink `jsonld:"sharedInbox"` SharedInbox ObjectOrLink `jsonld:"sharedInbox"` } // Actor types are Object types that are capable of performing activities.
-
@@ -45,28 +45,28 @@ type Actor struct {*BaseObject // A reference to an [ActivityStreams] OrderedCollection comprised of all the messages received by the actor; // see 5.2 Inbox. Inbox InboxStream `jsonld:"inbox"` Inbox InboxStream `jsonld:"inbox"` // An [ActivityStreams] OrderedCollection comprised of all the messages produced by the actor; // see 5.1 Outbox. Outbox OutboxStream `jsonld:"outbox"` Outbox OutboxStream `jsonld:"outbox"` // A link to an [ActivityStreams] collection of the actors that this actor is following; // see 5.4 Following Collection Following FollowingCollection `jsonld:"following"` Following FollowingCollection `jsonld:"following"` // A link to an [ActivityStreams] collection of the actors that follow this actor; // see 5.3 Followers Collection. Followers FollowersCollection `jsonld:"followers"` Followers FollowersCollection `jsonld:"followers"` // A link to an [ActivityStreams] collection of the actors that follow this actor; // see 5.3 Followers Collection. Liked LikedCollection `jsonld:"liked"` Liked LikedCollection `jsonld:"liked"` // A short username which may be used to refer to the actor, with no uniqueness guarantees. PreferredUsername NaturalLanguageValue `jsonld:"preferredUsername"` PreferredUsername NaturalLanguageValue `jsonld:"preferredUsername"` // A json object which maps additional (typically server/domain-wide) endpoints which may be useful either // for this actor or someone referencing this actor. // This mapping may be nested inside the actor document as the value or may be a link // to a JSON-LD document with these properties. Endpoints Endpoints `jsonld:"endpoints"` Endpoints Endpoints `jsonld:"endpoints"` // A list of supplementary Collections which may be of interest. Streams []Collection `jsonld:"streams"` Streams []Collection `jsonld:"streams"` } // Describes a software application.
-
-
-
@@ -27,7 +27,7 @@ func TestActorNew(t *testing.T) {} func TestPersonNew(t *testing.T) { var testValue= ObjectId("test") var testValue = ObjectId("test") o := PersonNew(testValue) if o.Id != testValue {
-
@@ -39,7 +39,7 @@ func TestPersonNew(t *testing.T) {} func TestApplicationNew(t *testing.T) { var testValue= ObjectId("test") var testValue = ObjectId("test") o := ApplicationNew(testValue) if o.Id != testValue {
-
@@ -51,7 +51,7 @@ func TestApplicationNew(t *testing.T) {} func TestGroupNew(t *testing.T) { var testValue= ObjectId("test") var testValue = ObjectId("test") o := GroupNew(testValue) if o.Id != testValue {
-
@@ -63,7 +63,7 @@ func TestGroupNew(t *testing.T) {} func TestOrganizationNew(t *testing.T) { var testValue= ObjectId("test") var testValue = ObjectId("test") o := OrganizationNew(testValue) if o.Id != testValue {
-
@@ -75,7 +75,7 @@ func TestOrganizationNew(t *testing.T) {} func TestServiceNew(t *testing.T) { var testValue= ObjectId("test") var testValue = ObjectId("test") o := ServiceNew(testValue) if o.Id != testValue {
-
-
-
@@ -13,9 +13,9 @@ type OrderedCollection struct {*BaseObject // 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"` TotalItems uint `jsonld:"totalItems"` // Identifies the items contained in a collection. The items might be ordered or unordered. Items ItemCollection `jsonld:"items"` OrderedItems ItemCollection `jsonld:"orderedItems"` } type Page ObjectOrLink
-
-
-
@@ -47,4 +47,4 @@ func TestOrderedCollectionPageNew(t *testing.T) {t.Errorf("Invalid collection '%v'", p.PartOf) } } }
-
-
-
@@ -1,8 +1,8 @@package activitypub import ( "time" "encoding/json" "time" ) type ObjectId string
-
@@ -18,18 +18,18 @@ const (OrderedCollectionType string = "OrderedCollection" // Object Types ArticleType string = "Article" AudioType string = "Audio" DocumentType string = "Document" EventType string = "Event" ImageType string = "Image" NoteType string = "Note" PageType string = "Page" PlaceType string = "Place" ProfileType string = "Profile" ArticleType string = "Article" AudioType string = "Audio" DocumentType string = "Document" EventType string = "Event" ImageType string = "Image" NoteType string = "Note" PageType string = "Page" PlaceType string = "Place" ProfileType string = "Profile" RelationshipType string = "Relationship" TombstoneType string = "Tombstone" VideoType string = "Video" TombstoneType string = "Tombstone" VideoType string = "Video" // Link Types MentionType string = "Mention"
-
@@ -63,13 +63,13 @@ type LangRef stringtype NaturalLanguageValue map[LangRef]string func (this NaturalLanguageValue) MarshalJSON() ([]byte, error) { if len(this) == 1 { for _, v := range this { return json.Marshal(v) } } if len(this) == 1 { for _, v := range this { return json.Marshal(v) } } return json.Marshal(map[LangRef]string(this)) return json.Marshal(map[LangRef]string(this)) } // Describes an object of any kind.
-
@@ -89,74 +89,74 @@ type Object struct {*BaseObject // 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 ObjectOrLink `jsonld:"attachment"` Attachment ObjectOrLink `jsonld:"attachment"` // 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 ObjectOrLink `jsonld:"attributedTo"` AttributedTo ObjectOrLink `jsonld:"attributedTo"` // Identifies one or more entities that represent the total population of entities // for which the object can considered to be relevant. Audience ObjectOrLink `jsonld:"audience"` Audience ObjectOrLink `jsonld:"audience"` // The content or textual representation of the 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 NaturalLanguageValue `jsonld:"content"` Content NaturalLanguageValue `jsonld:"content"` // 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 ObjectOrLink `jsonld:"context"` Context ObjectOrLink `jsonld:"context"` // 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"` EndTime time.Time `jsonld:"endTime"` // Identifies the entity (e.g. an application) that generated the object. Generator ObjectOrLink `jsonld:"generator"` Generator ObjectOrLink `jsonld:"generator"` // 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 ImageOrLink `jsonld:"icon"` Icon ImageOrLink `jsonld:"icon"` // 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 ImageOrLink `jsonld:"image"` Image ImageOrLink `jsonld:"image"` // Indicates one or more entities for which this object is considered a response. InReplyTo ObjectOrLink `jsonld:"inReplyTo"` InReplyTo ObjectOrLink `jsonld:"inReplyTo"` // Indicates one or more physical or logical locations associated with the object. Location ObjectOrLink `jsonld:"location"` Location ObjectOrLink `jsonld:"location"` // Identifies an entity that provides a preview of this object. Preview ObjectOrLink `jsonld:"preview"` Preview ObjectOrLink `jsonld:"preview"` // The date and time at which the object was published Published time.Time `jsonld:"published"` Published time.Time `jsonld:"published"` // Identifies a Collection containing objects considered to be responses to this object. Replies Collection `jsonld:"replies"` Replies Collection `jsonld:"replies"` // 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"` StartTime time.Time `jsonld:"startTime"` // A natural language summarization of the object encoded as HTML. // *Multiple language tagged summaries may be provided.) Summary NaturalLanguageValue `jsonld:"summary"` Summary NaturalLanguageValue `jsonld:"summary"` // One or more "tags" that have been associated with an objects. A tag can be any kind of Object. // The key difference between attachment and tag is that the former implies association by inclusion, // while the latter implies associated by reference. Tag ObjectOrLink `jsonld:"tag"` Tag ObjectOrLink `jsonld:"tag"` // The date and time at which the object was updated Updated time.Time `jsonld:"updated"` Updated time.Time `jsonld:"updated"` // Identifies one or more links to representations of the object Url LinkOrUri `jsonld:"url"` Url LinkOrUri `jsonld:"url"` // Identifies an entity considered to be part of the public primary audience of an Object To ObjectOrLink `jsonld:"to"` To ObjectOrLink `jsonld:"to"` // Identifies an Object that is part of the private primary audience of this Object. Bto ObjectOrLink `jsonld:"bto"` Bto ObjectOrLink `jsonld:"bto"` // Identifies an Object that is part of the public secondary audience of this Object. Cc ObjectOrLink `jsonld:"cc"` Cc ObjectOrLink `jsonld:"cc"` // Identifies one or more Objects that are part of the private secondary audience of this Object. Bcc ObjectOrLink `jsonld:"bcc"` Bcc ObjectOrLink `jsonld:"bcc"` // 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"` Duration time.Duration `jsonld:"duration"` } // A Link is an indirect, qualified reference to a resource identified by a URL.
-
@@ -171,22 +171,22 @@ type Link struct {// [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 *Link `jsonld:"rel"` Rel *Link `jsonld:"rel"` // When used on a Link, identifies the MIME media type of the referenced resource. // 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"` MediaType MimeType `jsonld:"mediaType"` // On a Link, specifies a hint as to the rendering height in device-independent pixels of the linked resource. Height uint `jsonld:"height"` Height uint `jsonld:"height"` // On a Link, specifies a hint as to the rendering width in device-independent pixels of the linked resource. Width uint `jsonld:"width"` Width uint `jsonld:"width"` // Identifies an entity that provides a preview of this object. Preview ObjectOrLink `jsonld:"preview"` Preview ObjectOrLink `jsonld:"preview"` // The target resource pointed to by a Link. Href URI `jsonld:"href"` // 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"` HrefLang LangRef `jsonld:"hrefLang"` } type ContentType string
-
@@ -218,7 +218,7 @@ func ObjectNew(id ObjectId, _type string) *Object {if !ValidObjectType(_type) { _type = ObjectType } p := BaseObject{Id: id, Type:_type} p := BaseObject{Id: id, Type: _type} return &Object{BaseObject: &p} }
-
@@ -226,7 +226,6 @@ func LinkNew(id ObjectId, _type string) *Link {if !ValidLinkType(_type) { _type = LinkType } p := BaseObject{Id: id, Type:_type} p := BaseObject{Id: id, Type: _type} return &Link{BaseObject: &p} }
-