Changes
3 changed files (+27/-14)
-
-
@@ -11,9 +11,15 @@ type CreateActivity struct {} // CreateActivityNew initializes a new CreateActivity message func CreateActivityNew(id ObjectID, o ObjectOrLink) *CreateActivity { func CreateActivityNew(id ObjectID, a ObjectOrLink, o ObjectOrLink) *CreateActivity { act := CreateNew(id, o) if a != nil { act.Actor = Actor(a.(Person)) } c := CreateActivity{ Activity: CreateNew(id, o), Activity: act, Published: time.Now(), }
-
-
-
@@ -10,7 +10,7 @@ func TestCreateActivityNew(t *testing.T) {var testValue = ObjectID("test") var now time.Time c := CreateActivityNew(testValue, nil) c := CreateActivityNew(testValue, nil, nil) now = time.Now() if c.Activity.Id != testValue { t.Errorf("Activity Id '%v' different than expected '%v'", c.Activity.Id, testValue)
-
@@ -24,7 +24,9 @@ func TestCreateActivityNew(t *testing.T) {testValue = ObjectID("my:note") n := ObjectNew("my:note", NoteType) c1 := CreateActivityNew(testValue, n) b := PersonNew("bob") c1 := CreateActivityNew(testValue, *b, n) now = time.Now() if c1.Activity.Id != testValue { t.Errorf("Activity Id '%v' different than expected '%v'", c1.Activity.Id, testValue)
-
@@ -35,6 +37,9 @@ func TestCreateActivityNew(t *testing.T) {if now.Sub(c.Published).Round(time.Millisecond) != 0 { t.Errorf("Published time '%v' different than expected '%v'", c1.Published, now) } if !reflect.DeepEqual(c1.Activity.Actor, Actor(*b)) { t.Errorf("Actor \n'%#v' different than expected \n'%#v'", c1.Activity.Actor, b) } if !reflect.DeepEqual(c1.Activity.Object.(*apObject), n) { t.Errorf("Object \n'%#v' different than expected \n'%#v'", c1.Activity.Object, n) }
-
-
-
@@ -88,6 +88,8 @@ type (ObjectOrLink interface { IsLink() bool IsObject() bool Object() apObject Link() Link } // LinkOrUri is an interface that Object and Link structs implement, and at the same time // they are kept disjointed
-
@@ -124,12 +126,12 @@ func (n NaturalLanguageValue) MarshalJSON() ([]byte, error) {} // Describes an object of any kind. // The apObject type serves as the base type for most of the other kinds of objects defined in the Activity Vocabulary, // The Activity Pub Object type serves as the base type for most of the other kinds of objects defined in the Activity Vocabulary, // including other Core types such as Activity, IntransitiveActivity, Collection and OrderedCollection. type apObject struct { // Provides the globally unique identifier for an apObject or Link. // Provides the globally unique identifier for an Activity Pub Object or Link. Id ObjectID `jsonld:"id,omitempty"` // Identifies the apObject or Link type. Multiple values may be specified. // Identifies the Activity Pub Object or Link type. Multiple values may be specified. Type ActivityVocabularyType `jsonld:"type,omitempty"` // A simple, human-readable, plain-text name for the object. // HTML markup MUST NOT be included. The name MAY be expressed using multiple language-tagged values.
-
@@ -143,7 +145,7 @@ type apObject struct {// 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,omitempty"` // The content or textual representation of the apObject encoded as a JSON string. // The content or textual representation of the Activity Pub Object encoded as a JSON string. // By default, the value of content is HTML. // The mediaType property can be used in the object to indicate a different content type. // (The content MAY be expressed using multiple language-tagged values.)
-
@@ -191,14 +193,14 @@ type apObject struct {Updated time.Time `jsonld:"updated,omitempty"` // Identifies one or more links to representations of the object Url LinkOrUri `jsonld:"url,omitempty"` // Identifies an entity considered to be part of the public primary audience of an apObject // Identifies an entity considered to be part of the public primary audience of an Activity Pub Object To ObjectOrLink `jsonld:"to,omitempty"` // Identifies an apObject that is part of the private primary audience of this apObject. // Identifies an Activity Pub Object that is part of the private primary audience of this Activity Pub Object. Bto ObjectOrLink `jsonld:"bto,omitempty"` // Identifies an apObject that is part of the public secondary audience of this apObject. Cc ObjectOrLink `jsonld:"cc,omitempty"` // Identifies one or more Objects that are part of the private secondary audience of this apObject. Bcc ObjectOrLink `jsonld:"bcc,omitempty"` // Identifies an Activity Pub Object that is part of the public secondary audience of this Activity Pub Object. Cc []ObjectOrLink `jsonld:"cc,omitempty"` // Identifies one or more Objects that are part of the private secondary audience of this Activity Pub Object. Bcc []ObjectOrLink `jsonld:"bcc,omitempty"` // 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],
-